# A. Generate C tools used to build ash
.for tool in init nodes signames syntax
${.OBJDIR}/mk${tool}: ${.CURDIR}/mk${tool}.c
- ${HOST_CC} ${.ALLSRC} -o ${.TARGET}
+ ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${.ALLSRC} -o ${.TARGET}
CLEANFILES+= ${.OBJDIR}/mk${tool}
.endfor
.src.map:
${_MKTARGET_CREATE}
- ${HOST_CC} ${HOST_LDFLAGS} -DKEYSRC=\"$<\" -o ${.OBJDIR}/${.TARGET}_genmap ${.CURDIR}/genmap.c
+ ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} -DKEYSRC=\"$<\" -o ${.OBJDIR}/${.TARGET}_genmap ${.CURDIR}/genmap.c
${.OBJDIR}/${.TARGET}_genmap > ${.OBJDIR}/${.TARGET}
rm -f ${.OBJDIR}/${.TARGET}_genmap
DOCGRP?= operator
MKBINUTILS?= no
-MKGDB:= no
MKGCC?= no
MKGCCCMDS?= no
+MKPROFILE?= no
MKSLJIT?= no
+#MINIX-specific variables
+MKCOVERAGE?= no
+
+# LSC MINIX does not support these features ATM.
+USE_FORT:= no
+USE_SSP:= no
+MKCRYPTO:= no
+MKGDB:= no
+MKGROFF:= no
+MKHESIOD:= no
+MKHTML:= no
+MKINET6:= no
+MKIPFILTER:= no
+MKISCSI:= no
+MKKERBEROS:= no
+MKKMOD:= no
+MKLDAP:= no
+MKLINT:= no
+MKLVM:= no
+MKMDNS:= no
+MKNLS:= no
+MKNPF:= no
+MKPAM:= no
+MKPF:= no
+MKPOSTFIX:= no
+MKRUMP:= no
+MKSKEY:= no
+MKYP:= no
+
# LSC MINIX SMP Support?
.ifdef CONFIG_SMP
SMP_FLAGS += -DCONFIG_SMP
MKBITCODE:=no
. endif
. endif # ${_HAVE_GOLD:U} == ""
+
+# If DESTDIR was specified, and we are not using the tools, then make sure to
+# build out-of-tree and to refer only DESTDIR for target binaries
+# The case when using tools is already handled below.
+. if ${DESTDIR:U} != ""
+ CPPFLAGS+= --sysroot=${DESTDIR}
+ LDFLAGS+= --sysroot=${DESTDIR}
+. if defined(HAVE_LLVM)
+ LDFLAGS+= -L${DESTDIR}/usr/lib
+. endif
+. endif # ${DESTDIR:U} != ""
. endif # ${USETOOLS:Uno} != "yes"
. if !defined(HOSTPROG) && !defined(HOSTLIB)
MKZFS?= yes
.endif
-# Some tough Minix defaults
-MKCOVERAGE?= no
-MKPROFILE?= no
+# LSC: MINIX: Has to be here, otherwise libgcc_s.a is not found!?
MKSTATICLIB:= yes
-MKLINT:= no
-
-# LSC MINIX does not support these features ATM.
-USE_FORT:= no
-USE_SSP:= no
-MKYP:= no
-MKPF:= no
-MKNLS:= no
-MKHESIOD:= no
-MKPOSTFIX:= no
-MKKMOD:= no
-MKEXTSRC:= no
-MKRUMP:= no
-MKSKEY:= no
-MKCRYPTO:= no
-MKMDNS:= no
-MKNPF:= no
-MKISCSI:= no
-MKLVM:= no
-MKKERBEROS:= no
-MKLDAP:= no
-MKPAM:= no
-MKIPFILTER:= no
-MKINET6:= no
-MKGROFF:= no
-MKHTML:= no
#
# MK* options which default to "yes".
# LSC Make sure there is not leftover after a failed testrun
clean: .PHONY .MAKE
- $(MAKE) -C select clean
- rm -rf DIR*
+ @${MAKE} -C select clean || true
+ @rm -rf DIR*
.include <bsd.prog.mk>