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