]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/local.meta.sys.mk
Import tzdata 2019c.
[FreeBSD/FreeBSD.git] / share / mk / local.meta.sys.mk
1 # $FreeBSD$
2
3 # local configuration specific to meta mode
4 # XXX some of this should be in meta.sys.mk
5 # we assume that MK_DIRDEPS_BUILD=yes
6
7 # we need this until there is an alternative
8 MK_INSTALL_AS_USER= yes
9
10 _default_makeobjdir=$${.CURDIR:S,^$${SRCTOP},$${OBJTOP},}
11
12 .if empty(OBJROOT) || ${.MAKE.LEVEL} == 0
13 .if defined(MAKEOBJDIRPREFIX) && !empty(MAKEOBJDIRPREFIX)
14 # put things approximately where they want
15 OBJROOT:=${MAKEOBJDIRPREFIX}${SRCTOP}/
16 MAKEOBJDIRPREFIX=
17 .export MAKEOBJDIRPREFIX
18 .endif
19 .if empty(MAKEOBJDIR)
20 # OBJTOP set below
21 MAKEOBJDIR=${_default_makeobjdir}
22 # export but do not track
23 .export-env MAKEOBJDIR
24 # Expand for our own use
25 MAKEOBJDIR:= ${MAKEOBJDIR}
26 .endif
27 .if !empty(SB)
28 SB_OBJROOT ?= ${SB}/obj/
29 # this is what we use below
30 OBJROOT ?= ${SB_OBJROOT}
31 .endif
32 OBJROOT ?= /usr/obj${SRCTOP}/
33 .if ${OBJROOT:M*/} != ""
34 OBJROOT:= ${OBJROOT:H:tA}/
35 .else
36 OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T}
37 .endif
38 .export OBJROOT SRCTOP
39
40 # we need HOST_TARGET etc below.
41 .include <host-target.mk>
42 .export HOST_TARGET
43 .endif
44
45 # from src/Makefile (for universe)
46 TARGET_ARCHES_arm?=     arm armeb armv6
47 TARGET_ARCHES_arm64?=   aarch64
48 TARGET_ARCHES_mips?=    mipsel mips mips64el mips64 mipsn32 mipsn32el
49 TARGET_ARCHES_powerpc?= powerpc powerpc64
50 TARGET_ARCHES_pc98?=    i386
51 TARGET_ARCHES_riscv?=   riscv64
52
53 # some corner cases
54 BOOT_MACHINE_DIR.amd64 = boot/i386
55 MACHINE_ARCH.host = ${_HOST_ARCH}
56
57 # the list of machines we support
58 ALL_MACHINE_LIST?= amd64 arm arm64 i386 mips pc98 powerpc riscv sparc64
59 .for m in ${ALL_MACHINE_LIST:O:u}
60 MACHINE_ARCH_LIST.$m?= ${TARGET_ARCHES_${m}:U$m}
61 MACHINE_ARCH.$m?= ${MACHINE_ARCH_LIST.$m:[1]}
62 BOOT_MACHINE_DIR.$m ?= boot/$m
63 .endfor
64
65 .ifndef _TARGET_SPEC
66 .if empty(MACHINE_ARCH)
67 .if !empty(TARGET_ARCH)
68 MACHINE_ARCH= ${TARGET_ARCH}
69 .else
70 MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}}
71 .endif
72 .endif
73 MACHINE_ARCH?= ${MACHINE_ARCH.${MACHINE}}
74 MACHINE_ARCH:= ${MACHINE_ARCH}
75 .else
76 # we got here via dirdeps
77 MACHINE_ARCH:= ${MACHINE_ARCH.${MACHINE}}
78 .endif
79
80 # now because for universe we want to potentially
81 # build for multiple MACHINE_ARCH per MACHINE
82 # we need more than MACHINE in TARGET_SPEC
83 TARGET_SPEC_VARS= MACHINE MACHINE_ARCH
84 # see dirdeps.mk
85 .if ${TARGET_SPEC:Uno:M*,*} != ""
86 _tspec := ${TARGET_SPEC:S/,/ /g}
87 MACHINE := ${_tspec:[1]}
88 MACHINE_ARCH := ${_tspec:[2]}
89 # etc.
90 # We need to stop that TARGET_SPEC affecting any submakes
91 # and deal with MACHINE=${TARGET_SPEC} in the environment.
92 TARGET_SPEC=
93 # export but do not track
94 .export-env TARGET_SPEC 
95 .export ${TARGET_SPEC_VARS}
96 .for v in ${TARGET_SPEC_VARS:O:u}
97 .if empty($v)
98 .undef $v
99 .endif
100 .endfor
101 .endif
102 # make sure we know what TARGET_SPEC is
103 # as we may need it to find Makefile.depend*
104 TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,}
105
106 # to be consistent with src/Makefile just concatenate with '.'s
107 TARGET_OBJ_SPEC:= ${TARGET_SPEC:S;,;.;g}
108 OBJTOP:= ${OBJROOT}${TARGET_OBJ_SPEC}
109
110 .if defined(MAKEOBJDIR)
111 .if ${MAKEOBJDIR:M*/*} == ""
112 .error Cannot use MAKEOBJDIR=${MAKEOBJDIR}${.newline}Unset MAKEOBJDIR to get default:  MAKEOBJDIR='${_default_makeobjdir}'
113 .endif
114 .endif
115
116 HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
117
118 .if ${OBJTOP} == ${HOST_OBJTOP} || ${REQUESTED_MACHINE:U${MACHINE}} == "host"
119 MACHINE= host
120 .if ${TARGET_MACHINE:Uno} == ${HOST_TARGET}
121 # not what we want
122 TARGET_MACHINE= host
123 .endif
124 .endif
125 .if ${MACHINE} == "host"
126 OBJTOP := ${HOST_OBJTOP}
127 .endif
128
129 .if ${.MAKE.LEVEL} == 0
130 PYTHON ?= /usr/local/bin/python
131 .export PYTHON
132 # this works best if share/mk is ready for it.
133 BUILD_AT_LEVEL0= no
134 # _SKIP_BUILD is not 100% as it requires wrapping all 'all:' targets to avoid
135 # building in MAKELEVEL0.  Just prohibit 'all' entirely in this case to avoid
136 # problems.
137 .if ${MK_DIRDEPS_BUILD} == "yes" && \
138     ${.MAKE.LEVEL} == 0 && ${BUILD_AT_LEVEL0:Uyes:tl} == "no"
139 .MAIN: dirdeps
140 .if make(all)
141 .error DIRDEPS_BUILD: Please run '${MAKE}' instead of '${MAKE} all'.
142 .endif
143 .endif
144
145 # we want to end up with a singe stage tree for all machines
146 .if ${MK_STAGING} == "yes"
147 .if empty(STAGE_ROOT)
148 STAGE_ROOT?= ${OBJROOT}stage
149 .export STAGE_ROOT
150 .endif
151 .endif
152 .endif
153
154 .if ${MK_STAGING} == "yes"
155 .if ${MACHINE} == "host"
156 STAGE_MACHINE= ${HOST_TARGET}
157 .else
158 STAGE_MACHINE:= ${TARGET_OBJ_SPEC}
159 .endif
160 STAGE_OBJTOP:= ${STAGE_ROOT}/${STAGE_MACHINE}
161 STAGE_COMMON_OBJTOP:= ${STAGE_ROOT}/common
162 STAGE_TARGET_OBJTOP:= ${STAGE_ROOT}/${TARGET_OBJ_SPEC}
163 STAGE_HOST_OBJTOP:= ${STAGE_ROOT}/${HOST_TARGET}
164 # These are exported for hooking in out-of-tree builds.  They will always
165 # be overridden in sub-makes above when building in-tree.
166 .export STAGE_OBJTOP STAGE_TARGET_OBJTOP STAGE_HOST_OBJTOP
167
168 # Use tools/install.sh which can avoid the need for xinstall for simple cases.
169 INSTALL?=       sh ${SRCTOP}/tools/install.sh
170 # This is for stage-install to pickup from the environment.
171 REAL_INSTALL:=  ${INSTALL}
172 .export REAL_INSTALL
173 STAGE_INSTALL=  sh ${.PARSEDIR:tA}/stage-install.sh OBJDIR=${.OBJDIR:tA}
174
175 STAGE_LIBDIR= ${STAGE_OBJTOP}${_LIBDIR:U${LIBDIR:U/lib}}
176 STAGE_INCLUDEDIR= ${STAGE_OBJTOP}${INCLUDEDIR:U/usr/include}
177 # this is not the same as INCLUDEDIR
178 STAGE_INCSDIR= ${STAGE_OBJTOP}${INCSDIR:U/include}
179 # the target is usually an absolute path
180 STAGE_SYMLINKS_DIR= ${STAGE_OBJTOP}
181
182 LDFLAGS_LAST+= -Wl,-rpath-link,${STAGE_LIBDIR}
183 .if ${MK_SYSROOT} == "yes"
184 SYSROOT?= ${STAGE_OBJTOP}
185 .else
186 LDFLAGS_LAST+= -L${STAGE_LIBDIR}
187 .endif
188
189 .endif                          # MK_STAGING
190
191 # this is sufficient for most of the tree.
192 .MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX}
193
194 # but if we have a machine qualified file it should be used in preference
195 .MAKE.DEPENDFILE_PREFERENCE = \
196         ${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
197         ${.MAKE.DEPENDFILE_PREFIX}
198
199 .undef .MAKE.DEPENDFILE
200
201 .include "sys.dependfile.mk"
202
203 .if ${.MAKE.LEVEL} > 0 && ${MACHINE} == "host" && ${.MAKE.DEPENDFILE:E} != "host"
204 # we can use this but should not update it.
205 UPDATE_DEPENDFILE= NO
206 .endif
207
208 # define the list of places that contain files we are responsible for
209 .MAKE.META.BAILIWICK = ${SB} ${OBJROOT} ${STAGE_ROOT}
210
211 CSU_DIR.${MACHINE_ARCH} ?= csu/${MACHINE_ARCH}
212 CSU_DIR := ${CSU_DIR.${MACHINE_ARCH}}
213
214 .if !empty(TIME_STAMP)
215 TRACER= ${TIME_STAMP} ${:U}
216 .endif
217 .if !defined(_RECURSING_PROGS) && !defined(_RECURSING_CRUNCH) && \
218     !make(print-dir)
219 WITH_META_STATS= t
220 .endif
221
222 # toolchains can be a pain - especially bootstrappping them
223 .if ${MACHINE} == "host"
224 MK_SHARED_TOOLCHAIN= no
225 .endif
226 TOOLCHAIN_VARS= AS AR CC CLANG_TBLGEN CXX CPP LD NM OBJDUMP OBJCOPY RANLIB \
227                 STRINGS SIZE LLVM_TBLGEN
228 _toolchain_bin_CLANG_TBLGEN=    /usr/bin/clang-tblgen
229 _toolchain_bin_LLVM_TBLGEN=     /usr/bin/llvm-tblgen
230 _toolchain_bin_CXX=             /usr/bin/c++
231 .ifdef WITH_TOOLSDIR
232 TOOLSDIR?= ${HOST_OBJTOP}/tools
233 .elif defined(STAGE_HOST_OBJTOP)
234 TOOLSDIR?= ${STAGE_HOST_OBJTOP}
235 .endif
236 # Only define if it exists in case user didn't run bootstrap-tools.  Otherwise
237 # the tool will be built during the build.  Building it assumes it is
238 # TARGET==MACHINE.
239 .if exists(${HOST_OBJTOP}/tools${.CURDIR})
240 BTOOLSPATH= ${HOST_OBJTOP}/tools${.CURDIR}
241 .endif
242
243 # Don't use the bootstrap tools logic on itself.
244 .if ${.TARGETS:Mbootstrap-tools} == "" && \
245     !make(showconfig) && \
246     !defined(BOOTSTRAPPING_TOOLS) && !empty(TOOLSDIR) && ${.MAKE.LEVEL} == 0
247 .for dir in /sbin /bin /usr/sbin /usr/bin
248 PATH:= ${TOOLSDIR}${dir}:${PATH}
249 .endfor
250 .export PATH
251 # Prefer the TOOLSDIR version of the toolchain if present vs the host version.
252 .for var in ${TOOLCHAIN_VARS}
253 _toolchain_bin.${var}=  ${TOOLSDIR}${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
254 .if exists(${_toolchain_bin.${var}})
255 HOST_${var}?=   ${_toolchain_bin.${var}}
256 .export         HOST_${var}
257 .endif
258 .endfor
259 .endif
260
261 .for var in ${TOOLCHAIN_VARS}
262 HOST_${var}?=   ${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
263 .endfor
264
265 .if ${MACHINE} == "host"
266 .for var in ${TOOLCHAIN_VARS}
267 ${var}=         ${HOST_${var}}
268 .endfor
269 .endif
270
271 .if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}
272 # cross-building
273 .if !defined(FREEBSD_REVISION)
274 FREEBSD_REVISION!= sed -n '/^REVISION=/{s,.*=,,;s,",,g;p; }' ${SRCTOP}/sys/conf/newvers.sh
275 .export FREEBSD_REVISION
276 .endif
277 CROSS_TARGET_FLAGS= -target ${MACHINE_ARCH}-unknown-freebsd${FREEBSD_REVISION}
278 CFLAGS+= ${CROSS_TARGET_FLAGS}
279 ACFLAGS+= ${CROSS_TARGET_FLAGS}
280 LDFLAGS+= -Wl,-m -Wl,elf_${MACHINE_ARCH}_fbsd
281 .endif
282
283 META_MODE+=     missing-meta=yes
284 .if empty(META_MODE:Mnofilemon)
285 META_MODE+=     missing-filemon=yes
286 .endif