3 # local configuration specific to meta mode
4 # we assume that MK_DIRDEPS_BUILD=yes
6 # we need this until there is an alternative
7 MK_INSTALL_AS_USER= yes
9 .-include <site.sys.dirdeps.mk>
10 # previously only included for DIRDEPS_BUILD anyway
11 .-include <site.meta.sys.mk>
13 .if ${MK_STAGING} == "yes"
15 STAGE_TARGET_OBJTOP:= ${STAGE_ROOT}/${TARGET_OBJ_SPEC}
16 # These are exported for hooking in out-of-tree builds. They will always
17 # be overridden in sub-makes above when building in-tree.
18 .if ${.MAKE.LEVEL} > 0
19 .export STAGE_OBJTOP STAGE_TARGET_OBJTOP STAGE_HOST_OBJTOP
22 # Use tools/install.sh which can avoid the need for xinstall for simple cases.
23 INSTALL?= sh ${SRCTOP}/tools/install.sh
24 # This is for stage-install to pickup from the environment.
25 REAL_INSTALL:= ${INSTALL}
27 STAGE_INSTALL= sh ${.PARSEDIR:tA}/stage-install.sh OBJDIR=${.OBJDIR:tA}
29 STAGE_LIBDIR= ${STAGE_OBJTOP}${_LIBDIR:U${LIBDIR:U/lib}}
30 STAGE_INCLUDEDIR= ${STAGE_OBJTOP}${INCLUDEDIR:U/usr/include}
31 # this is not the same as INCLUDEDIR
32 STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR:U/include}
33 # the target is usually an absolute path
34 STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP}
36 #LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR}
37 .if ${MK_SYSROOT} == "yes"
38 SYSROOT?= ${STAGE_OBJTOP}
40 LDFLAGS_LAST+= -L${STAGE_LIBDIR}
45 .-include "local.toolchain.mk"
47 .if ${.MAKE.LEVEL} > 0 && ${MACHINE} == "host" && ${.MAKE.DEPENDFILE:E} != "host"
48 # we can use this but should not update it.
49 UPDATE_DEPENDFILE?= NO
52 # define the list of places that contain files we are responsible for
53 .MAKE.META.BAILIWICK = ${SB} ${OBJROOT} ${STAGE_ROOT}
55 CSU_DIR.${MACHINE_ARCH} ?= csu/${MACHINE_ARCH}
56 CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
58 .if !empty(TIME_STAMP)
59 TRACER= ${TIME_STAMP} ${:U}
61 .if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
66 # toolchains can be a pain - especially bootstrappping them
67 .if ${MACHINE} == "host"
68 MK_SHARED_TOOLCHAIN= no
70 TOOLCHAIN_VARS= AS AR CC CLANG_TBLGEN CXX CPP LD NM OBJCOPY RANLIB \
71 STRINGS SIZE LLVM_TBLGEN
72 _toolchain_bin_CLANG_TBLGEN= /usr/bin/clang-tblgen
73 _toolchain_bin_LLVM_TBLGEN= /usr/bin/llvm-tblgen
74 _toolchain_bin_CXX= /usr/bin/c++
76 TOOLSDIR?= ${HOST_OBJTOP}/tools
77 .elif defined(STAGE_HOST_OBJTOP)
78 TOOLSDIR?= ${STAGE_HOST_OBJTOP}
80 .if ${MK_DIRDEPS_BUILD} == "yes" && ${MACHINE} != "host"
81 # ideally tools needed by makefiles like sh,csh,tinfo
82 # would be built in their own directories but for now
83 # this works well enough.
84 BTOOLSPATH= ${HOST_OBJTOP}/${RELDIR}
86 # Only define if it exists in case user didn't run bootstrap-tools. Otherwise
87 # the tool will be built during the build. Building it assumes it is
89 .if exists(${HOST_OBJTOP}/tools${.CURDIR})
90 BTOOLSPATH= ${HOST_OBJTOP}/tools${.CURDIR}
94 # Don't use the bootstrap tools logic on itself.
95 .if ${.TARGETS:Mbootstrap-tools} == "" && \
96 !make(test-system-*) && !make(showconfig) && !make(print-dir) && \
97 !defined(BOOTSTRAPPING_TOOLS) && !empty(TOOLSDIR) && ${.MAKE.LEVEL} == 0
98 .for dir in /sbin /bin /usr/sbin /usr/bin
99 PATH:= ${TOOLSDIR}${dir}:${PATH}
102 # Prefer the TOOLSDIR version of the toolchain if present vs the host version.
103 .for var in ${TOOLCHAIN_VARS}
104 _toolchain_bin.${var}= ${TOOLSDIR}${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
105 .if exists(${_toolchain_bin.${var}})
106 HOST_${var}?= ${_toolchain_bin.${var}}
112 .for var in ${TOOLCHAIN_VARS}
113 HOST_${var}?= ${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
116 .if ${MACHINE} == "host"
117 .for var in ${TOOLCHAIN_VARS}
118 ${var}= ${HOST_${var}}
122 .if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
124 .if !defined(FREEBSD_REVISION)
125 FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh
126 .export FREEBSD_REVISION
128 CROSS_TARGET_FLAGS= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
129 CFLAGS+= ${CROSS_TARGET_FLAGS}
130 ACFLAGS+= ${CROSS_TARGET_FLAGS}
133 # we set these here, rather than local.gendirdeps.mk
134 # so we can ensure any DEP_* values that might be used in
135 # conditionals do not cause syntax errors when Makefile.depend
136 # is included at level 1+
138 # order of this list matters!
139 GENDIRDEPS_FILTER_DIR_VARS+= \
143 # order of this list matters!
144 GENDIRDEPS_FILTER_VARS+= \
146 DEP_MACHINE_CPUARCH \
150 .if ${.MAKE.LEVEL} > 0
151 .for V in ${GENDIRDEPS_FILTER_DIR_VARS:MDEP_*:O:u} \
152 ${GENDIRDEPS_FILTER_VARS:MDEP_*:O:u}
153 $V?= ${${V:S,DEP_,,}}
157 .if ${MACHINE} == "host" && ${.MAKE.OS} != "FreeBSD"
158 # some makefiles expect this