HardenedBSD/share/mk/local.init.mk

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.3 KiB
Makefile
Raw Normal View History

.if !target(__${_this}__)
__${_this}__:
.if ${.MAKE.MODE:Mmeta*} != ""
.if !empty(SUBDIR) && !defined(LIB) && !defined(PROG) && ${.MAKE.MAKEFILES:M*bsd.prog.mk} == ""
.if ${.MAKE.MODE:Mleaf*} != ""
# we only want leaf dirs to build in meta mode... and we are not one
.MAKE.MODE = normal
.endif
.endif
.endif
# XXX: This should be combined with external compiler support in Makefile.inc1
# and local.meta.sys.mk (CROSS_TARGET_FLAGS)
.if ${MK_SYSROOT} == "yes" && !empty(SYSROOT) && ${MACHINE:Nhost*} != ""
CFLAGS_LAST+= --sysroot=${SYSROOT}
CXXFLAGS_LAST+= --sysroot=${SYSROOT}
LDADD+= --sysroot=${SYSROOT}
.elif ${MK_STAGING} == "yes"
Simplify building host tools during DIRDEPS_BUILD The whole point of the DIRDEPS_BUILD is to avoid tree walks and basically build everything in a single pass. We use the pseudo MACHINE "host" to represent the build host. When the build host is not FreeBSD or is an older version of FreeBSD it may need some help to build host-tools. The directory tools/build does this - building libegacy. local.sys.mk: create a pseudo option MK_host_egacy to indicate if tools/build needs to be built for "host". local.dirdeps.mk: set MK_host_egacy.host to ${MK_host_egacy} all other DEP_MACHINES will get "no" This allows a Makefile.depend.options in makefs etc to cause tools/build to be built for host but only if necessary. local.init.mk: use ISYSTEM as arg to -isystem so that it can be overridden. The default remains ${STAGE_INCLUDEDIR} src.init.mk: if MACHINE is host and we are not FreeBSD set some MK_ flags the same as tools/build/mk/Makefile.boot.pre and include src.init.${.MAKE.OS:tl}.mk if it exists. For older versions of FreeBSD add libegacy when building PROGs for "host" Also instead of -isystem${STAGE_INCLUDEDIR} we want -I${STAGE_INCLUDEDIR} and -isystem/usr/include so we override ISYSTEM. This means any headers we stage for "host" will take precedence over system headers but #include_next will DTRT. src.init.linux.mk: add -I${SRCTOP}/tools/build/cross-build/include/linux and generally deal with building host tools on Linux. Eg. static linking does not work so set NO_SHARED= no Override some HAVE_ flags. src.sys.env.mk: on linux awk throws an warning about # in newvers.sh just send stderr to /dev/null Reviewed by: jrtc27, arichardson Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D39744
2023-04-22 21:01:49 +02:00
ISYSTEM?= ${STAGE_INCLUDEDIR}
# no space after -isystem makes it easier to
# grep the flag out of command lines (in meta files) to see its value.
CFLAGS+= -isystem${ISYSTEM}
# XXX: May be needed for GCC to build with libc++ rather than libstdc++. See Makefile.inc1
#CXXFLAGS+= -std=gnu++11
#LDADD+= -L${STAGE_LIBDIR}/libc++
#CXXFLAGS+= -I${STAGE_INCLUDEDIR}/usr/include/c++/v1
LDADD+= -L${STAGE_LIBDIR}
.endif
.if ${MACHINE:Nhost*} == ""
.if ${.MAKE.DEPENDFILE:E:Nhost*} != ""
UPDATE_DEPENDFILE?= no
.endif
HOST_CFLAGS+= -DHOSTPROG
CFLAGS+= ${HOST_CFLAGS}
.endif
.-include "src.init.mk"
.-include <site.init.mk>
.-include "${.CURDIR}/local.init.mk"
.endif