Fix GCC image building

This commit is contained in:
Arun Thomas 2011-07-09 15:04:42 +02:00
parent a97a80178e
commit b956c8735e
42 changed files with 64 additions and 57 deletions

View file

@ -1,7 +1,7 @@
.if (${NBSD_LIBC} != "no")
.if ${COMPILER_TYPE} == "gnu"
CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE
LDADD+= -lminlib -lcompat_minix
DEPEND+= ${LIBMINLIB} ${LIBCOMPAT_MINIX}
DPADD+= ${LIBMINLIB} ${LIBCOMPAT_MINIX}
.else
CPPFLAGS+= -D_MINIX -D_POSIX_SOURCE
.endif

View file

@ -149,6 +149,6 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>
.endif

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -14,4 +14,4 @@ BINDIR?= /usr/sbin
debug= 0
CPPFLAGS+= -Ddebug=${debug} -w
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -14,4 +14,4 @@ BINDIR?= /usr/sbin
debug= 0
CPPFLAGS+= -Ddebug=$(debug)
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,4 +11,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,4 +11,4 @@ BINDIR?= /usr/sbin
CPPFLAGS+= -DDEBUG=1 -DDEBUG2=0
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,4 +11,4 @@ BINDIR?= /usr/sbin
CPPFLAGS.orinoco.c+= -I${MINIXSRCDIR}
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -159,4 +159,4 @@ elfstrip: $(PROGRAMS)
strip $(PROGRAMS)
.endif
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -13,5 +13,5 @@ BINDIR?= /usr/sbin
CPPFLAGS.random.c+= -I${MINIXSRCDIR}
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,4 +11,4 @@ BINDIR?= /sbin
CPPFLAGS+= -D_SYSTEM=1
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,4 +11,4 @@ BINDIR?= /usr/sbin
CPPFLAGS+= -I${MINIXSRCDIR}
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,4 +11,4 @@ BINDIR?= /usr/sbin
CPPFLAGS+= -I${MINIXSRCDIR}
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -22,26 +22,17 @@ CFLAGS += -D__kernel__
LDFLAGS+= -.o
.elif ${COMPILER_TYPE} == "gnu"
CFLAGS+=-march=i386
CPPFLAGS+= -ffreestanding -fno-stack-protector
CPPFLAGS+= -ffreestanding -fno-stack-protector -D_NETBSD_SOURCE
LDFLAGS+= -T ${.CURDIR}/arch/${ARCH}/kernel.lds
LDFLAGS+= -nostdlib -L${LIBDIR}
.endif
.if (${NBSD_LIBC} != "no")
LDADD+= -lminlib
DPADD+= ${LIBMINLIB}
CPPFLAGS+= -D_NETBSD_SOURCE
.else
.if ${CC} == "gcc"
DPADD+= ${LIBC}
LDADD+= -lgcc -lc -lgcc
LDADD+= -lgcc -lsys -lgcc
.elif ${CC} == "clang"
LDADD+= -L/usr/pkg/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic
DPADD+= ${LIBC}
LDADD+= -L/usr/pkg/lib
LDADD+= -lCompilerRT-Generic -lc -lCompilerRT-Generic
.endif
.endif
CPPFLAGS+= -I${.CURDIR} -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}

View file

@ -244,6 +244,8 @@ int posix_memalign(void **, size_t, size_t);
void *alloca(int); /* built-in for gcc */
#elif defined(__PCC__) && !defined(__GNUC__)
#define alloca(size) __builtin_alloca(size)
#elif (__GNUC__ >= 2)
#define alloca(size) __builtin_alloca(size)
#else
void *alloca(size_t);
#endif /* __GNUC__ */

View file

@ -1,4 +1,4 @@
.if (${NBSD_LIBC} != "no")
.if ${COMPILER_TYPE} == "gnu"
CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE
LDADD+= -lminlib -lcompat_minix
DPADD+= ${LIBMINLIB} ${LIBCOMPAT_MINIX}

View file

@ -9,4 +9,4 @@ BINDIR?= /sbin
INSTALLFLAGS+= -S 128k
MAN=
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -16,4 +16,4 @@ INSTALLFLAGS+= -S 128k
DEFAULT_NR_BUFS= 1024
CPPFLAGS+= -DDEFAULT_NR_BUFS=${DEFAULT_NR_BUFS}
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,4 +11,4 @@ MAN=
BINDIR?= /sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -21,4 +21,4 @@ BINDIR?= /usr/sbin
CPPFLAGS+= -I${.CURDIR} -D_MINIX
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -1,4 +1,6 @@
# Makefile for the init program (INIT)
.include <bsd.own.mk>
PROG= init
SRCS= init.c
@ -7,4 +9,8 @@ MAN=
BINDIR?= /usr/sbin
INSTALLFLAGS+= -S 64k
.include <minix.bootprog.mk>
.if ${OBJECT_FMT} == "ELF"
LDFLAGS+= -Wl,--section-start=.init=0x0
.endif
.include <bsd.prog.mk>

View file

@ -9,4 +9,4 @@ MAN=
BINDIR?= /usr/sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -13,4 +13,4 @@ CPPFLAGS.dmp_kernel.c+= -I${MINIXSRCDIR}
CPPFLAGS.dmp_rs.c+= -I${MINIXSRCDIR}
CPPFLAGS.dmp_vm.c+= -I${MINIXSRCDIR}
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -13,4 +13,4 @@ BINDIR?= /sbin
NR_BUFS= 100
CPPFLAGS+= -DNR_BUFS=${NR_BUFS}
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -23,4 +23,4 @@ CPPFLAGS+= -I${.CURDIR}/../../lib/liblwip/include
CFLAGS += -Wextra -std=c99
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,4 +11,4 @@ MAN=
BINDIR?= /sbin
.include <bsd.prog.mk>
.include <minix.service.mk>

View file

@ -11,7 +11,7 @@ FILES= bsd.ack.mk bsd.dep.mk bsd.files.mk \
pkgsrchooks.mk sys.mk
# MINIX-specific files
FILES+= minix.bootprog.mk
FILES+= minix.bootprog.mk minix.service.mk
FILESDIR=/usr/share/mk
.endif

View file

@ -187,12 +187,6 @@ _LDADD.${_P}= ${LDADD} ${LDADD.${_P}}
_LDFLAGS.${_P}= ${LDFLAGS} ${LDFLAGS.${_P}}
_LDSTATIC.${_P}= ${LDSTATIC} ${LDSTATIC.${_P}}
.if defined(NBSD_LIBC) && (${NBSD_LIBC} == "yes") && \
!empty(_LDADD.${_P}:M-lsys)
# defined(USE_LIBSYS) && (${USE_LIBSYS} == "yes")
_LDADD.${_P}+= -nodefaultlibs -lgcc -lsys -lgcc
.endif
##### Build and install rules
.if !empty(_APPEND_SRCS:M[Yy][Ee][Ss])
SRCS+= ${SRCS.${_P}} # For bsd.dep.mk

View file

@ -5,4 +5,4 @@
LDFLAGS+= -Wl,--section-start=.init=0x0
.endif
.include <bsd.prog.mk>
.include <minix.service.mk>

14
share/mk/minix.service.mk Normal file
View file

@ -0,0 +1,14 @@
# MINIX-specific servers/drivers options
.include <bsd.own.mk>
.if ${COMPILER_TYPE} == "gnu"
.if ${CC} == "gcc"
LDADD+= -nodefaultlibs -lgcc -lsys -lgcc
.elif ${CC} == "clang"
LDADD+= -nodefaultlibs -L/usr/pkg/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic
.endif
.endif
.include <bsd.prog.mk>