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