]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - Makefile.inc1
Instead of modeling the kernel-tools build after the bootstrap tools, build
[FreeBSD/FreeBSD.git] / Makefile.inc1
1 #
2 # $FreeBSD$
3 #
4 # Make command line options:
5 #       -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6 #       -DNO_CLEAN do not clean at all
7 #       -DDB_FROM_SRC use the user/group databases in src/etc instead of
8 #           the system database when installing.
9 #       -DNO_SHARE do not go into share subdir
10 #       -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
11 #       -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
12 #       -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
13 #       -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
14 #       -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
15 #       -DNO_PORTSUPDATE do not update ports in ${MAKE} update
16 #       -DNO_ROOT install without using root privilege
17 #       -DNO_DOCUPDATE do not update doc in ${MAKE} update
18 #       -DNO_CTF do not run the DTrace CTF conversion tools on built objects
19 #       LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
20 #       LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
21 #       LOCAL_MTREE="list of mtree files" to process to allow local directories
22 #           to be created before files are installed
23 #       LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
24 #           list
25 #       METALOG="path to metadata log" to write permission and ownership
26 #           when NO_ROOT is set.  (default: ${DESTDIR}/METALOG)
27 #       TARGET="machine" to crossbuild world for a different machine type
28 #       TARGET_ARCH= may be required when a TARGET supports multiple endians
29 #       BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
30 #       WORLD_FLAGS= additional flags to pass to make(1) during buildworld
31 #       KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
32
33 #
34 # The intended user-driven targets are:
35 # buildworld  - rebuild *everything*, including glue to help do upgrades
36 # installworld- install everything built by "buildworld"
37 # doxygen     - build API documentation of the kernel
38 # update      - convenient way to update your source tree (eg: svn/svnup)
39 #
40 # Standard targets (not defined here) are documented in the makefiles in
41 # /usr/share/mk.  These include:
42 #               obj depend all install clean cleandepend cleanobj
43
44 .if !defined(TARGET) || !defined(TARGET_ARCH)
45 .error "Both TARGET and TARGET_ARCH must be defined."
46 .endif
47
48 .include <bsd.own.mk>
49 .include <bsd.arch.inc.mk>
50 .include <bsd.compiler.mk>
51
52 # We must do share/info early so that installation of info `dir'
53 # entries works correctly.  Do it first since it is less likely to
54 # grow dependencies on include and lib than vice versa.
55 #
56 # We must do lib/ and libexec/ before bin/, because if installworld
57 # installs a new /bin/sh, the 'make' command will *immediately*
58 # use that new version.  And the new (dynamically-linked) /bin/sh
59 # will expect to find appropriate libraries in /lib and /libexec.
60 #
61 SRCDIR?=        ${.CURDIR}
62 .if defined(SUBDIR_OVERRIDE)
63 SUBDIR= ${SUBDIR_OVERRIDE}
64 .else
65 SUBDIR= share/info lib libexec
66 SUBDIR+=bin
67 .if ${MK_GAMES} != "no"
68 SUBDIR+=games
69 .endif
70 .if ${MK_CDDL} != "no"
71 SUBDIR+=cddl
72 .endif
73 SUBDIR+=gnu include
74 .if ${MK_KERBEROS} != "no"
75 SUBDIR+=kerberos5
76 .endif
77 .if ${MK_RESCUE} != "no"
78 SUBDIR+=rescue
79 .endif
80 SUBDIR+=sbin
81 .if ${MK_CRYPT} != "no"
82 SUBDIR+=secure
83 .endif
84 .if !defined(NO_SHARE)
85 SUBDIR+=share
86 .endif
87 SUBDIR+=sys usr.bin usr.sbin
88 .if ${MK_TESTS} != "no"
89 SUBDIR+=        tests
90 .endif
91 .if ${MK_OFED} != "no"
92 SUBDIR+=contrib/ofed
93 .endif
94 #
95 # We must do etc/ last for install/distribute to work.
96 #
97 SUBDIR+=etc
98
99 # These are last, since it is nice to at least get the base system
100 # rebuilt before you do them.
101 .for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS}
102 .if exists(${.CURDIR}/${_DIR}/Makefile)
103 SUBDIR+= ${_DIR}
104 .endif
105 .endfor
106 .endif
107
108 .if defined(NOCLEAN)
109 NO_CLEAN=       ${NOCLEAN}
110 .endif
111 .if defined(NO_CLEANDIR)
112 CLEANDIR=       clean cleandepend
113 .else
114 CLEANDIR=       cleandir
115 .endif
116
117 LOCAL_TOOL_DIRS?=
118
119 BUILDENV_SHELL?=/bin/sh
120
121 SVN?=           /usr/local/bin/svn
122 SVNFLAGS?=      -r HEAD
123
124 MAKEOBJDIRPREFIX?=      /usr/obj
125 .if !defined(OSRELDATE)
126 .if exists(/usr/include/osreldate.h)
127 OSRELDATE!=     awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
128                 /usr/include/osreldate.h
129 .else
130 OSRELDATE=      0
131 .endif
132 .endif
133
134 .if !defined(VERSION)
135 REVISION!=      make -C ${SRCDIR}/release -V REVISION
136 BRANCH!=        make -C ${SRCDIR}/release -V BRANCH
137 SRCRELDATE!=    awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
138                 ${SRCDIR}/sys/sys/param.h
139 VERSION=        FreeBSD ${REVISION}-${BRANCH} ${TARGET_ARCH} ${SRCRELDATE}
140 .endif
141
142 KNOWN_ARCHES?=  amd64 arm armeb/arm armv6/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
143 .if ${TARGET} == ${TARGET_ARCH}
144 _t=             ${TARGET}
145 .else
146 _t=             ${TARGET_ARCH}/${TARGET}
147 .endif
148 .for _t in ${_t}
149 .if empty(KNOWN_ARCHES:M${_t})
150 .error Unknown target ${TARGET_ARCH}:${TARGET}.
151 .endif
152 .endfor
153
154 .if ${TARGET} == ${MACHINE}
155 TARGET_CPUTYPE?=${CPUTYPE}
156 .else
157 TARGET_CPUTYPE?=
158 .endif
159
160 .if !empty(TARGET_CPUTYPE)
161 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
162 .else
163 _TARGET_CPUTYPE=dummy
164 .endif
165 _CPUTYPE!=      MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
166                 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
167 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
168 .error CPUTYPE global should be set with ?=.
169 .endif
170 .if make(buildworld)
171 BUILD_ARCH!=    uname -p
172 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
173 .error To cross-build, set TARGET_ARCH.
174 .endif
175 .endif
176 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
177 OBJTREE=        ${MAKEOBJDIRPREFIX}
178 .else
179 OBJTREE=        ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
180 .endif
181 WORLDTMP=       ${OBJTREE}${.CURDIR}/tmp
182 # /usr/games added for fortune which depend on strfile
183 BPATH=          ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin
184 XPATH=          ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
185 STRICTTMPPATH=  ${BPATH}:${XPATH}
186 TMPPATH=        ${STRICTTMPPATH}:${PATH}
187
188 #
189 # Avoid running mktemp(1) unless actually needed.
190 # It may not be functional, e.g., due to new ABI
191 # when in the middle of installing over this system.
192 #
193 .if make(distributeworld) || make(installworld)
194 INSTALLTMP!=    /usr/bin/mktemp -d -u -t install
195 .endif
196
197 #
198 # Building a world goes through the following stages
199 #
200 # 1. legacy stage [BMAKE]
201 #       This stage is responsible for creating compatibility
202 #       shims that are needed by the bootstrap-tools,
203 #       build-tools and cross-tools stages.
204 # 1. bootstrap-tools stage [BMAKE]
205 #       This stage is responsible for creating programs that
206 #       are needed for backward compatibility reasons. They
207 #       are not built as cross-tools.
208 # 2. build-tools stage [TMAKE]
209 #       This stage is responsible for creating the object
210 #       tree and building any tools that are needed during
211 #       the build process.
212 # 3. cross-tools stage [XMAKE]
213 #       This stage is responsible for creating any tools that
214 #       are needed for cross-builds. A cross-compiler is one
215 #       of them.
216 # 4. world stage [WMAKE]
217 #       This stage actually builds the world.
218 # 5. install stage (optional) [IMAKE]
219 #       This stage installs a previously built world.
220 #
221
222 BOOTSTRAPPING?= 0
223
224 # Common environment for world related stages
225 CROSSENV=       MAKEOBJDIRPREFIX=${OBJTREE} \
226                 MACHINE_ARCH=${TARGET_ARCH} \
227                 MACHINE=${TARGET} \
228                 CPUTYPE=${TARGET_CPUTYPE}
229 .if ${MK_GROFF} != "no"
230 CROSSENV+=      GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
231                 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
232                 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
233 .endif
234
235 # bootstrap-tools stage
236 BMAKEENV=       INSTALL="sh ${.CURDIR}/tools/install.sh" \
237                 PATH=${BPATH}:${PATH} \
238                 WORLDTMP=${WORLDTMP} \
239                 VERSION="${VERSION}" \
240                 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
241                 COMPILER_TYPE=${COMPILER_TYPE}
242 BMAKE=          MAKEOBJDIRPREFIX=${WORLDTMP} \
243                 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
244                 DESTDIR= \
245                 BOOTSTRAPPING=${OSRELDATE} \
246                 SSP_CFLAGS= \
247                 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
248                 -DNO_PIC -DNO_PROFILE -DNO_SHARED \
249                 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
250
251 # build-tools stage
252 TMAKE=          MAKEOBJDIRPREFIX=${OBJTREE} \
253                 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
254                 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
255                 DESTDIR= \
256                 BOOTSTRAPPING=${OSRELDATE} \
257                 SSP_CFLAGS= \
258                 -DNO_LINT \
259                 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
260
261 # cross-tools stage
262 XMAKE=          TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
263                 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
264                 -DWITHOUT_GDB
265
266 # world stage
267 WMAKEENV=       ${CROSSENV} \
268                 _SHLIBDIRPREFIX=${WORLDTMP} \
269                 _LDSCRIPTROOT= \
270                 VERSION="${VERSION}" \
271                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
272                 PATH=${TMPPATH}
273
274 # make hierarchy
275 HMAKE=          PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
276 .if defined(NO_ROOT)
277 HMAKE+=         PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
278 .endif
279
280 .if ${MK_CDDL} == "no"
281 WMAKEENV+=      NO_CTF=1
282 .endif
283
284 .if defined(CROSS_TOOLCHAIN_PREFIX)
285 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
286 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
287 .endif
288 XCOMPILERS=     CC CXX CPP
289 .for COMPILER in ${XCOMPILERS}
290 .if defined(CROSS_COMPILER_PREFIX)
291 X${COMPILER}?=  ${CROSS_COMPILER_PREFIX}${${COMPILER}}
292 .else
293 X${COMPILER}?=  ${${COMPILER}}
294 .endif
295 .endfor
296 XBINUTILS=      AS AR LD NM OBJDUMP RANLIB STRINGS
297 .for BINUTIL in ${XBINUTILS}
298 .if defined(CROSS_BINUTILS_PREFIX)
299 X${BINUTIL}?=   ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
300 .else
301 X${BINUTIL}?=   ${${BINUTIL}}
302 .endif
303 .endfor
304 WMAKEENV+=      CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
305                 CPP="${XCPP} ${XFLAGS}" \
306                 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
307                 OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS}
308
309 .if ${XCC:T:Mgcc} == "gcc"
310 WMAKE_COMPILER_TYPE=    gcc
311 .elif ${XCC:T:Mclang} == "clang"
312 WMAKE_COMPILER_TYPE=    clang
313 .elif ${MK_CLANG_IS_CC} == "no"
314 WMAKE_COMPILER_TYPE=    gcc
315 .else
316 WMAKE_COMPILER_TYPE=    clang
317 .endif
318 IMAKE_COMPILER_TYPE=    COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
319
320 .if ${XCC:M/*}
321 XFLAGS=         --sysroot=${WORLDTMP}
322 .if defined(CROSS_BINUTILS_PREFIX)
323 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
324 # directory, but the compiler will look in the right place for it's
325 # tools so we don't need to tell it where to look.
326 .if exists(${CROSS_BINUTILS_PREFIX})
327 XFLAGS+=        -B${CROSS_BINUTILS_PREFIX}
328 .endif
329 .else
330 XFLAGS+=        -B${WORLDTMP}/usr/bin
331 .endif
332 .if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang"
333 .if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \
334 ${MK_ARM_EABI} != "no"
335 TARGET_ABI=     gnueabi
336 .else
337 TARGET_ABI=     unknown
338 .endif
339 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
340 XFLAGS+=        -target ${TARGET_TRIPLE}
341 .endif
342 .endif
343
344 WMAKEENV+=      COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
345 WMAKE=          ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
346
347 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
348 # 32 bit world
349 LIB32TMP=       ${OBJTREE}${.CURDIR}/lib32
350
351 .if ${TARGET_ARCH} == "amd64"
352 .if empty(TARGET_CPUTYPE)
353 LIB32CPUFLAGS=  -march=i686 -mmmx -msse -msse2
354 .else
355 LIB32CPUFLAGS=  -march=${TARGET_CPUTYPE}
356 .endif
357 LIB32WMAKEENV=  MACHINE=i386 MACHINE_ARCH=i386 \
358                 MACHINE_CPU="i686 mmx sse sse2"
359 LIB32WMAKEFLAGS=        \
360                 AS="${AS} --32" \
361                 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
362
363 .elif ${TARGET_ARCH} == "powerpc64"
364 .if empty(TARGET_CPUTYPE)
365 LIB32CPUFLAGS=  -mcpu=powerpc
366 .else
367 LIB32CPUFLAGS=  -mcpu=${TARGET_CPUTYPE}
368 .endif
369 LIB32WMAKEENV=  MACHINE=powerpc MACHINE_ARCH=powerpc
370 LIB32WMAKEFLAGS=        \
371                 LD="${LD} -m elf32ppc_fbsd"
372 .endif
373
374
375 LIB32FLAGS=     -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
376                 -isystem ${LIB32TMP}/usr/include/ \
377                 -L${LIB32TMP}/usr/lib32 \
378                 -B${LIB32TMP}/usr/lib32
379 .if ${XCC:M/*}
380 LIB32FLAGS+=            --sysroot=${WORLDTMP}
381 .endif
382
383 # Yes, the flags are redundant.
384 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
385                 _SHLIBDIRPREFIX=${LIB32TMP} \
386                 _LDSCRIPTROOT=${LIB32TMP} \
387                 VERSION="${VERSION}" \
388                 INSTALL="sh ${.CURDIR}/tools/install.sh" \
389                 PATH=${TMPPATH} \
390                 LIBDIR=/usr/lib32 \
391                 SHLIBDIR=/usr/lib32 \
392                 LIBPRIVATEDIR=/usr/lib32/private \
393                 COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
394 LIB32WMAKEFLAGS+=       \
395                 CC="${XCC} ${LIB32FLAGS}" \
396                 CXX="${XCXX} ${LIB32FLAGS}" \
397                 DESTDIR=${LIB32TMP} \
398                 -DCOMPAT_32BIT \
399                 -DLIBRARIES_ONLY \
400                 -DNO_CPU_CFLAGS \
401                 -DNO_CTF \
402                 -DNO_LINT
403
404 LIB32WMAKE=     ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
405                 -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
406 LIB32IMAKE=     ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
407                 ${IMAKE_INSTALL}
408 .endif
409
410 IMAKEENV=       ${CROSSENV:N_LDSCRIPTROOT=*}
411 IMAKE=          ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
412                 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE}
413 .if empty(.MAKEFLAGS:M-n)
414 IMAKEENV+=      PATH=${STRICTTMPPATH}:${INSTALLTMP} \
415                 LD_LIBRARY_PATH=${INSTALLTMP} \
416                 PATH_LOCALE=${INSTALLTMP}/locale
417 IMAKE+=         __MAKE_SHELL=${INSTALLTMP}/sh
418 .else
419 IMAKEENV+=      PATH=${TMPPATH}:${INSTALLTMP}
420 .endif
421 .if defined(DB_FROM_SRC)
422 INSTALLFLAGS+=  -N ${.CURDIR}/etc
423 MTREEFLAGS+=    -N ${.CURDIR}/etc
424 .endif
425 _INSTALL_DDIR=  ${DESTDIR}/${DISTDIR}
426 INSTALL_DDIR=   ${_INSTALL_DDIR:S://:/:g:C:/$::}
427 .if defined(NO_ROOT)
428 METALOG?=       ${DESTDIR}/${DISTDIR}/METALOG
429 IMAKE+=         -DNO_ROOT METALOG=${METALOG}
430 INSTALLFLAGS+=  -U -M ${METALOG} -D ${INSTALL_DDIR}
431 MTREEFLAGS+=    -W
432 .endif
433 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
434 IMAKE_INSTALL=  INSTALL="install ${INSTALLFLAGS}"
435 IMAKE_MTREE=    MTREE_CMD="nmtree ${MTREEFLAGS}"
436 .endif
437
438 # kernel stage
439 KMAKEENV=       ${WMAKEENV}
440 KMAKE=          ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
441
442 #
443 # buildworld
444 #
445 # Attempt to rebuild the entire system, with reasonable chance of
446 # success, regardless of how old your existing system is.
447 #
448 _worldtmp:
449 .if ${.CURDIR:C/[^,]//g} != ""
450 #       The m4 build of sendmail files doesn't like it if ',' is used
451 #       anywhere in the path of it's files.
452         @echo
453         @echo "*** Error: path to source tree contains a comma ','"
454         @echo
455         false
456 .endif
457         @echo
458         @echo "--------------------------------------------------------------"
459         @echo ">>> Rebuilding the temporary build tree"
460         @echo "--------------------------------------------------------------"
461 .if !defined(NO_CLEAN)
462         rm -rf ${WORLDTMP}
463 .if defined(LIB32TMP)
464         rm -rf ${LIB32TMP}
465 .endif
466 .else
467         rm -rf ${WORLDTMP}/legacy/usr/include
468 #       XXX - These three can depend on any header file.
469         rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
470         rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
471         rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
472 .endif
473 .for _dir in \
474     lib usr legacy/bin legacy/usr
475         mkdir -p ${WORLDTMP}/${_dir}
476 .endfor
477         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
478             -p ${WORLDTMP}/legacy/usr >/dev/null
479 .if ${MK_GROFF} != "no"
480         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
481             -p ${WORLDTMP}/legacy/usr >/dev/null
482 .endif
483         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
484             -p ${WORLDTMP}/usr >/dev/null
485         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
486             -p ${WORLDTMP}/usr/include >/dev/null
487         ln -sf ${.CURDIR}/sys ${WORLDTMP}
488 .if ${MK_DEBUG_FILES} != "no"
489         # We could instead disable debug files for these build stages
490         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
491             -p ${WORLDTMP}/legacy/usr/lib >/dev/null
492         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
493             -p ${WORLDTMP}/usr/lib >/dev/null
494 .endif
495 .if ${MK_TESTS} != "no"
496         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
497             -p ${WORLDTMP}${TESTSBASE} >/dev/null
498 .endif
499 .for _mtree in ${LOCAL_MTREE}
500         mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
501 .endfor
502 _legacy:
503         @echo
504         @echo "--------------------------------------------------------------"
505         @echo ">>> stage 1.1: legacy release compatibility shims"
506         @echo "--------------------------------------------------------------"
507         ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
508 _bootstrap-tools:
509         @echo
510         @echo "--------------------------------------------------------------"
511         @echo ">>> stage 1.2: bootstrap tools"
512         @echo "--------------------------------------------------------------"
513         ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
514 _cleanobj:
515 .if !defined(NO_CLEAN)
516         @echo
517         @echo "--------------------------------------------------------------"
518         @echo ">>> stage 2.1: cleaning up the object tree"
519         @echo "--------------------------------------------------------------"
520         ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
521 .if defined(LIB32TMP)
522         ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
523 .endif
524 .endif
525 _obj:
526         @echo
527         @echo "--------------------------------------------------------------"
528         @echo ">>> stage 2.2: rebuilding the object tree"
529         @echo "--------------------------------------------------------------"
530         ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
531 _build-tools:
532         @echo
533         @echo "--------------------------------------------------------------"
534         @echo ">>> stage 2.3: build tools"
535         @echo "--------------------------------------------------------------"
536         ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
537 _cross-tools:
538         @echo
539         @echo "--------------------------------------------------------------"
540         @echo ">>> stage 3: cross tools"
541         @echo "--------------------------------------------------------------"
542         ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
543 _includes:
544         @echo
545         @echo "--------------------------------------------------------------"
546         @echo ">>> stage 4.1: building includes"
547         @echo "--------------------------------------------------------------"
548         ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
549 _libraries:
550         @echo
551         @echo "--------------------------------------------------------------"
552         @echo ">>> stage 4.2: building libraries"
553         @echo "--------------------------------------------------------------"
554         ${_+_}cd ${.CURDIR}; \
555             ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
556             -DWITHOUT_MAN -DNO_PROFILE libraries
557 _depend:
558         @echo
559         @echo "--------------------------------------------------------------"
560         @echo ">>> stage 4.3: make dependencies"
561         @echo "--------------------------------------------------------------"
562         ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
563 everything:
564         @echo
565         @echo "--------------------------------------------------------------"
566         @echo ">>> stage 4.4: building everything"
567         @echo "--------------------------------------------------------------"
568         ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
569 .if defined(LIB32TMP)
570 build32:
571         @echo
572         @echo "--------------------------------------------------------------"
573         @echo ">>> stage 5.1: building 32 bit shim libraries"
574         @echo "--------------------------------------------------------------"
575         mkdir -p ${LIB32TMP}/usr/include
576         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
577             -p ${LIB32TMP}/usr >/dev/null
578         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
579             -p ${LIB32TMP}/usr/include >/dev/null
580 .if ${MK_DEBUG_FILES} != "no"
581         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
582             -p ${LIB32TMP}/usr/lib >/dev/null
583 .endif
584         mkdir -p ${WORLDTMP}
585         ln -sf ${.CURDIR}/sys ${WORLDTMP}
586 .for _t in obj includes
587         cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
588         cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
589 .if ${MK_CDDL} != "no"
590         cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
591 .endif
592         cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
593 .if ${MK_CRYPT} != "no"
594         cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
595 .endif
596 .if ${MK_KERBEROS} != "no"
597         cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
598 .endif
599 .endfor
600 .for _dir in usr.bin/lex/lib
601         cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
602 .endfor
603 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
604         cd ${.CURDIR}/${_dir}; \
605             WORLDTMP=${WORLDTMP} \
606             MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
607             MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
608             DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
609             -DEARLY_BUILD build-tools
610 .endfor
611         cd ${.CURDIR}; \
612             ${LIB32WMAKE} -f Makefile.inc1 libraries
613 .for _t in obj depend all
614         cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
615             DIRPRFX=libexec/rtld-elf/ ${_t}
616         cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
617             DIRPRFX=usr.bin/ldd ${_t}
618 .endfor
619
620 distribute32 install32:
621         cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
622 .if ${MK_CDDL} != "no"
623         cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
624 .endif
625         cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
626 .if ${MK_CRYPT} != "no"
627         cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
628 .endif
629 .if ${MK_KERBEROS} != "no"
630         cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
631 .endif
632         cd ${.CURDIR}/libexec/rtld-elf; \
633             PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
634         cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
635 .endif
636
637 WMAKE_TGTS=
638 .if !defined(SUBDIR_OVERRIDE)
639 WMAKE_TGTS+=    _worldtmp _legacy _bootstrap-tools
640 .endif
641 WMAKE_TGTS+=    _cleanobj _obj _build-tools
642 .if !defined(SUBDIR_OVERRIDE)
643 WMAKE_TGTS+=    _cross-tools
644 .endif
645 WMAKE_TGTS+=    _includes _libraries _depend everything
646 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
647 WMAKE_TGTS+=    build32
648 .endif
649
650 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
651 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
652
653 buildworld_prologue:
654         @echo "--------------------------------------------------------------"
655         @echo ">>> World build started on `LC_ALL=C date`"
656         @echo "--------------------------------------------------------------"
657
658 buildworld_epilogue:
659         @echo
660         @echo "--------------------------------------------------------------"
661         @echo ">>> World build completed on `LC_ALL=C date`"
662         @echo "--------------------------------------------------------------"
663
664 #
665 # We need to have this as a target because the indirection between Makefile
666 # and Makefile.inc1 causes the correct PATH to be used, rather than a
667 # modification of the current environment's PATH.  In addition, we need
668 # to quote multiword values.
669 #
670 buildenvvars:
671         @echo ${WMAKEENV:Q}
672
673 buildenv:
674         @echo Entering world for ${TARGET_ARCH}:${TARGET}
675         @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
676
677 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
678 toolchain: ${TOOLCHAIN_TGTS}
679 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
680
681 #
682 # installcheck
683 #
684 # Checks to be sure system is ready for installworld/installkernel.
685 #
686 installcheck: _installcheck_world _installcheck_kernel
687 _installcheck_world:
688 _installcheck_kernel:
689
690 #
691 # Require DESTDIR to be set if installing for a different architecture or
692 # using the user/group database in the source tree.
693 #
694 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
695     defined(DB_FROM_SRC)
696 .if !make(distributeworld)
697 _installcheck_world: __installcheck_DESTDIR
698 _installcheck_kernel: __installcheck_DESTDIR
699 __installcheck_DESTDIR:
700 .if !defined(DESTDIR) || empty(DESTDIR)
701         @echo "ERROR: Please set DESTDIR!"; \
702         false
703 .endif
704 .endif
705 .endif
706
707 .if !defined(DB_FROM_SRC)
708 #
709 # Check for missing UIDs/GIDs.
710 #
711 CHECK_UIDS=     auditdistd
712 CHECK_GIDS=     audit
713 .if ${MK_SENDMAIL} != "no"
714 CHECK_UIDS+=    smmsp
715 CHECK_GIDS+=    smmsp
716 .endif
717 .if ${MK_PF} != "no"
718 CHECK_UIDS+=    proxy
719 CHECK_GIDS+=    proxy authpf
720 .endif
721 .if ${MK_UNBOUND} != "no"
722 CHECK_UIDS+=    unbound
723 CHECK_GIDS+=    unbound
724 .endif
725 _installcheck_world: __installcheck_UGID
726 __installcheck_UGID:
727 .for uid in ${CHECK_UIDS}
728         @if ! `id -u ${uid} >/dev/null 2>&1`; then \
729                 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
730                 false; \
731         fi
732 .endfor
733 .for gid in ${CHECK_GIDS}
734         @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
735                 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
736                 false; \
737         fi
738 .endfor
739 .endif
740
741 #
742 # Required install tools to be saved in a scratch dir for safety.
743 #
744 .if ${MK_INFO} != "no"
745 _install-info=  install-info
746 .endif
747 .if ${MK_ZONEINFO} != "no"
748 _zoneinfo=      zic tzsetup
749 .endif
750
751 .if exists(/usr/sbin/nmtree)
752 _nmtree_itools= nmtree
753 .endif
754
755 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
756         date echo egrep find grep id install ${_install-info} \
757         ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
758         rm sed sh sysctl test true uname wc ${_zoneinfo}
759
760 #
761 # distributeworld
762 #
763 # Distributes everything compiled by a `buildworld'.
764 #
765 # installworld
766 #
767 # Installs everything compiled by a 'buildworld'.
768 #
769
770 # Non-base distributions produced by the base system
771 EXTRA_DISTRIBUTIONS=    doc
772 .if ${MK_GAMES} != "no"
773 EXTRA_DISTRIBUTIONS+=   games
774 .endif
775 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
776 EXTRA_DISTRIBUTIONS+=   lib32
777 .endif
778
779 MTREE_MAGIC?=   mtree 2.0
780
781 distributeworld installworld: _installcheck_world
782         mkdir -p ${INSTALLTMP}
783         progs=$$(for prog in ${ITOOLS}; do \
784                 if progpath=`which $$prog`; then \
785                         echo $$progpath; \
786                 else \
787                         echo "Required tool $$prog not found in PATH." >&2; \
788                         exit 1; \
789                 fi; \
790             done); \
791         libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
792             while read line; do \
793                 set -- $$line; \
794                 if [ "$$2 $$3" != "not found" ]; then \
795                         echo $$2; \
796                 else \
797                         echo "Required library $$1 not found." >&2; \
798                         exit 1; \
799                 fi; \
800             done); \
801         cp $$libs $$progs ${INSTALLTMP}
802         cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
803 .if defined(NO_ROOT)
804         echo "#${MTREE_MAGIC}" > ${METALOG}
805 .endif
806 .if make(distributeworld)
807 .for dist in ${EXTRA_DISTRIBUTIONS}
808         -mkdir ${DESTDIR}/${DISTDIR}/${dist}
809         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
810             -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
811         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
812             -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
813         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
814             -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
815 .if ${MK_DEBUG_FILES} != "no"
816         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
817             -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
818 .endif
819 .if defined(NO_ROOT)
820         ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
821             sed -e 's#^\./#./${dist}/#' >> ${METALOG}
822         ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
823             sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
824         ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
825             sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
826 .endif
827 .endfor
828         -mkdir ${DESTDIR}/${DISTDIR}/base
829         cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
830             METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
831             DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
832             LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
833 .endif
834         ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
835             ${IMAKEENV} rm -rf ${INSTALLTMP}
836 .if make(distributeworld)
837 .for dist in ${EXTRA_DISTRIBUTIONS}
838         find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
839 .endfor
840 .if defined(NO_ROOT)
841 .for dist in base ${EXTRA_DISTRIBUTIONS}
842         @# For each file that exists in this dist, print the corresponding
843         @# line from the METALOG.  This relies on the fact that
844         @# a line containing only the filename will sort immediatly before
845         @# the relevant mtree line.
846         cd ${DESTDIR}/${DISTDIR}; \
847         find ./${dist} | sort -u ${METALOG} - | \
848         awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
849         ${DESTDIR}/${DISTDIR}/${dist}.meta
850 .endfor
851 .if ${MK_DEBUG_FILES} != "no"
852 . for dist in base ${EXTRA_DISTRIBUTIONS}
853         @# For each file that exists in this dist, print the corresponding
854         @# line from the METALOG.  This relies on the fact that
855         @# a line containing only the filename will sort immediatly before
856         @# the relevant mtree line.
857         cd ${DESTDIR}/${DISTDIR}; \
858         find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
859         awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
860         ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
861 . endfor
862 .endif
863 .endif
864 .endif
865
866 packageworld:
867 .for dist in base ${EXTRA_DISTRIBUTIONS}
868 .if defined(NO_ROOT)
869         ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
870             tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
871             --exclude usr/lib/debug \
872             @${DESTDIR}/${DISTDIR}/${dist}.meta
873 .else
874         ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
875             tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
876             --exclude usr/lib/debug .
877 .endif
878 .endfor
879
880 .if ${MK_DEBUG_FILES} != "no"
881 . for dist in base ${EXTRA_DISTRIBUTIONS}
882 .  if defined(NO_ROOT)
883         ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
884             tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
885             @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
886 .  else
887         ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
888             tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
889             usr/lib/debug
890 .  endif
891 . endfor
892 .endif
893
894 #
895 # reinstall
896 #
897 # If you have a build server, you can NFS mount the source and obj directories
898 # and do a 'make reinstall' on the *client* to install new binaries from the
899 # most recent server build.
900 #
901 reinstall:
902         @echo "--------------------------------------------------------------"
903         @echo ">>> Making hierarchy"
904         @echo "--------------------------------------------------------------"
905         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
906             LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
907         @echo
908         @echo "--------------------------------------------------------------"
909         @echo ">>> Installing everything"
910         @echo "--------------------------------------------------------------"
911         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
912 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
913         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
914 .endif
915
916 redistribute:
917         @echo "--------------------------------------------------------------"
918         @echo ">>> Distributing everything"
919         @echo "--------------------------------------------------------------"
920         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
921 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
922         ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
923             DISTRIBUTION=lib32
924 .endif
925
926 distrib-dirs distribution:
927         cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
928             ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
929
930 #
931 # buildkernel and installkernel
932 #
933 # Which kernels to build and/or install is specified by setting
934 # KERNCONF. If not defined a GENERIC kernel is built/installed.
935 # Only the existing (depending TARGET) config files are used
936 # for building kernels and only the first of these is designated
937 # as the one being installed.
938 #
939 # Note that we have to use TARGET instead of TARGET_ARCH when
940 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
941 # be set to cross-build, we have to make sure TARGET is set
942 # properly.
943
944 .if defined(KERNFAST)
945 NO_KERNELCLEAN= t
946 NO_KERNELCONFIG=        t
947 NO_KERNELDEPEND=        t
948 NO_KERNELOBJ=           t
949 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
950 .if !defined(KERNCONF) && ${KERNFAST} != "1"
951 KERNCONF=${KERNFAST}
952 .endif
953 .endif
954 .if ${TARGET_ARCH} == "powerpc64"
955 KERNCONF?=      GENERIC64
956 .else
957 KERNCONF?=      GENERIC
958 .endif
959 INSTKERNNAME?=  kernel
960
961 KERNSRCDIR?=    ${.CURDIR}/sys
962 KRNLCONFDIR=    ${KERNSRCDIR}/${TARGET}/conf
963 KRNLOBJDIR=     ${OBJTREE}${KERNSRCDIR}
964 KERNCONFDIR?=   ${KRNLCONFDIR}
965
966 BUILDKERNELS=
967 INSTALLKERNEL=
968 .for _kernel in ${KERNCONF}
969 .if exists(${KERNCONFDIR}/${_kernel})
970 BUILDKERNELS+=  ${_kernel}
971 .if empty(INSTALLKERNEL)
972 INSTALLKERNEL= ${_kernel}
973 .endif
974 .endif
975 .endfor
976
977 #
978 # buildkernel
979 #
980 # Builds all kernels defined by BUILDKERNELS.
981 #
982 buildkernel:
983 .if empty(BUILDKERNELS)
984         @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
985         false
986 .endif
987         @echo
988 .for _kernel in ${BUILDKERNELS}
989         @echo "--------------------------------------------------------------"
990         @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
991         @echo "--------------------------------------------------------------"
992         @echo "===> ${_kernel}"
993         mkdir -p ${KRNLOBJDIR}
994 .if !defined(NO_KERNELCONFIG)
995         @echo
996         @echo "--------------------------------------------------------------"
997         @echo ">>> stage 1: configuring the kernel"
998         @echo "--------------------------------------------------------------"
999         cd ${KRNLCONFDIR}; \
1000                 PATH=${TMPPATH} \
1001                     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1002                         ${KERNCONFDIR}/${_kernel}
1003 .endif
1004 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1005         @echo
1006         @echo "--------------------------------------------------------------"
1007         @echo ">>> stage 2.1: cleaning up the object tree"
1008         @echo "--------------------------------------------------------------"
1009         cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1010 .endif
1011 .if !defined(NO_KERNELOBJ)
1012         @echo
1013         @echo "--------------------------------------------------------------"
1014         @echo ">>> stage 2.2: rebuilding the object tree"
1015         @echo "--------------------------------------------------------------"
1016         cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1017 .endif
1018         @echo
1019         @echo "--------------------------------------------------------------"
1020         @echo ">>> stage 2.3: build tools"
1021         @echo "--------------------------------------------------------------"
1022         ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
1023 .if !defined(NO_KERNELDEPEND)
1024         @echo
1025         @echo "--------------------------------------------------------------"
1026         @echo ">>> stage 3.1: making dependencies"
1027         @echo "--------------------------------------------------------------"
1028         cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1029 .endif
1030         @echo
1031         @echo "--------------------------------------------------------------"
1032         @echo ">>> stage 3.2: building everything"
1033         @echo "--------------------------------------------------------------"
1034         cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1035         @echo "--------------------------------------------------------------"
1036         @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1037         @echo "--------------------------------------------------------------"
1038 .endfor
1039
1040 #
1041 # installkernel, etc.
1042 #
1043 # Install the kernel defined by INSTALLKERNEL
1044 #
1045 installkernel installkernel.debug \
1046 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1047 .if empty(INSTALLKERNEL)
1048         @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1049         false
1050 .endif
1051         @echo "--------------------------------------------------------------"
1052         @echo ">>> Installing kernel ${INSTALLKERNEL}"
1053         @echo "--------------------------------------------------------------"
1054         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1055             ${CROSSENV} PATH=${TMPPATH} \
1056             ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1057
1058 distributekernel distributekernel.debug:
1059 .if empty(INSTALLKERNEL)
1060         @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1061         false
1062 .endif
1063         mkdir -p ${DESTDIR}/${DISTDIR}
1064 .if defined(NO_ROOT)
1065         echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1066 .endif
1067         cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1068             ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1069             ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1070             DESTDIR=${INSTALL_DDIR}/kernel \
1071             ${.TARGET:S/distributekernel/install/}
1072 .if defined(NO_ROOT)
1073         sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1074             ${DESTDIR}/${DISTDIR}/kernel.meta
1075 .endif
1076 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1077 .if defined(NO_ROOT)
1078         echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1079 .endif
1080         cd ${KRNLOBJDIR}/${_kernel}; \
1081             ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1082             ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1083             KERNEL=${INSTKERNNAME}.${_kernel} \
1084             DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1085             ${.TARGET:S/distributekernel/install/}
1086 .if defined(NO_ROOT)
1087         sed -e 's|^./kernel|.|' \
1088             ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1089             ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1090 .endif
1091 .endfor
1092
1093 packagekernel:
1094 .if defined(NO_ROOT)
1095         cd ${DESTDIR}/${DISTDIR}/kernel; \
1096             tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1097             @${DESTDIR}/${DISTDIR}/kernel.meta
1098 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1099         cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1100             tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1101             @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1102 .endfor
1103 .else
1104         cd ${DESTDIR}/${DISTDIR}/kernel; \
1105             tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1106 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1107         cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1108             tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1109 .endfor
1110 .endif
1111
1112 #
1113 # doxygen
1114 #
1115 # Build the API documentation with doxygen
1116 #
1117 doxygen:
1118         @if [ ! -x `/usr/bin/which doxygen` ]; then \
1119                 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1120                 exit 1; \
1121         fi
1122         cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1123
1124 #
1125 # update
1126 #
1127 # Update the source tree(s), by running svn/svnup to update to the
1128 # latest copy.
1129 #
1130 update:
1131 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1132         @echo "--------------------------------------------------------------"
1133         @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1134         @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1135         @echo "--------------------------------------------------------------"
1136         @exit 1
1137 .endif
1138 .if defined(SVN_UPDATE)
1139         @echo "--------------------------------------------------------------"
1140         @echo ">>> Updating ${.CURDIR} using Subversion"
1141         @echo "--------------------------------------------------------------"
1142         @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1143 .endif
1144
1145 #
1146 # ------------------------------------------------------------------------
1147 #
1148 # From here onwards are utility targets used by the 'make world' and
1149 # related targets.  If your 'world' breaks, you may like to try to fix
1150 # the problem and manually run the following targets to attempt to
1151 # complete the build.  Beware, this is *not* guaranteed to work, you
1152 # need to have a pretty good grip on the current state of the system
1153 # to attempt to manually finish it.  If in doubt, 'make world' again.
1154 #
1155
1156 #
1157 # legacy: Build compatibility shims for the next three targets
1158 #
1159 legacy:
1160 .if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0
1161         @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \
1162         false
1163 .endif
1164 .for _tool in tools/build
1165         ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1166             cd ${.CURDIR}/${_tool} && \
1167             ${MAKE} DIRPRFX=${_tool}/ obj && \
1168             ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1169             ${MAKE} DIRPRFX=${_tool}/ depend && \
1170             ${MAKE} DIRPRFX=${_tool}/ all && \
1171             ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1172 .endfor
1173
1174 #
1175 # bootstrap-tools: Build tools needed for compatibility
1176 #
1177 .if ${MK_GAMES} != "no"
1178 _strfile=       games/fortune/strfile
1179 .endif
1180
1181 .if ${MK_CXX} != "no"
1182 _gperf=         gnu/usr.bin/gperf
1183 .endif
1184
1185 .if ${MK_GROFF} != "no"
1186 _groff=         gnu/usr.bin/groff
1187 .endif
1188
1189 .if ${BOOTSTRAPPING} < 800022
1190 _ar=            usr.bin/ar
1191 .endif
1192
1193 .if ${BOOTSTRAPPING} < 800013
1194 _mklocale=      usr.bin/mklocale
1195 .endif
1196
1197 .if ${BOOTSTRAPPING} < 900002
1198 _sed=           usr.bin/sed
1199 .endif
1200
1201 .if ${BOOTSTRAPPING} < 900006
1202 _lex=           usr.bin/lex
1203 .endif
1204
1205 .if ${BOOTSTRAPPING} < 1000002
1206 _m4=            usr.bin/m4
1207 .endif
1208
1209 .if ${BOOTSTRAPPING} < 1000013
1210 _yacc=          lib/liby \
1211                 usr.bin/yacc
1212 .endif
1213
1214 .if ${BOOTSTRAPPING} < 1000014
1215 _crunch=        usr.sbin/crunch
1216 .endif
1217
1218 .if ${BOOTSTRAPPING} < 1000026
1219 _nmtree=        lib/libnetbsd \
1220                 usr.sbin/nmtree
1221 .endif
1222
1223 .if ${BOOTSTRAPPING} < 1000027
1224 _cat=           bin/cat
1225 .endif
1226
1227 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1228 _awk=           usr.bin/awk
1229 .endif
1230
1231 .if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree)
1232 _gensnmptree=   usr.sbin/bsnmpd/gensnmptree
1233 .endif
1234
1235 .if ${MK_CLANG} != "no"
1236 _clang_tblgen= \
1237         lib/clang/libllvmsupport \
1238         lib/clang/libllvmtablegen \
1239         usr.bin/clang/tblgen \
1240         usr.bin/clang/clang-tblgen
1241 .endif
1242
1243 # dtrace tools are required for older bootstrap env and cross-build
1244 .if ${MK_CDDL} != "no" && \
1245     ((${BOOTSTRAPPING} < 1000034 && \
1246           !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \
1247       || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1248 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1249     lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1250 .endif
1251
1252 # Default to building the BSDL DTC, but build the GPL one if users explicitly
1253 # request it.
1254 _dtc= usr.bin/dtc
1255 .if ${MK_GPL_DTC} != "no"
1256 _dtc= gnu/usr.bin/dtc
1257 .endif
1258
1259 .if ${MK_KERBEROS} != "no"
1260 _kerberos5_bootstrap_tools= \
1261         kerberos5/tools/make-roken \
1262         kerberos5/lib/libroken \
1263         kerberos5/lib/libvers \
1264         kerberos5/tools/asn1_compile \
1265         kerberos5/tools/slc \
1266         usr.bin/compile_et
1267 .endif
1268
1269 #       Please document (add comment) why something is in 'bootstrap-tools'.
1270 #       Try to bound the building of the bootstrap-tool to just the
1271 #       FreeBSD versions that need the tool built at this stage of the build.
1272 bootstrap-tools: .MAKE
1273 .for _tool in \
1274     ${_clang_tblgen} \
1275     ${_kerberos5_bootstrap_tools} \
1276     ${_dtrace_tools} \
1277     ${_strfile} \
1278     ${_gperf} \
1279     ${_groff} \
1280     ${_ar} \
1281     ${_dtc} \
1282     ${_awk} \
1283     ${_cat} \
1284     usr.bin/lorder \
1285     usr.bin/makewhatis \
1286     ${_mklocale} \
1287     usr.bin/rpcgen \
1288     ${_sed} \
1289     ${_yacc} \
1290     ${_m4} \
1291     ${_lex} \
1292     lib/libmd \
1293     usr.bin/xinstall \
1294     ${_gensnmptree} \
1295     usr.sbin/config \
1296     ${_crunch} \
1297     ${_nmtree}
1298         ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1299                 cd ${.CURDIR}/${_tool} && \
1300                 ${MAKE} DIRPRFX=${_tool}/ obj && \
1301                 ${MAKE} DIRPRFX=${_tool}/ depend && \
1302                 ${MAKE} DIRPRFX=${_tool}/ all && \
1303                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1304 .endfor
1305
1306 #
1307 # build-tools: Build special purpose build tools
1308 #
1309 .if !defined(NO_SHARE)
1310 _share= share/syscons/scrnmaps
1311 .endif
1312
1313 .if ${MK_GCC} != "no"
1314 _gcc_tools= gnu/usr.bin/cc/cc_tools
1315 .endif
1316
1317 .if ${MK_RESCUE} != "no"
1318 _rescue= rescue/rescue
1319 .endif
1320
1321 build-tools: .MAKE
1322 .for _tool in \
1323     bin/csh \
1324     bin/sh \
1325     ${_rescue} \
1326     ${LOCAL_TOOL_DIRS} \
1327     lib/ncurses/ncurses \
1328     lib/ncurses/ncursesw \
1329     ${_share} \
1330     usr.bin/awk \
1331     lib/libmagic \
1332     usr.bin/mkesdb_static \
1333     usr.bin/mkcsmapper_static \
1334     usr.bin/vi/catalog
1335         ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1336                 cd ${.CURDIR}/${_tool} && \
1337                 ${MAKE} DIRPRFX=${_tool}/ obj && \
1338                 ${MAKE} DIRPRFX=${_tool}/ build-tools
1339 .endfor
1340 .for _tool in \
1341     ${_gcc_tools}
1342         ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1343                 cd ${.CURDIR}/${_tool} && \
1344                 ${MAKE} DIRPRFX=${_tool}/ obj && \
1345                 ${MAKE} DIRPRFX=${_tool}/ depend && \
1346                 ${MAKE} DIRPRFX=${_tool}/ all
1347 .endfor
1348
1349 #
1350 # kernel-tools: Build kernel-building tools
1351 #
1352 kernel-tools: .MAKE
1353         mkdir -p ${MAKEOBJDIRPREFIX}/usr
1354         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1355             -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1356 .for _tool in \
1357     sys/dev/aic7xxx/aicasm
1358         ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1359                 cd ${.CURDIR}/${_tool} && \
1360                 ${MAKE} DIRPRFX=${_tool}/ obj && \
1361                 ${MAKE} DIRPRFX=${_tool}/ depend && \
1362                 ${MAKE} DIRPRFX=${_tool}/ all && \
1363                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1364 .endfor
1365
1366 #
1367 # cross-tools: Build cross-building tools
1368 #
1369 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1370 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1371 _btxld=         usr.sbin/btxld
1372 .endif
1373 .endif
1374 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1375 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1376 _crunchide=     usr.sbin/crunch/crunchide
1377 .endif
1378 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1379 _kgzip=         usr.sbin/kgzip
1380 .endif
1381 .endif
1382
1383 .if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no"
1384 _binutils=      gnu/usr.bin/binutils
1385 .endif
1386
1387 # If an full path to an external cross compiler is given, don't build
1388 # a cross compiler.
1389 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1390 .if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
1391 _clang=         usr.bin/clang
1392 _clang_libs=    lib/clang
1393 .else
1394 _cc=            gnu/usr.bin/cc
1395 .endif
1396
1397 # The boot2 for pc98 requires gcc.
1398 .if ${TARGET} == "pc98"
1399 _cc=            gnu/usr.bin/cc
1400 .endif
1401 .endif
1402
1403 cross-tools: .MAKE
1404 .for _tool in \
1405     ${_clang_libs} \
1406     ${_clang} \
1407     ${_binutils} \
1408     ${_cc} \
1409     usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1410     ${_btxld} \
1411     ${_crunchide} \
1412     ${_kgzip}
1413         ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1414                 cd ${.CURDIR}/${_tool} && \
1415                 ${MAKE} DIRPRFX=${_tool}/ obj && \
1416                 ${MAKE} DIRPRFX=${_tool}/ depend && \
1417                 ${MAKE} DIRPRFX=${_tool}/ all && \
1418                 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1419 .endfor
1420
1421 #
1422 # hierarchy - ensure that all the needed directories are present
1423 #
1424 hierarchy hier:
1425         cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1426
1427 #
1428 # libraries - build all libraries, and install them under ${DESTDIR}.
1429 #
1430 # The list of libraries with dependents (${_prebuild_libs}) and their
1431 # interdependencies (__L) are built automatically by the
1432 # ${.CURDIR}/tools/make_libdeps.sh script.
1433 #
1434 libraries: .MAKE
1435         cd ${.CURDIR} && \
1436             ${MAKE} -f Makefile.inc1 _prereq_libs && \
1437             ${MAKE} -f Makefile.inc1 _startup_libs && \
1438             ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1439             ${MAKE} -f Makefile.inc1 _generic_libs
1440
1441 #
1442 # static libgcc.a prerequisite for shared libc
1443 #
1444 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1445
1446 # These dependencies are not automatically generated:
1447 #
1448 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1449 # all shared libraries for ELF.
1450 #
1451 _startup_libs=  gnu/lib/csu
1452 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1453 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1454 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1455 _startup_libs+= lib/csu/${MACHINE_ARCH}
1456 .else
1457 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1458 .endif
1459 _startup_libs+= gnu/lib/libgcc
1460 _startup_libs+= lib/libcompiler_rt
1461 _startup_libs+= lib/libc
1462 .if ${MK_LIBCPLUSPLUS} != "no"
1463 _startup_libs+= lib/libcxxrt
1464 .endif
1465
1466 gnu/lib/libgcc__L: lib/libc__L
1467 .if ${MK_LIBCPLUSPLUS} != "no"
1468 lib/libcxxrt__L: gnu/lib/libgcc__L
1469 .endif
1470
1471 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1472                 ${_kerberos5_lib_libhdb} \
1473                 ${_kerberos5_lib_libheimbase} \
1474                 ${_kerberos5_lib_libheimntlm} \
1475                 ${_kerberos5_lib_libheimsqlite} \
1476                 ${_kerberos5_lib_libheimipcc} \
1477                 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1478                 ${_kerberos5_lib_libroken} \
1479                 ${_kerberos5_lib_libwind} \
1480                 ${_lib_atf_libatf_c} \
1481                 lib/libbz2 ${_libcom_err} lib/libcrypt \
1482                 lib/libelf lib/libexpat \
1483                 ${_lib_libgssapi} ${_lib_libipx} \
1484                 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1485                 lib/ncurses/ncurses lib/ncurses/ncursesw \
1486                 lib/libopie lib/libpam ${_lib_libthr} \
1487                 lib/libradius lib/libsbuf lib/libtacplus \
1488                 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1489                 ${_cddl_lib_libzfs_core} \
1490                 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1491                 ${_secure_lib_libcrypto} ${_lib_libldns} \
1492                 ${_secure_lib_libssh} ${_secure_lib_libssl}
1493
1494 .if ${MK_ATF} != "no"
1495 _lib_atf_libatf_c=      lib/atf/libatf-c
1496 .endif
1497
1498 .if ${MK_LIBTHR} != "no"
1499 _lib_libthr=    lib/libthr
1500 .endif
1501
1502 .if ${MK_OFED} != "no"
1503 _ofed_lib=      contrib/ofed/usr.lib/
1504 .endif
1505
1506 _generic_libs=  ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1507 .for _DIR in ${LOCAL_LIB_DIRS}
1508 .if exists(${.CURDIR}/${_DIR}/Makefile)
1509 _generic_libs+= ${_DIR}
1510 .endif
1511 .endfor
1512
1513 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1514
1515 .if ${MK_CDDL} != "no"
1516 _cddl_lib_libumem= cddl/lib/libumem
1517 _cddl_lib_libnvpair= cddl/lib/libnvpair
1518 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1519 _cddl_lib= cddl/lib
1520 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1521 .endif
1522
1523 .if ${MK_CRYPT} != "no"
1524 .if ${MK_OPENSSL} != "no"
1525 _secure_lib_libcrypto= secure/lib/libcrypto
1526 _secure_lib_libssl= secure/lib/libssl
1527 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1528 .if ${MK_LDNS} != "no"
1529 _lib_libldns= lib/libldns
1530 lib/libldns__L: secure/lib/libcrypto__L
1531 .endif
1532 .if ${MK_OPENSSH} != "no"
1533 _secure_lib_libssh= secure/lib/libssh
1534 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1535 .if ${MK_LDNS} != "no"
1536 secure/lib/libssh__L: lib/libldns__L
1537 .endif
1538 .if ${MK_KERBEROS_SUPPORT} != "no"
1539 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1540     kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1541     lib/libmd__L kerberos5/lib/libroken__L
1542 .endif
1543 .endif
1544 .endif
1545 _secure_lib=    secure/lib
1546 .endif
1547
1548 .if ${MK_KERBEROS} != "no"
1549 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1550 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1551     kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1552     kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L 
1553 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1554     kerberos5/lib/libroken__L lib/libcom_err__L
1555 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1556     secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1557 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1558     lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1559     kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1560     kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1561 kerberos5/lib/libroken__L: lib/libcrypt__L
1562 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1563 kerberos5/lib/libheimbase__L: lib/libthr__L
1564 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1565 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1566 .endif
1567
1568 .if ${MK_GSSAPI} != "no"
1569 _lib_libgssapi= lib/libgssapi
1570 .endif
1571
1572 .if ${MK_IPX} != "no"
1573 _lib_libipx=    lib/libipx
1574 .endif
1575
1576 .if ${MK_KERBEROS} != "no"
1577 _kerberos5_lib= kerberos5/lib
1578 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1579 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1580 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1581 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1582 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1583 _kerberos5_lib_libroken= kerberos5/lib/libroken
1584 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1585 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1586 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1587 _kerberos5_lib_libwind= kerberos5/lib/libwind
1588 _libcom_err= lib/libcom_err
1589 .endif
1590
1591 .if ${MK_NIS} != "no"
1592 _lib_libypclnt= lib/libypclnt
1593 .endif
1594
1595 .if ${MK_OPENSSL} == "no"
1596 lib/libradius__L: lib/libmd__L
1597 .endif
1598
1599 .for _lib in ${_prereq_libs}
1600 ${_lib}__PL: .PHONY .MAKE
1601 .if exists(${.CURDIR}/${_lib})
1602         ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1603                 cd ${.CURDIR}/${_lib} && \
1604                 ${MAKE} DIRPRFX=${_lib}/ obj && \
1605                 ${MAKE} DIRPRFX=${_lib}/ depend && \
1606                 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all && \
1607                 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1608 .endif
1609 .endfor
1610
1611 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1612 ${_lib}__L: .PHONY .MAKE
1613 .if exists(${.CURDIR}/${_lib})
1614         ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1615                 cd ${.CURDIR}/${_lib} && \
1616                 ${MAKE} DIRPRFX=${_lib}/ obj && \
1617                 ${MAKE} DIRPRFX=${_lib}/ depend && \
1618                 ${MAKE} DIRPRFX=${_lib}/ all && \
1619                 ${MAKE} DIRPRFX=${_lib}/ install
1620 .endif
1621 .endfor
1622
1623 # libpam is special: we need to build static PAM modules before
1624 # static PAM library, and dynamic PAM library before dynamic PAM
1625 # modules.
1626 lib/libpam__L: .PHONY .MAKE
1627         ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1628                 cd ${.CURDIR}/lib/libpam && \
1629                 ${MAKE} DIRPRFX=lib/libpam/ obj && \
1630                 ${MAKE} DIRPRFX=lib/libpam/ depend && \
1631                 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all && \
1632                 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1633
1634 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1635 _startup_libs: ${_startup_libs:S/$/__L/}
1636 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1637 _generic_libs: ${_generic_libs:S/$/__L/}
1638
1639 .for __target in all clean cleandepend cleandir depend includes obj
1640 .for entry in ${SUBDIR}
1641 ${entry}.${__target}__D: .PHONY .MAKE
1642         ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1643                 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1644                 edir=${entry}.${MACHINE_ARCH}; \
1645                 cd ${.CURDIR}/$${edir}; \
1646         else \
1647                 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1648                 edir=${entry}; \
1649                 cd ${.CURDIR}/$${edir}; \
1650         fi; \
1651         ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1652 .endfor
1653 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1654 .endfor
1655
1656 .include <bsd.subdir.mk>
1657
1658 .if make(check-old) || make(check-old-dirs) || \
1659     make(check-old-files) || make(check-old-libs) || \
1660     make(delete-old) || make(delete-old-dirs) || \
1661     make(delete-old-files) || make(delete-old-libs)
1662
1663 #
1664 # check for / delete old files section
1665 #
1666
1667 .include "ObsoleteFiles.inc"
1668
1669 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1670 else you can not start such an application. Consult UPDATING for more \
1671 information regarding how to cope with the removal/revision bump of a \
1672 specific library."
1673
1674 .if !defined(BATCH_DELETE_OLD_FILES)
1675 RM_I=-i
1676 .else
1677 RM_I=-v
1678 .endif
1679
1680 delete-old-files:
1681         @echo ">>> Removing old files (only deletes safe to delete libs)"
1682 # Ask for every old file if the user really wants to remove it.
1683 # It's annoying, but better safe than sorry.
1684 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1685 # argument list will get too long. Using .for/.endfor make "loops" will make
1686 # the Makefile parser segfault.
1687         @exec 3<&0; \
1688         cd ${.CURDIR}; \
1689         ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1690             -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1691         while read file; do \
1692                 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1693                         chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1694                         rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1695                 fi; \
1696         done
1697 # Remove catpages without corresponding manpages.
1698         @exec 3<&0; \
1699         find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1700         sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1701         while read catpage; do \
1702                 read manpage; \
1703                 if [ ! -e "$${manpage}" ]; then \
1704                         rm ${RM_I} $${catpage} <&3; \
1705                 fi; \
1706         done
1707         @echo ">>> Old files removed"
1708
1709 check-old-files:
1710         @echo ">>> Checking for old files"
1711         @cd ${.CURDIR}; \
1712         ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1713             -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1714         while read file; do \
1715                 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1716                         echo "${DESTDIR}/$${file}"; \
1717                 fi; \
1718         done
1719 # Check for catpages without corresponding manpages.
1720         @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1721         sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1722         while read catpage; do \
1723                 read manpage; \
1724                 if [ ! -e "$${manpage}" ]; then \
1725                         echo $${catpage}; \
1726                 fi; \
1727         done
1728
1729 delete-old-libs:
1730         @echo ">>> Removing old libraries"
1731         @echo "${OLD_LIBS_MESSAGE}" | fmt
1732         @exec 3<&0; \
1733         cd ${.CURDIR}; \
1734         ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1735             -V OLD_LIBS | xargs -n1 | \
1736         while read file; do \
1737                 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1738                         chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1739                         rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1740                 fi; \
1741                 for ext in debug symbols; do \
1742                   if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1743                       "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1744                           rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1745                               <&3; \
1746                   fi; \
1747                 done; \
1748         done
1749         @echo ">>> Old libraries removed"
1750
1751 check-old-libs:
1752         @echo ">>> Checking for old libraries"
1753         @cd ${.CURDIR}; \
1754         ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1755             -V OLD_LIBS | xargs -n1 | \
1756         while read file; do \
1757                 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1758                         echo "${DESTDIR}/$${file}"; \
1759                 fi; \
1760                 for ext in debug symbols; do \
1761                   if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1762                           echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1763                   fi; \
1764                 done; \
1765         done
1766
1767 delete-old-dirs:
1768         @echo ">>> Removing old directories"
1769         @cd ${.CURDIR}; \
1770         ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1771             -V OLD_DIRS | xargs -n1 | sort -r | \
1772         while read dir; do \
1773                 if [ -d "${DESTDIR}/$${dir}" ]; then \
1774                         rmdir -v "${DESTDIR}/$${dir}" || true; \
1775                 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1776                         echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1777                 fi; \
1778         done
1779         @echo ">>> Old directories removed"
1780
1781 check-old-dirs:
1782         @echo ">>> Checking for old directories"
1783         @cd ${.CURDIR}; \
1784         ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1785             -V OLD_DIRS | xargs -n1 | \
1786         while read dir; do \
1787                 if [ -d "${DESTDIR}/$${dir}" ]; then \
1788                         echo "${DESTDIR}/$${dir}"; \
1789                 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1790                         echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1791                 fi; \
1792         done
1793
1794 delete-old: delete-old-files delete-old-dirs
1795         @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1796
1797 check-old: check-old-files check-old-libs check-old-dirs
1798         @echo "To remove old files and directories run '${MAKE} delete-old'."
1799         @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1800
1801 .endif
1802
1803 #
1804 # showconfig - show build configuration.
1805 #
1806 showconfig:
1807         @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
1808
1809 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1810 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1811
1812 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1813 .if exists(${KERNCONFDIR}/${KERNCONF})
1814 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1815         ${KERNCONFDIR}/${KERNCONF} ; echo
1816 .endif
1817 .endif
1818
1819 .endif
1820
1821 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1822 DTBOUTPUTPATH= ${.CURDIR}
1823 .endif
1824
1825 #
1826 # Build 'standalone' Device Tree Blob
1827 #
1828 builddtb:
1829         @if [ "${FDT_DTS_FILE}" = "" ]; then \
1830                 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1831                 exit 1; \
1832         fi;     \
1833         if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1834                 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1835                         exist!"; \
1836                 exit 1; \
1837         fi;     \
1838         if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then  \
1839                 echo "WARNING: DTB will be placed in the current working \
1840                         directory"; \
1841         fi
1842         @PATH=${TMPPATH} \
1843         dtc -O dtb -o \
1844             ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1845             -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1846
1847 ###############
1848
1849 .if defined(XDEV) && defined(XDEV_ARCH)
1850
1851 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1852 XDEV_CPUTYPE?=${CPUTYPE}
1853 .else
1854 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1855 .endif
1856
1857 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1858         -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \
1859         -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1860         TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1861         CPUTYPE=${XDEV_CPUTYPE}
1862
1863 XDDIR=${XDEV_ARCH}-freebsd
1864 XDTP=usr/${XDDIR}
1865 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1866         INSTALL="sh ${.CURDIR}/tools/install.sh"
1867 CDENV= ${CDBENV} \
1868         _SHLIBDIRPREFIX=${XDDESTDIR} \
1869         TOOLS_PREFIX=${XDDESTDIR}
1870 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
1871         -B${XDDESTDIR}/usr/lib
1872 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \
1873         MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1874
1875 CDTMP=  ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
1876 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1877 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1878 XDDESTDIR=${DESTDIR}/${XDTP}
1879 .if !defined(OSREL)
1880 OSREL!= uname -r | sed -e 's/[-(].*//'
1881 .endif
1882
1883 .ORDER: xdev-build xdev-install
1884 xdev: xdev-build xdev-install
1885
1886 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1887 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1888
1889 _xb-worldtmp:
1890         mkdir -p ${CDTMP}/usr
1891         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1892             -p ${CDTMP}/usr >/dev/null
1893
1894 _xb-bootstrap-tools:
1895 .for _tool in \
1896     ${_clang_tblgen}
1897         ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1898         cd ${.CURDIR}/${_tool} && \
1899         ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1900         ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1901         ${CDMAKE} DIRPRFX=${_tool}/ all && \
1902         ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
1903 .endfor
1904
1905 _xb-build-tools:
1906         ${_+_}@cd ${.CURDIR}; \
1907         ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1908
1909 _xb-cross-tools:
1910 .for _tool in \
1911     gnu/usr.bin/binutils \
1912     gnu/usr.bin/cc \
1913     usr.bin/ar \
1914     ${_clang_libs} \
1915     ${_clang}
1916         ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1917         cd ${.CURDIR}/${_tool} && \
1918         ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1919         ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1920         ${CDMAKE} DIRPRFX=${_tool}/ all
1921 .endfor
1922
1923 _xi-mtree:
1924         ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1925         mkdir -p ${XDDESTDIR}
1926         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1927             -p ${XDDESTDIR} >/dev/null
1928         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1929             -p ${XDDESTDIR}/usr >/dev/null
1930         mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1931             -p ${XDDESTDIR}/usr/include >/dev/null
1932
1933 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1934 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1935
1936 _xi-cross-tools:
1937         @echo "_xi-cross-tools"
1938 .for _tool in \
1939     gnu/usr.bin/binutils \
1940     gnu/usr.bin/cc \
1941     usr.bin/ar \
1942     ${_clang}
1943         ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1944         cd ${.CURDIR}/${_tool}; \
1945         ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1946 .endfor
1947
1948 _xi-includes:
1949         ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1950                 DESTDIR=${XDDESTDIR}
1951
1952 _xi-libraries:
1953         ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1954                 DESTDIR=${XDDESTDIR}
1955
1956 _xi-links:
1957         ${_+_}cd ${XDDESTDIR}/usr/bin; \
1958        mkdir -p ../../../../usr/bin; \
1959                 for i in *; do \
1960                         ln -sf ../../${XDTP}/usr/bin/$$i \
1961                             ../../../../usr/bin/${XDDIR}-$$i; \
1962                         ln -sf ../../${XDTP}/usr/bin/$$i \
1963                             ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1964                 done
1965 .else
1966 xdev xdev-build xdev-install:
1967         @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"
1968 .endif
1969
1970 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE