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 TOOLCHAIN_VARS= AS AR CC CLANG_TBLGEN CXX CPP LD NM OBJCOPY RANLIB \
68 STRINGS SIZE LLVM_TBLGEN
69 _toolchain_bin_CLANG_TBLGEN= /usr/bin/clang-tblgen
70 _toolchain_bin_LLVM_TBLGEN= /usr/bin/llvm-tblgen
71 _toolchain_bin_CXX= /usr/bin/c++
73 TOOLSDIR?= ${HOST_OBJTOP}/tools
74 .elif defined(STAGE_HOST_OBJTOP)
75 TOOLSDIR?= ${STAGE_HOST_OBJTOP}
77 .if ${MK_DIRDEPS_BUILD} == "yes" && ${MACHINE} != "host"
78 # ideally tools needed by makefiles like sh,csh,tinfo
79 # would be built in their own directories but for now
80 # this works well enough.
81 BTOOLSPATH= ${HOST_OBJTOP}/${RELDIR}
83 # Only define if it exists in case user didn't run bootstrap-tools. Otherwise
84 # the tool will be built during the build. Building it assumes it is
86 .if exists(${HOST_OBJTOP}/tools${.CURDIR})
87 BTOOLSPATH= ${HOST_OBJTOP}/tools${.CURDIR}
91 # Don't use the bootstrap tools logic on itself.
92 .if ${.TARGETS:Mbootstrap-tools} == "" && \
93 !make(test-system-*) && !make(showconfig) && !make(print-dir) && \
94 !defined(BOOTSTRAPPING_TOOLS) && !empty(TOOLSDIR) && ${.MAKE.LEVEL} == 0
95 .for dir in /sbin /bin /usr/sbin /usr/bin
96 PATH:= ${TOOLSDIR}${dir}:${PATH}
99 # Prefer the TOOLSDIR version of the toolchain if present vs the host version.
100 .for var in ${TOOLCHAIN_VARS}
101 _toolchain_bin.${var}= ${TOOLSDIR}${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
102 .if exists(${_toolchain_bin.${var}})
103 HOST_${var}?= ${_toolchain_bin.${var}}
109 .for var in ${TOOLCHAIN_VARS}
110 HOST_${var}?= ${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
113 .if ${MACHINE} == "host"
114 .for var in ${TOOLCHAIN_VARS}
115 ${var}= ${HOST_${var}}
119 .if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
121 .if !defined(FREEBSD_REVISION)
122 FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh
123 .export FREEBSD_REVISION
125 CROSS_TARGET_FLAGS= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
126 CFLAGS+= ${CROSS_TARGET_FLAGS}
127 ACFLAGS+= ${CROSS_TARGET_FLAGS}
130 # we set these here, rather than local.gendirdeps.mk
131 # so we can ensure any DEP_* values that might be used in
132 # conditionals do not cause syntax errors when Makefile.depend
133 # is included at level 1+
135 # order of this list matters!
136 GENDIRDEPS_FILTER_DIR_VARS+= \
140 # order of this list matters!
141 GENDIRDEPS_FILTER_VARS+= \
143 DEP_MACHINE_CPUARCH \
147 .if ${.MAKE.LEVEL} > 0
148 .for V in ${GENDIRDEPS_FILTER_DIR_VARS:MDEP_*:O:u} \
149 ${GENDIRDEPS_FILTER_VARS:MDEP_*:O:u}
150 $V?= ${${V:S,DEP_,,}}
154 .if ${MACHINE} == "host" && ${.MAKE.OS} != "FreeBSD"
155 # some makefiles expect this