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
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
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)
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
44 .if !defined(TARGET) || !defined(TARGET_ARCH)
45 .error "Both TARGET and TARGET_ARCH must be defined."
49 .include <bsd.arch.inc.mk>
50 .include <bsd.compiler.mk>
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.
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.
62 .if defined(SUBDIR_OVERRIDE)
63 SUBDIR= ${SUBDIR_OVERRIDE}
65 SUBDIR= share/info lib libexec
67 .if ${MK_GAMES} != "no"
70 .if ${MK_CDDL} != "no"
74 .if ${MK_KERBEROS} != "no"
77 .if ${MK_RESCUE} != "no"
81 .if ${MK_CRYPT} != "no"
84 .if !defined(NO_SHARE)
87 SUBDIR+=sys usr.bin usr.sbin
88 .if ${MK_TESTS} != "no"
91 .if ${MK_OFED} != "no"
95 # We must do etc/ last for install/distribute to work.
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)
111 .if defined(NO_CLEANDIR)
112 CLEANDIR= clean cleandepend
119 BUILDENV_SHELL?=/bin/sh
121 SVN?= /usr/local/bin/svn
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
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}
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}
146 _t= ${TARGET_ARCH}/${TARGET}
149 .if empty(KNOWN_ARCHES:M${_t})
150 .error Unknown target ${TARGET_ARCH}:${TARGET}.
154 .if ${TARGET} == ${MACHINE}
155 TARGET_CPUTYPE?=${CPUTYPE}
160 .if !empty(TARGET_CPUTYPE)
161 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
163 _TARGET_CPUTYPE=dummy
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 ?=.
171 BUILD_ARCH!= uname -p
172 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
173 .error To cross-build, set TARGET_ARCH.
176 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
177 OBJTREE= ${MAKEOBJDIRPREFIX}
179 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
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}
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.
193 .if make(distributeworld) || make(installworld)
194 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
198 # Building a world goes through the following stages
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
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
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.
224 # Common environment for world related stages
225 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
226 MACHINE_ARCH=${TARGET_ARCH} \
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
234 .if defined(TARGET_CFLAGS)
235 CROSSENV+= ${TARGET_CFLAGS}
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 COMPILER_TYPE=${COMPILER_TYPE}
245 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
246 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
248 BOOTSTRAPPING=${OSRELDATE} \
250 MK_HTML=no MK_INFO=no NO_LINT=yes MK_MAN=no \
251 -DNO_PIC -DNO_PROFILE -DNO_SHARED \
252 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD MK_TESTS=no
255 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
256 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
257 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
259 BOOTSTRAPPING=${OSRELDATE} \
262 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD MK_TESTS=no
265 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
266 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
267 MK_GDB=no MK_TESTS=no
270 KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
271 PATH=${BPATH}:${PATH} \
272 WORLDTMP=${WORLDTMP} \
273 VERSION="${VERSION}" \
274 COMPILER_TYPE=${COMPILER_TYPE}
275 KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
276 ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
278 BOOTSTRAPPING=${OSRELDATE} \
280 MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
281 -DNO_PIC -DNO_PROFILE -DNO_SHARED \
282 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
285 WMAKEENV= ${CROSSENV} \
286 _SHLIBDIRPREFIX=${WORLDTMP} \
288 VERSION="${VERSION}" \
289 INSTALL="sh ${.CURDIR}/tools/install.sh" \
293 HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
295 HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
298 .if ${MK_CDDL} == "no"
302 .if defined(CROSS_TOOLCHAIN_PREFIX)
303 CROSS_COMPILER_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
304 CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX}
306 XCOMPILERS= CC CXX CPP
307 .for COMPILER in ${XCOMPILERS}
308 .if defined(CROSS_COMPILER_PREFIX)
309 X${COMPILER}?= ${CROSS_COMPILER_PREFIX}${${COMPILER}}
311 X${COMPILER}?= ${${COMPILER}}
314 XBINUTILS= AS AR LD NM OBJDUMP RANLIB STRINGS
315 .for BINUTIL in ${XBINUTILS}
316 .if defined(CROSS_BINUTILS_PREFIX)
317 X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${${BINUTIL}}
319 X${BINUTIL}?= ${${BINUTIL}}
322 WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \
323 CPP="${XCPP} ${XFLAGS}" \
324 AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
325 OBJDUMP=${XOBJDUMP} RANLIB=${XRANLIB} STRINGS=${XSTRINGS}
327 .if ${XCC:T:Mgcc} == "gcc"
328 WMAKE_COMPILER_TYPE= gcc
329 .elif ${XCC:T:Mclang} == "clang"
330 WMAKE_COMPILER_TYPE= clang
331 .elif ${MK_CLANG_IS_CC} == "no"
332 WMAKE_COMPILER_TYPE= gcc
334 WMAKE_COMPILER_TYPE= clang
336 IMAKE_COMPILER_TYPE= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
339 XFLAGS= --sysroot=${WORLDTMP}
340 .if defined(CROSS_BINUTILS_PREFIX)
341 # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a
342 # directory, but the compiler will look in the right place for it's
343 # tools so we don't need to tell it where to look.
344 .if exists(${CROSS_BINUTILS_PREFIX})
345 XFLAGS+= -B${CROSS_BINUTILS_PREFIX}
348 XFLAGS+= -B${WORLDTMP}/usr/bin
350 .if ${TARGET_ARCH} != ${MACHINE_ARCH} && ${WMAKE_COMPILER_TYPE} == "clang"
351 .if (${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "armv6") && \
352 ${MK_ARM_EABI} != "no"
354 .elif ${TARGET_ARCH} == "armv6hf"
355 TARGET_ABI= gnueabihf
359 TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0
360 XFLAGS+= -target ${TARGET_TRIPLE}
364 WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
365 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
367 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
369 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
371 .if ${TARGET_ARCH} == "amd64"
372 .if empty(TARGET_CPUTYPE)
373 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
375 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
377 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
378 MACHINE_CPU="i686 mmx sse sse2"
381 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
383 .elif ${TARGET_ARCH} == "powerpc64"
384 .if empty(TARGET_CPUTYPE)
385 LIB32CPUFLAGS= -mcpu=powerpc
387 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
389 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
391 LD="${LD} -m elf32ppc_fbsd"
395 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
396 -isystem ${LIB32TMP}/usr/include/ \
397 -L${LIB32TMP}/usr/lib32 \
398 -B${LIB32TMP}/usr/lib32
400 LIB32FLAGS+= --sysroot=${WORLDTMP}
403 # Yes, the flags are redundant.
404 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
405 _SHLIBDIRPREFIX=${LIB32TMP} \
406 _LDSCRIPTROOT=${LIB32TMP} \
407 VERSION="${VERSION}" \
408 INSTALL="sh ${.CURDIR}/tools/install.sh" \
411 SHLIBDIR=/usr/lib32 \
412 LIBPRIVATEDIR=/usr/lib32/private \
413 COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
415 CC="${XCC} ${LIB32FLAGS}" \
416 CXX="${XCXX} ${LIB32FLAGS}" \
417 DESTDIR=${LIB32TMP} \
425 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
426 MK_MAN=no MK_INFO=no MK_HTML=no
427 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
431 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
432 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
433 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${IMAKE_COMPILER_TYPE}
434 .if empty(.MAKEFLAGS:M-n)
435 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
436 LD_LIBRARY_PATH=${INSTALLTMP} \
437 PATH_LOCALE=${INSTALLTMP}/locale
438 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
440 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
442 .if defined(DB_FROM_SRC)
443 INSTALLFLAGS+= -N ${.CURDIR}/etc
444 MTREEFLAGS+= -N ${.CURDIR}/etc
446 _INSTALL_DDIR= ${DESTDIR}/${DISTDIR}
447 INSTALL_DDIR= ${_INSTALL_DDIR:S://:/:g:C:/$::}
449 METALOG?= ${DESTDIR}/${DISTDIR}/METALOG
450 IMAKE+= -DNO_ROOT METALOG=${METALOG}
451 INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR}
454 .if defined(DB_FROM_SRC) || defined(NO_ROOT)
455 IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}"
456 IMAKE_MTREE= MTREE_CMD="mtree ${MTREEFLAGS}"
460 KMAKEENV= ${WMAKEENV}
461 KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
466 # Attempt to rebuild the entire system, with reasonable chance of
467 # success, regardless of how old your existing system is.
470 .if ${.CURDIR:C/[^,]//g} != ""
471 # The m4 build of sendmail files doesn't like it if ',' is used
472 # anywhere in the path of it's files.
474 @echo "*** Error: path to source tree contains a comma ','"
479 @echo "--------------------------------------------------------------"
480 @echo ">>> Rebuilding the temporary build tree"
481 @echo "--------------------------------------------------------------"
482 .if !defined(NO_CLEAN)
484 .if defined(LIB32TMP)
488 rm -rf ${WORLDTMP}/legacy/usr/include
489 # XXX - These three can depend on any header file.
490 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
491 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
492 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
495 lib usr legacy/bin legacy/usr
496 mkdir -p ${WORLDTMP}/${_dir}
498 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
499 -p ${WORLDTMP}/legacy/usr >/dev/null
500 .if ${MK_GROFF} != "no"
501 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
502 -p ${WORLDTMP}/legacy/usr >/dev/null
504 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
505 -p ${WORLDTMP}/usr >/dev/null
506 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
507 -p ${WORLDTMP}/usr/include >/dev/null
508 ln -sf ${.CURDIR}/sys ${WORLDTMP}
509 .if ${MK_DEBUG_FILES} != "no"
510 # We could instead disable debug files for these build stages
511 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
512 -p ${WORLDTMP}/legacy/usr/lib >/dev/null
513 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
514 -p ${WORLDTMP}/usr/lib >/dev/null
516 .if ${MK_TESTS} != "no"
517 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \
518 -p ${WORLDTMP}/usr >/dev/null
520 .for _mtree in ${LOCAL_MTREE}
521 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
525 @echo "--------------------------------------------------------------"
526 @echo ">>> stage 1.1: legacy release compatibility shims"
527 @echo "--------------------------------------------------------------"
528 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
531 @echo "--------------------------------------------------------------"
532 @echo ">>> stage 1.2: bootstrap tools"
533 @echo "--------------------------------------------------------------"
534 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
536 .if !defined(NO_CLEAN)
538 @echo "--------------------------------------------------------------"
539 @echo ">>> stage 2.1: cleaning up the object tree"
540 @echo "--------------------------------------------------------------"
541 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
542 .if defined(LIB32TMP)
543 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
548 @echo "--------------------------------------------------------------"
549 @echo ">>> stage 2.2: rebuilding the object tree"
550 @echo "--------------------------------------------------------------"
551 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
554 @echo "--------------------------------------------------------------"
555 @echo ">>> stage 2.3: build tools"
556 @echo "--------------------------------------------------------------"
557 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
560 @echo "--------------------------------------------------------------"
561 @echo ">>> stage 3: cross tools"
562 @echo "--------------------------------------------------------------"
563 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
564 ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
567 @echo "--------------------------------------------------------------"
568 @echo ">>> stage 4.1: building includes"
569 @echo "--------------------------------------------------------------"
570 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
573 @echo "--------------------------------------------------------------"
574 @echo ">>> stage 4.2: building libraries"
575 @echo "--------------------------------------------------------------"
576 ${_+_}cd ${.CURDIR}; \
577 ${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \
578 -DNO_PROFILE MK_TESTS=no libraries
581 @echo "--------------------------------------------------------------"
582 @echo ">>> stage 4.3: make dependencies"
583 @echo "--------------------------------------------------------------"
584 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
587 @echo "--------------------------------------------------------------"
588 @echo ">>> stage 4.4: building everything"
589 @echo "--------------------------------------------------------------"
590 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
591 .if defined(LIB32TMP)
594 @echo "--------------------------------------------------------------"
595 @echo ">>> stage 5.1: building 32 bit shim libraries"
596 @echo "--------------------------------------------------------------"
597 mkdir -p ${LIB32TMP}/usr/include
598 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
599 -p ${LIB32TMP}/usr >/dev/null
600 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
601 -p ${LIB32TMP}/usr/include >/dev/null
602 .if ${MK_DEBUG_FILES} != "no"
603 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
604 -p ${LIB32TMP}/usr/lib >/dev/null
607 ln -sf ${.CURDIR}/sys ${WORLDTMP}
608 .for _t in obj includes
609 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
610 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
611 .if ${MK_CDDL} != "no"
612 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
614 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
615 .if ${MK_CRYPT} != "no"
616 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
618 .if ${MK_KERBEROS} != "no"
619 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
622 .for _dir in usr.bin/lex/lib
623 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
625 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
626 cd ${.CURDIR}/${_dir}; \
627 WORLDTMP=${WORLDTMP} \
628 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
629 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
630 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
631 -DEARLY_BUILD build-tools
634 ${LIB32WMAKE} -f Makefile.inc1 libraries
635 .for _t in obj depend all
636 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
637 DIRPRFX=libexec/rtld-elf/ ${_t}
638 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
639 DIRPRFX=usr.bin/ldd ${_t}
642 distribute32 install32:
643 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
644 .if ${MK_CDDL} != "no"
645 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
647 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
648 .if ${MK_CRYPT} != "no"
649 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
651 .if ${MK_KERBEROS} != "no"
652 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
654 cd ${.CURDIR}/libexec/rtld-elf; \
655 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
656 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
660 .if !defined(SUBDIR_OVERRIDE)
661 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
663 WMAKE_TGTS+= _cleanobj _obj _build-tools
664 .if !defined(SUBDIR_OVERRIDE)
665 WMAKE_TGTS+= _cross-tools
667 WMAKE_TGTS+= _includes _libraries _depend everything
668 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
672 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
673 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
676 @echo "--------------------------------------------------------------"
677 @echo ">>> World build started on `LC_ALL=C date`"
678 @echo "--------------------------------------------------------------"
682 @echo "--------------------------------------------------------------"
683 @echo ">>> World build completed on `LC_ALL=C date`"
684 @echo "--------------------------------------------------------------"
687 # We need to have this as a target because the indirection between Makefile
688 # and Makefile.inc1 causes the correct PATH to be used, rather than a
689 # modification of the current environment's PATH. In addition, we need
690 # to quote multiword values.
696 @echo Entering world for ${TARGET_ARCH}:${TARGET}
697 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
699 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
700 toolchain: ${TOOLCHAIN_TGTS}
701 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
706 # Checks to be sure system is ready for installworld/installkernel.
708 installcheck: _installcheck_world _installcheck_kernel
710 _installcheck_kernel:
713 # Require DESTDIR to be set if installing for a different architecture or
714 # using the user/group database in the source tree.
716 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
718 .if !make(distributeworld)
719 _installcheck_world: __installcheck_DESTDIR
720 _installcheck_kernel: __installcheck_DESTDIR
721 __installcheck_DESTDIR:
722 .if !defined(DESTDIR) || empty(DESTDIR)
723 @echo "ERROR: Please set DESTDIR!"; \
729 .if !defined(DB_FROM_SRC)
731 # Check for missing UIDs/GIDs.
733 CHECK_UIDS= auditdistd
735 .if ${MK_SENDMAIL} != "no"
741 CHECK_GIDS+= proxy authpf
743 .if ${MK_UNBOUND} != "no"
747 _installcheck_world: __installcheck_UGID
749 .for uid in ${CHECK_UIDS}
750 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
751 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
755 .for gid in ${CHECK_GIDS}
756 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
757 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
764 # Required install tools to be saved in a scratch dir for safety.
766 .if ${MK_INFO} != "no"
767 _install-info= install-info
769 .if ${MK_ZONEINFO} != "no"
770 _zoneinfo= zic tzsetup
773 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
774 date echo egrep find grep id install ${_install-info} \
775 ln lockf make mkdir mtree mv pwd_mkdb \
776 rm sed services_mkdb sh sysctl test true uname wc ${_zoneinfo}
781 # Distributes everything compiled by a `buildworld'.
785 # Installs everything compiled by a 'buildworld'.
788 # Non-base distributions produced by the base system
789 EXTRA_DISTRIBUTIONS= doc
790 .if ${MK_GAMES} != "no"
791 EXTRA_DISTRIBUTIONS+= games
793 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
794 EXTRA_DISTRIBUTIONS+= lib32
797 MTREE_MAGIC?= mtree 2.0
799 distributeworld installworld: _installcheck_world
800 mkdir -p ${INSTALLTMP}
801 progs=$$(for prog in ${ITOOLS}; do \
802 if progpath=`which $$prog`; then \
805 echo "Required tool $$prog not found in PATH." >&2; \
809 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
810 while read line; do \
812 if [ "$$2 $$3" != "not found" ]; then \
815 echo "Required library $$1 not found." >&2; \
819 cp $$libs $$progs ${INSTALLTMP}
820 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
822 echo "#${MTREE_MAGIC}" > ${METALOG}
824 .if make(distributeworld)
825 .for dist in ${EXTRA_DISTRIBUTIONS}
826 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
827 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
828 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
829 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
830 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
831 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
832 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
833 .if ${MK_DEBUG_FILES} != "no"
834 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
835 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/lib >/dev/null
838 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \
839 sed -e 's#^\./#./${dist}/#' >> ${METALOG}
840 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \
841 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG}
842 ${IMAKEENV} mtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \
843 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG}
846 -mkdir ${DESTDIR}/${DISTDIR}/base
847 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
848 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \
849 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \
850 LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs
852 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
853 ${IMAKEENV} rm -rf ${INSTALLTMP}
854 .if make(distributeworld)
855 .for dist in ${EXTRA_DISTRIBUTIONS}
856 find ${DESTDIR}/${DISTDIR}/${dist} -mindepth 1 -empty -delete
859 .for dist in base ${EXTRA_DISTRIBUTIONS}
860 @# For each file that exists in this dist, print the corresponding
861 @# line from the METALOG. This relies on the fact that
862 @# a line containing only the filename will sort immediatly before
863 @# the relevant mtree line.
864 cd ${DESTDIR}/${DISTDIR}; \
865 find ./${dist} | sort -u ${METALOG} - | \
866 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
867 ${DESTDIR}/${DISTDIR}/${dist}.meta
869 .if ${MK_DEBUG_FILES} != "no"
870 . for dist in base ${EXTRA_DISTRIBUTIONS}
871 @# For each file that exists in this dist, print the corresponding
872 @# line from the METALOG. This relies on the fact that
873 @# a line containing only the filename will sort immediatly before
874 @# the relevant mtree line.
875 cd ${DESTDIR}/${DISTDIR}; \
876 find ./${dist}/usr/lib/debug | sort -u ${METALOG} - | \
877 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \
878 ${DESTDIR}/${DISTDIR}/${dist}.debug.meta
885 .for dist in base ${EXTRA_DISTRIBUTIONS}
887 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
888 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
889 --exclude usr/lib/debug \
890 @${DESTDIR}/${DISTDIR}/${dist}.meta
892 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
893 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \
894 --exclude usr/lib/debug .
898 .if ${MK_DEBUG_FILES} != "no"
899 . for dist in base ${EXTRA_DISTRIBUTIONS}
900 . if defined(NO_ROOT)
901 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
902 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
903 @${DESTDIR}/${DISTDIR}/${dist}.debug.meta
905 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
906 tar cvJfL ${DESTDIR}/${DISTDIR}/${dist}.debug.txz \
915 # If you have a build server, you can NFS mount the source and obj directories
916 # and do a 'make reinstall' on the *client* to install new binaries from the
917 # most recent server build.
920 @echo "--------------------------------------------------------------"
921 @echo ">>> Making hierarchy"
922 @echo "--------------------------------------------------------------"
923 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
924 LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy
926 @echo "--------------------------------------------------------------"
927 @echo ">>> Installing everything"
928 @echo "--------------------------------------------------------------"
929 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
930 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
931 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
935 @echo "--------------------------------------------------------------"
936 @echo ">>> Distributing everything"
937 @echo "--------------------------------------------------------------"
938 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
939 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
940 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
944 distrib-dirs distribution:
945 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
946 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET}
949 # buildkernel and installkernel
951 # Which kernels to build and/or install is specified by setting
952 # KERNCONF. If not defined a GENERIC kernel is built/installed.
953 # Only the existing (depending TARGET) config files are used
954 # for building kernels and only the first of these is designated
955 # as the one being installed.
957 # Note that we have to use TARGET instead of TARGET_ARCH when
958 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
959 # be set to cross-build, we have to make sure TARGET is set
962 .if defined(KERNFAST)
967 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
968 .if !defined(KERNCONF) && ${KERNFAST} != "1"
972 .if ${TARGET_ARCH} == "powerpc64"
977 INSTKERNNAME?= kernel
979 KERNSRCDIR?= ${.CURDIR}/sys
980 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
981 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
982 KERNCONFDIR?= ${KRNLCONFDIR}
986 .for _kernel in ${KERNCONF}
987 .if exists(${KERNCONFDIR}/${_kernel})
988 BUILDKERNELS+= ${_kernel}
989 .if empty(INSTALLKERNEL)
990 INSTALLKERNEL= ${_kernel}
995 buildkernel ${WMAKE_TGTS} ${.ALLTARGETS:M_*}: .MAKE
1000 # Builds all kernels defined by BUILDKERNELS.
1003 .if empty(BUILDKERNELS)
1004 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
1008 .for _kernel in ${BUILDKERNELS}
1009 @echo "--------------------------------------------------------------"
1010 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
1011 @echo "--------------------------------------------------------------"
1012 @echo "===> ${_kernel}"
1013 mkdir -p ${KRNLOBJDIR}
1014 .if !defined(NO_KERNELCONFIG)
1016 @echo "--------------------------------------------------------------"
1017 @echo ">>> stage 1: configuring the kernel"
1018 @echo "--------------------------------------------------------------"
1019 cd ${KRNLCONFDIR}; \
1021 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
1022 -I ${KERNCONFDIR} ${KERNCONFDIR}/${_kernel}
1024 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
1026 @echo "--------------------------------------------------------------"
1027 @echo ">>> stage 2.1: cleaning up the object tree"
1028 @echo "--------------------------------------------------------------"
1029 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
1031 .if !defined(NO_KERNELOBJ)
1033 @echo "--------------------------------------------------------------"
1034 @echo ">>> stage 2.2: rebuilding the object tree"
1035 @echo "--------------------------------------------------------------"
1036 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
1039 @echo "--------------------------------------------------------------"
1040 @echo ">>> stage 2.3: build tools"
1041 @echo "--------------------------------------------------------------"
1042 ${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
1043 .if !defined(NO_KERNELDEPEND)
1045 @echo "--------------------------------------------------------------"
1046 @echo ">>> stage 3.1: making dependencies"
1047 @echo "--------------------------------------------------------------"
1048 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
1051 @echo "--------------------------------------------------------------"
1052 @echo ">>> stage 3.2: building everything"
1053 @echo "--------------------------------------------------------------"
1054 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
1055 @echo "--------------------------------------------------------------"
1056 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
1057 @echo "--------------------------------------------------------------"
1061 # installkernel, etc.
1063 # Install the kernel defined by INSTALLKERNEL
1065 installkernel installkernel.debug \
1066 reinstallkernel reinstallkernel.debug: _installcheck_kernel
1067 .if empty(INSTALLKERNEL)
1068 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1071 @echo "--------------------------------------------------------------"
1072 @echo ">>> Installing kernel ${INSTALLKERNEL}"
1073 @echo "--------------------------------------------------------------"
1074 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1075 ${CROSSENV} PATH=${TMPPATH} \
1076 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
1078 distributekernel distributekernel.debug:
1079 .if empty(INSTALLKERNEL)
1080 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
1083 mkdir -p ${DESTDIR}/${DISTDIR}
1084 .if defined(NO_ROOT)
1085 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.premeta
1087 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
1088 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.premeta/} \
1089 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
1090 DESTDIR=${INSTALL_DDIR}/kernel \
1091 ${.TARGET:S/distributekernel/install/}
1092 .if defined(NO_ROOT)
1093 sed -e 's|^./kernel|.|' ${DESTDIR}/${DISTDIR}/kernel.premeta > \
1094 ${DESTDIR}/${DISTDIR}/kernel.meta
1096 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1097 .if defined(NO_ROOT)
1098 echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
1100 cd ${KRNLOBJDIR}/${_kernel}; \
1101 ${IMAKEENV} ${IMAKE_INSTALL:S/METALOG/kernel.${_kernel}.premeta/} \
1102 ${IMAKE_MTREE} PATH=${TMPPATH} ${MAKE} \
1103 KERNEL=${INSTKERNNAME}.${_kernel} \
1104 DESTDIR=${INSTALL_DDIR}/kernel.${_kernel} \
1105 ${.TARGET:S/distributekernel/install/}
1106 .if defined(NO_ROOT)
1107 sed -e 's|^./kernel|.|' \
1108 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta > \
1109 ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1114 .if defined(NO_ROOT)
1115 cd ${DESTDIR}/${DISTDIR}/kernel; \
1116 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz \
1117 @${DESTDIR}/${DISTDIR}/kernel.meta
1118 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1119 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1120 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz \
1121 @${DESTDIR}/${DISTDIR}/kernel.${_kernel}.meta
1124 cd ${DESTDIR}/${DISTDIR}/kernel; \
1125 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
1126 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
1127 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
1128 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
1135 # Build the API documentation with doxygen
1138 @if [ ! -x `/usr/bin/which doxygen` ]; then \
1139 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
1142 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
1147 # Update the source tree(s), by running svn/svnup to update to the
1151 .if (defined(CVS_UPDATE) || defined(SUP_UPDATE)) && !defined(SVN_UPDATE)
1152 @echo "--------------------------------------------------------------"
1153 @echo "CVS_UPDATE and SUP_UPDATE are no longer supported."
1154 @echo "Please see: https://wiki.freebsd.org/CvsIsDeprecated"
1155 @echo "--------------------------------------------------------------"
1158 .if defined(SVN_UPDATE)
1159 @echo "--------------------------------------------------------------"
1160 @echo ">>> Updating ${.CURDIR} using Subversion"
1161 @echo "--------------------------------------------------------------"
1162 @(cd ${.CURDIR} && ${SVN} update ${SVNFLAGS})
1166 # ------------------------------------------------------------------------
1168 # From here onwards are utility targets used by the 'make world' and
1169 # related targets. If your 'world' breaks, you may like to try to fix
1170 # the problem and manually run the following targets to attempt to
1171 # complete the build. Beware, this is *not* guaranteed to work, you
1172 # need to have a pretty good grip on the current state of the system
1173 # to attempt to manually finish it. If in doubt, 'make world' again.
1177 # legacy: Build compatibility shims for the next three targets
1180 .if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0
1181 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \
1184 .for _tool in tools/build
1185 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1186 cd ${.CURDIR}/${_tool} && \
1187 ${MAKE} DIRPRFX=${_tool}/ obj && \
1188 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \
1189 ${MAKE} DIRPRFX=${_tool}/ depend && \
1190 ${MAKE} DIRPRFX=${_tool}/ all && \
1191 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1195 # bootstrap-tools: Build tools needed for compatibility
1197 .if ${MK_GAMES} != "no"
1198 _strfile= games/fortune/strfile
1201 .if ${MK_CXX} != "no"
1202 _gperf= gnu/usr.bin/gperf
1205 .if ${MK_GROFF} != "no"
1206 _groff= gnu/usr.bin/groff
1209 .if ${BOOTSTRAPPING} < 800022
1213 .if ${BOOTSTRAPPING} < 800013
1214 _mklocale= usr.bin/mklocale
1217 .if ${BOOTSTRAPPING} < 900002
1221 .if ${BOOTSTRAPPING} < 900006
1225 .if ${BOOTSTRAPPING} < 1000002
1229 .if ${BOOTSTRAPPING} < 1000013
1234 .if ${BOOTSTRAPPING} < 1000014
1235 _crunch= usr.sbin/crunch
1238 .if ${BOOTSTRAPPING} < 1000026
1239 _nmtree= lib/libnetbsd \
1243 .if ${BOOTSTRAPPING} < 1000027
1247 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1251 .if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree)
1252 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1255 .if ${MK_CLANG} != "no"
1257 lib/clang/libllvmsupport \
1258 lib/clang/libllvmtablegen \
1259 usr.bin/clang/tblgen \
1260 usr.bin/clang/clang-tblgen
1263 # dtrace tools are required for older bootstrap env and cross-build
1264 .if ${MK_CDDL} != "no" && \
1265 ((${BOOTSTRAPPING} < 1000034 && \
1266 !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \
1267 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1268 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1269 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1272 # Default to building the GPL DTC, but build the BSDL one if users explicitly
1275 .if ${MK_GPL_DTC} != "no"
1276 _dtc= gnu/usr.bin/dtc
1279 .if ${MK_KERBEROS} != "no"
1280 _kerberos5_bootstrap_tools= \
1281 kerberos5/tools/make-roken \
1282 kerberos5/lib/libroken \
1283 kerberos5/lib/libvers \
1284 kerberos5/tools/asn1_compile \
1285 kerberos5/tools/slc \
1289 # Please document (add comment) why something is in 'bootstrap-tools'.
1290 # Try to bound the building of the bootstrap-tool to just the
1291 # FreeBSD versions that need the tool built at this stage of the build.
1292 bootstrap-tools: .MAKE
1295 ${_kerberos5_bootstrap_tools} \
1305 usr.bin/makewhatis \
1318 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1319 cd ${.CURDIR}/${_tool} && \
1320 ${MAKE} DIRPRFX=${_tool}/ obj && \
1321 ${MAKE} DIRPRFX=${_tool}/ depend && \
1322 ${MAKE} DIRPRFX=${_tool}/ all && \
1323 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1327 # build-tools: Build special purpose build tools
1329 .if !defined(NO_SHARE)
1330 _share= share/syscons/scrnmaps
1333 .if ${MK_GCC} != "no"
1334 _gcc_tools= gnu/usr.bin/cc/cc_tools
1337 .if ${MK_RESCUE} != "no"
1338 _rescue= rescue/rescue
1346 ${LOCAL_TOOL_DIRS} \
1347 lib/ncurses/ncurses \
1348 lib/ncurses/ncursesw \
1352 usr.bin/mkesdb_static \
1353 usr.bin/mkcsmapper_static \
1355 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1356 cd ${.CURDIR}/${_tool} && \
1357 ${MAKE} DIRPRFX=${_tool}/ obj && \
1358 ${MAKE} DIRPRFX=${_tool}/ build-tools
1362 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1363 cd ${.CURDIR}/${_tool} && \
1364 ${MAKE} DIRPRFX=${_tool}/ obj && \
1365 ${MAKE} DIRPRFX=${_tool}/ depend && \
1366 ${MAKE} DIRPRFX=${_tool}/ all
1370 # kernel-tools: Build kernel-building tools
1373 mkdir -p ${MAKEOBJDIRPREFIX}/usr
1374 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1375 -p ${MAKEOBJDIRPREFIX}/usr >/dev/null
1378 # cross-tools: Build cross-building tools
1380 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1381 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1382 _btxld= usr.sbin/btxld
1385 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1386 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1387 _crunchide= usr.sbin/crunch/crunchide
1389 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1390 _kgzip= usr.sbin/kgzip
1394 .if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no"
1395 _binutils= gnu/usr.bin/binutils
1398 # If an full path to an external cross compiler is given, don't build
1400 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
1401 .if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
1402 _clang= usr.bin/clang
1403 _clang_libs= lib/clang
1408 # The boot2 for pc98 requires gcc.
1409 .if ${TARGET} == "pc98"
1420 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1424 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1425 cd ${.CURDIR}/${_tool} && \
1426 ${MAKE} DIRPRFX=${_tool}/ obj && \
1427 ${MAKE} DIRPRFX=${_tool}/ depend && \
1428 ${MAKE} DIRPRFX=${_tool}/ all && \
1429 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1433 # hierarchy - ensure that all the needed directories are present
1436 cd ${.CURDIR}/etc && ${HMAKE} distrib-dirs
1439 # libraries - build all libraries, and install them under ${DESTDIR}.
1441 # The list of libraries with dependents (${_prebuild_libs}) and their
1442 # interdependencies (__L) are built automatically by the
1443 # ${.CURDIR}/tools/make_libdeps.sh script.
1447 ${MAKE} -f Makefile.inc1 _prereq_libs && \
1448 ${MAKE} -f Makefile.inc1 _startup_libs && \
1449 ${MAKE} -f Makefile.inc1 _prebuild_libs && \
1450 ${MAKE} -f Makefile.inc1 _generic_libs
1453 # static libgcc.a prerequisite for shared libc
1455 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1457 # These dependencies are not automatically generated:
1459 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1460 # all shared libraries for ELF.
1462 _startup_libs= gnu/lib/csu
1463 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1464 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1465 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1466 _startup_libs+= lib/csu/${MACHINE_ARCH}
1468 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1470 _startup_libs+= gnu/lib/libgcc
1471 _startup_libs+= lib/libcompiler_rt
1472 _startup_libs+= lib/libc
1473 _startup_libs+= lib/libc_nonshared
1474 .if ${MK_LIBCPLUSPLUS} != "no"
1475 _startup_libs+= lib/libcxxrt
1478 gnu/lib/libgcc__L: lib/libc__L
1479 gnu/lib/libgcc__L: lib/libc_nonshared__L
1480 .if ${MK_LIBCPLUSPLUS} != "no"
1481 lib/libcxxrt__L: gnu/lib/libgcc__L
1484 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1485 ${_kerberos5_lib_libhdb} \
1486 ${_kerberos5_lib_libheimbase} \
1487 ${_kerberos5_lib_libheimntlm} \
1488 ${_kerberos5_lib_libheimsqlite} \
1489 ${_kerberos5_lib_libheimipcc} \
1490 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1491 ${_kerberos5_lib_libroken} \
1492 ${_kerberos5_lib_libwind} \
1494 lib/libbz2 ${_libcom_err} lib/libcrypt \
1495 lib/libelf lib/libexpat \
1497 lib/libkiconv lib/libkvm lib/liblzma lib/libmd lib/libnv \
1498 ${_lib_libcapsicum} \
1499 lib/ncurses/ncurses lib/ncurses/ncursesw \
1500 lib/libopie lib/libpam ${_lib_libthr} \
1501 lib/libradius lib/libsbuf lib/libtacplus \
1502 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1503 ${_cddl_lib_libzfs_core} \
1504 lib/libutil lib/libpjdlog ${_lib_libypclnt} lib/libz lib/msun \
1505 ${_secure_lib_libcrypto} ${_lib_libldns} \
1506 ${_secure_lib_libssh} ${_secure_lib_libssl}
1507 .if ${MK_GNUCXX} != no
1508 _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++
1511 .if defined(WITH_ATF) || ${MK_TESTS} != "no"
1512 .if !defined(WITH_ATF)
1513 # Ensure that the ATF libraries will be built during make libraries, even
1514 # though they will have WITHOUT_TESTS
1520 .if ${MK_LIBTHR} != "no"
1521 _lib_libthr= lib/libthr
1524 .if ${MK_OFED} != "no"
1525 _ofed_lib= contrib/ofed/usr.lib/
1528 .if ${MK_CASPER} != "no"
1529 _lib_libcapsicum=lib/libcapsicum
1532 lib/libcapsicum__L: lib/libnv__L
1533 lib/libpjdlog__L: lib/libutil__L
1535 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1536 .for _DIR in ${LOCAL_LIB_DIRS}
1537 .if exists(${.CURDIR}/${_DIR}/Makefile)
1538 _generic_libs+= ${_DIR}
1542 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1544 .if ${MK_CDDL} != "no"
1545 _cddl_lib_libumem= cddl/lib/libumem
1546 _cddl_lib_libnvpair= cddl/lib/libnvpair
1547 _cddl_lib_libzfs_core= cddl/lib/libzfs_core
1549 cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L
1552 .if ${MK_CRYPT} != "no"
1553 .if ${MK_OPENSSL} != "no"
1554 _secure_lib_libcrypto= secure/lib/libcrypto
1555 _secure_lib_libssl= secure/lib/libssl
1556 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1557 .if ${MK_LDNS} != "no"
1558 _lib_libldns= lib/libldns
1559 lib/libldns__L: secure/lib/libcrypto__L
1561 .if ${MK_OPENSSH} != "no"
1562 _secure_lib_libssh= secure/lib/libssh
1563 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1564 .if ${MK_LDNS} != "no"
1565 secure/lib/libssh__L: lib/libldns__L
1567 .if ${MK_KERBEROS_SUPPORT} != "no"
1568 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1569 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1570 lib/libmd__L kerberos5/lib/libroken__L
1574 _secure_lib= secure/lib
1577 .if ${MK_KERBEROS} != "no"
1578 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1579 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1580 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1581 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1582 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1583 kerberos5/lib/libroken__L lib/libcom_err__L
1584 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1585 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1586 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1587 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1588 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1589 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1590 kerberos5/lib/libroken__L: lib/libcrypt__L
1591 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1592 kerberos5/lib/libheimbase__L: lib/libthr__L
1593 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1594 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1597 .if ${MK_GSSAPI} != "no"
1598 _lib_libgssapi= lib/libgssapi
1601 .if ${MK_KERBEROS} != "no"
1602 _kerberos5_lib= kerberos5/lib
1603 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1604 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1605 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1606 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1607 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1608 _kerberos5_lib_libroken= kerberos5/lib/libroken
1609 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1610 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1611 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1612 _kerberos5_lib_libwind= kerberos5/lib/libwind
1613 _libcom_err= lib/libcom_err
1616 .if ${MK_NIS} != "no"
1617 _lib_libypclnt= lib/libypclnt
1620 .if ${MK_OPENSSL} == "no"
1621 lib/libradius__L: lib/libmd__L
1624 .for _lib in ${_prereq_libs}
1625 ${_lib}__PL: .PHONY .MAKE
1626 .if exists(${.CURDIR}/${_lib})
1627 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1628 cd ${.CURDIR}/${_lib} && \
1629 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1630 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1631 ${MAKE} MK_TESTS=no -DNO_PROFILE -DNO_PIC \
1632 DIRPRFX=${_lib}/ all && \
1633 ${MAKE} MK_TESTS=no -DNO_PROFILE -DNO_PIC \
1634 DIRPRFX=${_lib}/ install
1638 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1639 ${_lib}__L: .PHONY .MAKE
1640 .if exists(${.CURDIR}/${_lib})
1641 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1642 cd ${.CURDIR}/${_lib} && \
1643 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ obj && \
1644 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ depend && \
1645 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ all && \
1646 ${MAKE} MK_TESTS=no DIRPRFX=${_lib}/ install
1650 # libpam is special: we need to build static PAM modules before
1651 # static PAM library, and dynamic PAM library before dynamic PAM
1653 lib/libpam__L: .PHONY .MAKE
1654 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1655 cd ${.CURDIR}/lib/libpam && \
1656 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ obj && \
1657 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ depend && \
1658 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1659 -D_NO_LIBPAM_SO_YET all && \
1660 ${MAKE} MK_TESTS=no DIRPRFX=lib/libpam/ \
1661 -D_NO_LIBPAM_SO_YET install
1663 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1664 _startup_libs: ${_startup_libs:S/$/__L/}
1665 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1666 _generic_libs: ${_generic_libs:S/$/__L/}
1668 .for __target in all clean cleandepend cleandir depend includes obj
1669 .for entry in ${SUBDIR}
1670 ${entry}.${__target}__D: .PHONY .MAKE
1671 ${_+_}@set -e; if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1672 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1673 edir=${entry}.${MACHINE_ARCH}; \
1674 cd ${.CURDIR}/$${edir}; \
1676 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1678 cd ${.CURDIR}/$${edir}; \
1680 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1682 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1685 .include <bsd.subdir.mk>
1687 .if make(check-old) || make(check-old-dirs) || \
1688 make(check-old-files) || make(check-old-libs) || \
1689 make(delete-old) || make(delete-old-dirs) || \
1690 make(delete-old-files) || make(delete-old-libs)
1693 # check for / delete old files section
1696 .include "ObsoleteFiles.inc"
1698 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1699 else you can not start such an application. Consult UPDATING for more \
1700 information regarding how to cope with the removal/revision bump of a \
1703 .if !defined(BATCH_DELETE_OLD_FILES)
1710 @echo ">>> Removing old files (only deletes safe to delete libs)"
1711 # Ask for every old file if the user really wants to remove it.
1712 # It's annoying, but better safe than sorry.
1713 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1714 # argument list will get too long. Using .for/.endfor make "loops" will make
1715 # the Makefile parser segfault.
1718 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1719 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1720 while read file; do \
1721 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1722 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1723 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1726 # Remove catpages without corresponding manpages.
1728 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1729 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1730 while read catpage; do \
1732 if [ ! -e "$${manpage}" ]; then \
1733 rm ${RM_I} $${catpage} <&3; \
1736 @echo ">>> Old files removed"
1739 @echo ">>> Checking for old files"
1741 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1742 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1743 while read file; do \
1744 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1745 echo "${DESTDIR}/$${file}"; \
1748 # Check for catpages without corresponding manpages.
1749 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1750 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1751 while read catpage; do \
1753 if [ ! -e "$${manpage}" ]; then \
1759 @echo ">>> Removing old libraries"
1760 @echo "${OLD_LIBS_MESSAGE}" | fmt
1763 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1764 -V OLD_LIBS | xargs -n1 | \
1765 while read file; do \
1766 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1767 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1768 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1770 for ext in debug symbols; do \
1771 if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \
1772 "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1773 rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \
1778 @echo ">>> Old libraries removed"
1781 @echo ">>> Checking for old libraries"
1783 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1784 -V OLD_LIBS | xargs -n1 | \
1785 while read file; do \
1786 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1787 echo "${DESTDIR}/$${file}"; \
1789 for ext in debug symbols; do \
1790 if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \
1791 echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \
1797 @echo ">>> Removing old directories"
1799 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1800 -V OLD_DIRS | xargs -n1 | sort -r | \
1801 while read dir; do \
1802 if [ -d "${DESTDIR}/$${dir}" ]; then \
1803 rmdir -v "${DESTDIR}/$${dir}" || true; \
1804 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1805 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1808 @echo ">>> Old directories removed"
1811 @echo ">>> Checking for old directories"
1813 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1814 -V OLD_DIRS | xargs -n1 | \
1815 while read dir; do \
1816 if [ -d "${DESTDIR}/$${dir}" ]; then \
1817 echo "${DESTDIR}/$${dir}"; \
1818 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1819 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1823 delete-old: delete-old-files delete-old-dirs
1824 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1826 check-old: check-old-files check-old-libs check-old-dirs
1827 @echo "To remove old files and directories run '${MAKE} delete-old'."
1828 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1833 # showconfig - show build configuration.
1836 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort
1838 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1839 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1841 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1842 .if exists(${KERNCONFDIR}/${KERNCONF})
1843 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1844 ${KERNCONFDIR}/${KERNCONF} ; echo
1850 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1851 DTBOUTPUTPATH= ${.CURDIR}
1855 # Build 'standalone' Device Tree Blob
1858 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1859 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1862 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE} ]; then \
1863 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1867 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1868 echo "WARNING: DTB will be placed in the current working \
1872 ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \
1874 ${DTBOUTPUTPATH}/`basename ${FDT_DTS_FILE} .dts`
1878 .if defined(XDEV) && defined(XDEV_ARCH)
1880 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1881 XDEV_CPUTYPE?=${CPUTYPE}
1883 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1886 NOFUN=-DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT \
1887 MK_MAN=no MK_NLS=no -DNO_PROFILE \
1888 MK_KERBEROS=no MK_RESCUE=no MK_TESTS=no -DNO_WARNS \
1889 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1890 CPUTYPE=${XDEV_CPUTYPE}
1892 XDDIR=${XDEV_ARCH}-freebsd
1894 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
1895 INSTALL="sh ${.CURDIR}/tools/install.sh"
1897 _SHLIBDIRPREFIX=${XDDESTDIR} \
1898 TOOLS_PREFIX=${XDDESTDIR}
1899 CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \
1900 -B${XDDESTDIR}/usr/lib
1901 CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \
1902 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1904 CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp
1905 CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1906 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1907 XDDESTDIR?=${DESTDIR}/${XDTP}
1909 OSREL!= uname -r | sed -e 's/[-(].*//'
1912 .ORDER: xdev-build xdev-install
1913 xdev: xdev-build xdev-install
1915 .ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1916 xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools
1919 mkdir -p ${CDTMP}/usr
1920 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1921 -p ${CDTMP}/usr >/dev/null
1923 _xb-bootstrap-tools:
1926 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1927 cd ${.CURDIR}/${_tool} && \
1928 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1929 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1930 ${CDMAKE} DIRPRFX=${_tool}/ all && \
1931 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install
1935 ${_+_}@cd ${.CURDIR}; \
1936 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1940 gnu/usr.bin/binutils \
1945 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1946 cd ${.CURDIR}/${_tool} && \
1947 ${CDMAKE} DIRPRFX=${_tool}/ obj && \
1948 ${CDMAKE} DIRPRFX=${_tool}/ depend && \
1949 ${CDMAKE} DIRPRFX=${_tool}/ all
1953 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1954 mkdir -p ${XDDESTDIR}
1955 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1956 -p ${XDDESTDIR} >/dev/null
1957 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1958 -p ${XDDESTDIR}/usr >/dev/null
1959 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1960 -p ${XDDESTDIR}/usr/include >/dev/null
1962 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1963 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1966 @echo "_xi-cross-tools"
1968 gnu/usr.bin/binutils \
1972 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1973 cd ${.CURDIR}/${_tool}; \
1974 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1978 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1979 DESTDIR=${XDDESTDIR}
1982 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1983 DESTDIR=${XDDESTDIR}
1986 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1987 mkdir -p ../../../../usr/bin; \
1989 ln -sf ../../${XDTP}/usr/bin/$$i \
1990 ../../../../usr/bin/${XDDIR}-$$i; \
1991 ln -sf ../../${XDTP}/usr/bin/$$i \
1992 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1995 xdev xdev-build xdev-install:
1996 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"