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