4 # Make command line options:
5 # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
6 # -DNO_CLEAN do not clean at all
7 # -DNO_SHARE do not go into share subdir
8 # -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ}
9 # -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
10 # -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
11 # -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
12 # -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel
13 # -DNO_PORTSUPDATE do not update ports in ${MAKE} update
14 # -DNO_DOCUPDATE do not update doc in ${MAKE} update
15 # -DNO_WWWUPDATE do not update www in ${MAKE} update
16 # -DNO_CTF do not run the DTrace CTF conversion tools on built objects
17 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
18 # LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
19 # LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools
21 # TARGET="machine" to crossbuild world for a different machine type
22 # TARGET_ARCH= may be required when a TARGET supports multiple endians
23 # BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
26 # The intended user-driven targets are:
27 # buildworld - rebuild *everything*, including glue to help do upgrades
28 # installworld- install everything built by "buildworld"
29 # doxygen - build API documentation of the kernel
30 # update - convenient way to update your source tree (eg: cvsup/cvs)
32 # Standard targets (not defined here) are documented in the makefiles in
33 # /usr/share/mk. These include:
34 # obj depend all install clean cleandepend cleanobj
36 # You are supposed to define both of these when calling Makefile.inc1
37 # directly. However, some old scripts don't. Cope for the moment, but
38 # issue a new warning for a transition period.
39 .if defined(TARGET) && !defined(TARGET_ARCH)
40 .warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}."
43 .if !defined(TARGET) || !defined(TARGET_ARCH)
44 .error "Both TARGET and TARGET_ARCH must be defined."
48 .include <bsd.arch.inc.mk>
49 .include <bsd.compiler.mk>
51 # We must do share/info early so that installation of info `dir'
52 # entries works correctly. Do it first since it is less likely to
53 # grow dependencies on include and lib than vice versa.
55 # We must do lib/ and libexec/ before bin/, because if installworld
56 # installs a new /bin/sh, the 'make' command will *immediately*
57 # use that new version. And the new (dynamically-linked) /bin/sh
58 # will expect to find appropriate libraries in /lib and /libexec.
60 SUBDIR= share/info lib libexec
62 .if ${MK_GAMES} != "no"
65 .if ${MK_CDDL} != "no"
69 .if ${MK_KERBEROS} != "no"
72 .if ${MK_RESCUE} != "no"
76 .if ${MK_CRYPT} != "no"
79 .if !defined(NO_SHARE)
82 SUBDIR+=sys usr.bin usr.sbin
83 .if ${MK_OFED} != "no"
87 # We must do etc/ last for install/distribute to work.
91 # These are last, since it is nice to at least get the base system
92 # rebuilt before you do them.
93 .for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS}
94 .if exists(${.CURDIR}/${_DIR}/Makefile)
99 .if defined(SUBDIR_OVERRIDE)
100 SUBDIR= ${SUBDIR_OVERRIDE}
106 .if defined(NO_CLEANDIR)
107 CLEANDIR= clean cleandepend
114 BUILDENV_SHELL?=/bin/sh
117 CVSFLAGS?= -A -P -d -I!
123 SUPFLAGS+= -h ${SUPHOST}
126 MAKEOBJDIRPREFIX?= /usr/obj
127 .if !defined(OSRELDATE)
128 .if exists(/usr/include/osreldate.h)
129 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
130 /usr/include/osreldate.h
136 .if !defined(VERSION)
138 VERSION+= ${OSRELDATE}
141 KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6eb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64
142 .if ${TARGET} == ${TARGET_ARCH}
145 _t= ${TARGET_ARCH}/${TARGET}
148 .if empty(KNOWN_ARCHES:M${_t})
149 .error Unknown target ${TARGET_ARCH}:${TARGET}.
153 .if ${TARGET} == ${MACHINE}
154 TARGET_CPUTYPE?=${CPUTYPE}
159 .if !empty(TARGET_CPUTYPE)
160 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
162 _TARGET_CPUTYPE=dummy
164 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
165 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
166 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
167 .error CPUTYPE global should be set with ?=.
170 BUILD_ARCH!= uname -p
171 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
172 .error To cross-build, set TARGET_ARCH.
175 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
176 OBJTREE= ${MAKEOBJDIRPREFIX}
178 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
180 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
181 # /usr/games added for fortune which depend on strfile
182 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
183 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
184 STRICTTMPPATH= ${BPATH}:${XPATH}
185 TMPPATH= ${STRICTTMPPATH}:${PATH}
188 # Avoid running mktemp(1) unless actually needed.
189 # It may not be functional, e.g., due to new ABI
190 # when in the middle of installing over this system.
192 .if make(distributeworld) || make(installworld)
193 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
197 # Building a world goes through the following stages
199 # 1. legacy stage [BMAKE]
200 # This stage is responsible for creating compatibility
201 # shims that are needed by the bootstrap-tools,
202 # build-tools and cross-tools stages.
203 # 1. bootstrap-tools stage [BMAKE]
204 # This stage is responsible for creating programs that
205 # are needed for backward compatibility reasons. They
206 # are not built as cross-tools.
207 # 2. build-tools stage [TMAKE]
208 # This stage is responsible for creating the object
209 # tree and building any tools that are needed during
211 # 3. cross-tools stage [XMAKE]
212 # This stage is responsible for creating any tools that
213 # are needed for cross-builds. A cross-compiler is one
215 # 4. world stage [WMAKE]
216 # This stage actually builds the world.
217 # 5. install stage (optional) [IMAKE]
218 # This stage installs a previously built world.
223 # Common environment for world related stages
224 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
225 MACHINE_ARCH=${TARGET_ARCH} \
227 CPUTYPE=${TARGET_CPUTYPE}
228 .if ${MK_GROFF} != "no"
229 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
230 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
231 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
234 # bootstrap-tools stage
235 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
236 PATH=${BPATH}:${PATH} \
237 WORLDTMP=${WORLDTMP} \
238 VERSION="${VERSION}" \
239 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
240 COMPILER_TYPE=${COMPILER_TYPE}
241 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
242 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
244 BOOTSTRAPPING=${OSRELDATE} \
246 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
247 -DNO_PIC -DNO_PROFILE -DNO_SHARED \
248 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
251 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
252 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
253 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
255 BOOTSTRAPPING=${OSRELDATE} \
258 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
261 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
262 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
266 WMAKEENV= ${CROSSENV} \
267 _SHLIBDIRPREFIX=${WORLDTMP} \
269 VERSION="${VERSION}" \
270 INSTALL="sh ${.CURDIR}/tools/install.sh" \
272 .if ${MK_CDDL} == "no"
275 .if ${CC:T:Mgcc} == "gcc"
276 WMAKE_COMPILER_TYPE= gcc
277 .elif ${CC:T:Mclang} == "clang"
278 WMAKE_COMPILER_TYPE= clang
279 .elif ${MK_CLANG_IS_CC} == "no"
280 WMAKE_COMPILER_TYPE= gcc
282 WMAKE_COMPILER_TYPE= clang
284 WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
285 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
287 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
289 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
291 .if ${TARGET_ARCH} == "amd64"
292 .if empty(TARGET_CPUTYPE)
293 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
295 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
297 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
298 MACHINE_CPU="i686 mmx sse sse2" \
299 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
302 .elif ${TARGET_ARCH} == "powerpc64"
303 .if empty(TARGET_CPUTYPE)
304 LIB32CPUFLAGS= -mcpu=powerpc
306 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
308 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \
309 LD="${LD} -m elf32ppc_fbsd"
313 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
314 -isystem ${LIB32TMP}/usr/include/ \
315 -L${LIB32TMP}/usr/lib32 \
316 -B${LIB32TMP}/usr/lib32
318 # Yes, the flags are redundant.
319 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
320 _SHLIBDIRPREFIX=${LIB32TMP} \
321 _LDSCRIPTROOT=${LIB32TMP} \
322 VERSION="${VERSION}" \
323 INSTALL="sh ${.CURDIR}/tools/install.sh" \
325 CC="${CC} ${LIB32FLAGS}" \
326 CXX="${CXX} ${LIB32FLAGS}" \
328 SHLIBDIR=/usr/lib32 \
329 COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
331 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
332 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
333 -DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
335 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
339 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
340 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
341 .if empty(.MAKEFLAGS:M-n)
342 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
343 LD_LIBRARY_PATH=${INSTALLTMP} \
344 PATH_LOCALE=${INSTALLTMP}/locale
345 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
347 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
351 KMAKEENV= ${WMAKEENV}
352 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
357 # Attempt to rebuild the entire system, with reasonable chance of
358 # success, regardless of how old your existing system is.
361 .if ${.CURDIR:C/[^,]//g} != ""
362 # The m4 build of sendmail files doesn't like it if ',' is used
363 # anywhere in the path of it's files.
365 @echo "*** Error: path to source tree contains a comma ','"
370 @echo "--------------------------------------------------------------"
371 @echo ">>> Rebuilding the temporary build tree"
372 @echo "--------------------------------------------------------------"
373 .if !defined(NO_CLEAN)
375 .if defined(LIB32TMP)
379 rm -rf ${WORLDTMP}/legacy/usr/include
380 # XXX - These three can depend on any header file.
381 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
382 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
383 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
387 mkdir -p ${WORLDTMP}/${_dir}
389 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
390 -p ${WORLDTMP}/legacy/usr >/dev/null
391 .if ${MK_GROFF} != "no"
392 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
393 -p ${WORLDTMP}/legacy/usr >/dev/null
395 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
396 -p ${WORLDTMP}/usr >/dev/null
397 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
398 -p ${WORLDTMP}/usr/include >/dev/null
399 ln -sf ${.CURDIR}/sys ${WORLDTMP}
400 .if ${MK_BIND_LIBS} != "no"
401 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
402 -p ${WORLDTMP}/usr/include >/dev/null
406 @echo "--------------------------------------------------------------"
407 @echo ">>> stage 1.1: legacy release compatibility shims"
408 @echo "--------------------------------------------------------------"
409 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
412 @echo "--------------------------------------------------------------"
413 @echo ">>> stage 1.2: bootstrap tools"
414 @echo "--------------------------------------------------------------"
415 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
417 .if !defined(NO_CLEAN)
419 @echo "--------------------------------------------------------------"
420 @echo ">>> stage 2.1: cleaning up the object tree"
421 @echo "--------------------------------------------------------------"
422 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
423 .if defined(LIB32TMP)
424 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
429 @echo "--------------------------------------------------------------"
430 @echo ">>> stage 2.2: rebuilding the object tree"
431 @echo "--------------------------------------------------------------"
432 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
435 @echo "--------------------------------------------------------------"
436 @echo ">>> stage 2.3: build tools"
437 @echo "--------------------------------------------------------------"
438 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
441 @echo "--------------------------------------------------------------"
442 @echo ">>> stage 3: cross tools"
443 @echo "--------------------------------------------------------------"
444 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
447 @echo "--------------------------------------------------------------"
448 @echo ">>> stage 4.1: building includes"
449 @echo "--------------------------------------------------------------"
450 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
453 @echo "--------------------------------------------------------------"
454 @echo ">>> stage 4.2: building libraries"
455 @echo "--------------------------------------------------------------"
456 ${_+_}cd ${.CURDIR}; \
457 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
458 -DWITHOUT_MAN -DNO_PROFILE libraries
461 @echo "--------------------------------------------------------------"
462 @echo ">>> stage 4.3: make dependencies"
463 @echo "--------------------------------------------------------------"
464 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
467 @echo "--------------------------------------------------------------"
468 @echo ">>> stage 4.4: building everything"
469 @echo "--------------------------------------------------------------"
470 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
471 .if defined(LIB32TMP)
474 @echo "--------------------------------------------------------------"
475 @echo ">>> stage 5.1: building 32 bit shim libraries"
476 @echo "--------------------------------------------------------------"
477 mkdir -p ${LIB32TMP}/usr/include
478 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
479 -p ${LIB32TMP}/usr >/dev/null
480 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
481 -p ${LIB32TMP}/usr/include >/dev/null
483 ln -sf ${.CURDIR}/sys ${WORLDTMP}
484 .for _t in obj includes
485 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
486 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
487 .if ${MK_CDDL} != "no"
488 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
490 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
491 .if ${MK_CRYPT} != "no"
492 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
494 .if ${MK_KERBEROS} != "no"
495 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
498 .for _dir in usr.bin/lex/lib
499 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
501 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
502 cd ${.CURDIR}/${_dir}; \
503 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
504 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
505 -DEARLY_BUILD build-tools
508 ${LIB32WMAKE} -f Makefile.inc1 libraries
509 .for _t in obj depend all
510 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
511 DIRPRFX=libexec/rtld-elf/ ${_t}
512 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
513 DIRPRFX=usr.bin/ldd ${_t}
516 distribute32 install32:
517 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
518 .if ${MK_CDDL} != "no"
519 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
521 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
522 .if ${MK_CRYPT} != "no"
523 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
525 .if ${MK_KERBEROS} != "no"
526 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
528 cd ${.CURDIR}/libexec/rtld-elf; \
529 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
530 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
534 .if !defined(SUBDIR_OVERRIDE)
535 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
537 WMAKE_TGTS+= _cleanobj _obj _build-tools
538 .if !defined(SUBDIR_OVERRIDE)
539 WMAKE_TGTS+= _cross-tools
541 WMAKE_TGTS+= _includes _libraries _depend everything
542 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
546 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
547 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
550 @echo "--------------------------------------------------------------"
551 @echo ">>> World build started on `LC_ALL=C date`"
552 @echo "--------------------------------------------------------------"
556 @echo "--------------------------------------------------------------"
557 @echo ">>> World build completed on `LC_ALL=C date`"
558 @echo "--------------------------------------------------------------"
561 # We need to have this as a target because the indirection between Makefile
562 # and Makefile.inc1 causes the correct PATH to be used, rather than a
563 # modification of the current environment's PATH. In addition, we need
564 # to quote multiword values.
570 @echo Entering world for ${TARGET_ARCH}:${TARGET}
571 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true
573 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
574 toolchain: ${TOOLCHAIN_TGTS}
575 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
580 # Checks to be sure system is ready for installworld/installkernel.
585 # Require DESTDIR to be set if installing for a different architecture.
587 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
588 .if !make(distributeworld)
589 installcheck: installcheck_DESTDIR
590 installcheck_DESTDIR:
591 .if !defined(DESTDIR) || empty(DESTDIR)
592 @echo "ERROR: Please set DESTDIR!"; \
599 # Check for missing UIDs/GIDs.
603 .if ${MK_SENDMAIL} != "no"
609 CHECK_GIDS+= proxy authpf
611 installcheck: installcheck_UGID
613 .for uid in ${CHECK_UIDS}
614 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
615 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
619 .for gid in ${CHECK_GIDS}
620 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
621 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
627 # Required install tools to be saved in a scratch dir for safety.
629 .if ${MK_INFO} != "no"
630 _install-info= install-info
632 .if ${MK_ZONEINFO} != "no"
633 _zoneinfo= zic tzsetup
636 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
637 date echo egrep find grep ${_install-info} \
638 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
639 test true uname wc ${_zoneinfo}
644 # Distributes everything compiled by a `buildworld'.
648 # Installs everything compiled by a 'buildworld'.
651 # Non-base distributions produced by the base system
652 EXTRA_DISTRIBUTIONS= doc
653 .if ${MK_GAMES} != "no"
654 EXTRA_DISTRIBUTIONS+= games
656 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
657 EXTRA_DISTRIBUTIONS+= lib32
660 distributeworld installworld: installcheck
661 mkdir -p ${INSTALLTMP}
662 progs=$$(for prog in ${ITOOLS}; do \
663 if progpath=`which $$prog`; then \
666 echo "Required tool $$prog not found in PATH." >&2; \
670 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
671 while read line; do \
673 if [ "$$2 $$3" != "not found" ]; then \
676 echo "Required library $$1 not found." >&2; \
680 cp $$libs $$progs ${INSTALLTMP}
681 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
682 .if make(distributeworld)
683 .for dist in ${EXTRA_DISTRIBUTIONS}
684 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
685 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
686 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
687 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
688 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
689 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
690 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
692 -mkdir ${DESTDIR}/${DISTDIR}/base
693 ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
694 DESTDIR=${DESTDIR}/${DISTDIR}/base
696 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
697 ${IMAKEENV} rm -rf ${INSTALLTMP}
698 .if make(distributeworld)
699 .for dist in ${EXTRA_DISTRIBUTIONS}
700 find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
705 .for dist in base ${EXTRA_DISTRIBUTIONS}
706 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
707 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
713 # If you have a build server, you can NFS mount the source and obj directories
714 # and do a 'make reinstall' on the *client* to install new binaries from the
715 # most recent server build.
718 @echo "--------------------------------------------------------------"
719 @echo ">>> Making hierarchy"
720 @echo "--------------------------------------------------------------"
721 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
723 @echo "--------------------------------------------------------------"
724 @echo ">>> Installing everything"
725 @echo "--------------------------------------------------------------"
726 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
727 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
728 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
732 @echo "--------------------------------------------------------------"
733 @echo ">>> Distributing everything"
734 @echo "--------------------------------------------------------------"
735 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
736 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
737 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
741 distrib-dirs distribution:
742 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
745 # buildkernel and installkernel
747 # Which kernels to build and/or install is specified by setting
748 # KERNCONF. If not defined a GENERIC kernel is built/installed.
749 # Only the existing (depending TARGET) config files are used
750 # for building kernels and only the first of these is designated
751 # as the one being installed.
753 # Note that we have to use TARGET instead of TARGET_ARCH when
754 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
755 # be set to cross-build, we have to make sure TARGET is set
758 .if defined(KERNFAST)
763 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
764 .if !defined(KERNCONF) && ${KERNFAST} != "1"
768 .if !defined(KERNCONF) && defined(KERNEL)
772 .if ${TARGET_ARCH} == "powerpc64"
778 INSTKERNNAME?= kernel
780 KERNSRCDIR?= ${.CURDIR}/sys
781 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
782 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
783 KERNCONFDIR?= ${KRNLCONFDIR}
787 .for _kernel in ${KERNCONF}
788 .if exists(${KERNCONFDIR}/${_kernel})
789 BUILDKERNELS+= ${_kernel}
790 .if empty(INSTALLKERNEL)
791 INSTALLKERNEL= ${_kernel}
799 # Builds all kernels defined by BUILDKERNELS.
802 .if empty(BUILDKERNELS)
803 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
806 .if defined(KERNWARN)
807 @echo "--------------------------------------------------------------"
808 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
809 @echo "--------------------------------------------------------------"
813 .for _kernel in ${BUILDKERNELS}
814 @echo "--------------------------------------------------------------"
815 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
816 @echo "--------------------------------------------------------------"
817 @echo "===> ${_kernel}"
818 mkdir -p ${KRNLOBJDIR}
819 .if !defined(NO_KERNELCONFIG)
821 @echo "--------------------------------------------------------------"
822 @echo ">>> stage 1: configuring the kernel"
823 @echo "--------------------------------------------------------------"
826 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
827 ${KERNCONFDIR}/${_kernel}
829 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
831 @echo "--------------------------------------------------------------"
832 @echo ">>> stage 2.1: cleaning up the object tree"
833 @echo "--------------------------------------------------------------"
834 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
836 .if !defined(NO_KERNELOBJ)
838 @echo "--------------------------------------------------------------"
839 @echo ">>> stage 2.2: rebuilding the object tree"
840 @echo "--------------------------------------------------------------"
841 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
844 @echo "--------------------------------------------------------------"
845 @echo ">>> stage 2.3: build tools"
846 @echo "--------------------------------------------------------------"
847 cd ${KRNLOBJDIR}/${_kernel}; \
848 PATH=${BPATH}:${PATH} \
849 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
850 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
851 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
852 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
853 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
854 .for target in obj depend all
855 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
856 PATH=${BPATH}:${PATH} \
857 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
858 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
861 .if !defined(NO_KERNELDEPEND)
863 @echo "--------------------------------------------------------------"
864 @echo ">>> stage 3.1: making dependencies"
865 @echo "--------------------------------------------------------------"
866 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
869 @echo "--------------------------------------------------------------"
870 @echo ">>> stage 3.2: building everything"
871 @echo "--------------------------------------------------------------"
872 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
873 @echo "--------------------------------------------------------------"
874 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
875 @echo "--------------------------------------------------------------"
879 # installkernel, etc.
881 # Install the kernel defined by INSTALLKERNEL
883 installkernel installkernel.debug \
884 reinstallkernel reinstallkernel.debug: installcheck
885 .if empty(INSTALLKERNEL)
886 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
889 @echo "--------------------------------------------------------------"
890 @echo ">>> Installing kernel ${INSTALLKERNEL}"
891 @echo "--------------------------------------------------------------"
892 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
893 ${CROSSENV} PATH=${TMPPATH} \
894 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
896 distributekernel distributekernel.debug:
897 .if empty(INSTALLKERNEL)
898 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
901 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
902 ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
903 DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
904 ${.TARGET:S/distributekernel/install/}
905 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
906 cd ${KRNLOBJDIR}/${_kernel}; \
907 ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
908 KERNEL=${INSTKERNNAME}.${_kernel} \
909 DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
910 ${.TARGET:S/distributekernel/install/}
914 cd ${DESTDIR}/${DISTDIR}/kernel; \
915 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
916 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
917 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
918 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
924 # Build the API documentation with doxygen
927 @if [ ! -x `/usr/bin/which doxygen` ]; then \
928 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
931 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
936 # Update the source tree(s), by running cvsup/cvs/svn to update to the
940 .if defined(SUP_UPDATE)
941 @echo "--------------------------------------------------------------"
942 @echo ">>> Running ${SUP}"
943 @echo "--------------------------------------------------------------"
945 @${SUP} ${SUPFLAGS} ${SUPFILE}
947 .if defined(SUPFILE1)
948 @${SUP} ${SUPFLAGS} ${SUPFILE1}
950 .if defined(SUPFILE2)
951 @${SUP} ${SUPFLAGS} ${SUPFILE2}
953 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
954 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
956 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
957 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
959 .if defined(WWWSUPFILE) && !defined(NO_WWWUPDATE)
960 @${SUP} ${SUPFLAGS} ${WWWSUPFILE}
963 .if defined(CVS_UPDATE)
965 if [ -d CVS ] ; then \
966 echo "--------------------------------------------------------------" ; \
967 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
968 echo "--------------------------------------------------------------" ; \
969 echo ${CVS} -R -q update ${CVSFLAGS} ; \
970 ${CVS} -R -q update ${CVSFLAGS} ; \
973 .if defined(SVN_UPDATE)
975 if [ -d .svn ] ; then \
976 echo "--------------------------------------------------------------" ; \
977 echo ">>> Updating ${.CURDIR} using Subversion" ; \
978 echo "--------------------------------------------------------------" ; \
979 echo ${SVN} update ${SVNFLAGS} ; \
980 ${SVN} update ${SVNFLAGS} ; \
985 # ------------------------------------------------------------------------
987 # From here onwards are utility targets used by the 'make world' and
988 # related targets. If your 'world' breaks, you may like to try to fix
989 # the problem and manually run the following targets to attempt to
990 # complete the build. Beware, this is *not* guaranteed to work, you
991 # need to have a pretty good grip on the current state of the system
992 # to attempt to manually finish it. If in doubt, 'make world' again.
996 # legacy: Build compatibility shims for the next three targets
999 .if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0
1000 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \
1003 .for _tool in tools/build
1004 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1005 cd ${.CURDIR}/${_tool}; \
1006 ${MAKE} DIRPRFX=${_tool}/ obj; \
1007 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
1008 ${MAKE} DIRPRFX=${_tool}/ depend; \
1009 ${MAKE} DIRPRFX=${_tool}/ all; \
1010 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1014 # bootstrap-tools: Build tools needed for compatibility
1016 .if ${MK_GAMES} != "no"
1017 _strfile= games/fortune/strfile
1020 .if ${MK_CXX} != "no"
1021 _gperf= gnu/usr.bin/gperf
1024 .if ${MK_GROFF} != "no"
1025 _groff= gnu/usr.bin/groff
1028 .if ${BOOTSTRAPPING} < 800022
1032 .if ${BOOTSTRAPPING} < 800013
1033 _mklocale= usr.bin/mklocale
1036 .if ${BOOTSTRAPPING} < 900002
1040 .if ${BOOTSTRAPPING} < 900006
1044 .if ${BOOTSTRAPPING} < 1000013
1048 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1052 .if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree)
1053 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1056 .if ${MK_CLANG} != "no"
1058 lib/clang/libllvmsupport \
1059 lib/clang/libllvmtablegen \
1060 usr.bin/clang/tblgen \
1061 usr.bin/clang/clang-tblgen
1064 # dtrace tools are required for older bootstrap env and cross-build
1065 .if ${MK_CDDL} != "no" && \
1066 ((${BOOTSTRAPPING} < 800038 && \
1067 !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)) \
1068 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
1069 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1070 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1073 .if ${MK_FDT} != "no"
1074 _dtc= gnu/usr.bin/dtc
1077 .if ${MK_KERBEROS} != "no"
1078 _kerberos5_bootstrap_tools= \
1079 kerberos5/tools/make-roken \
1080 kerberos5/lib/libroken \
1081 kerberos5/lib/libvers \
1082 kerberos5/tools/asn1_compile \
1086 # Please document (add comment) why something is in 'bootstrap-tools'.
1087 # Try to bound the building of the bootstrap-tool to just the
1088 # FreeBSD versions that need the tool built at this stage of the build.
1092 ${_kerberos5_bootstrap_tools} \
1101 usr.bin/makewhatis \
1110 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1111 cd ${.CURDIR}/${_tool}; \
1112 ${MAKE} DIRPRFX=${_tool}/ obj; \
1113 ${MAKE} DIRPRFX=${_tool}/ depend; \
1114 ${MAKE} DIRPRFX=${_tool}/ all; \
1115 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1119 # build-tools: Build special purpose build tools
1121 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
1122 _aicasm= sys/modules/aic7xxx/aicasm
1125 .if !defined(NO_SHARE)
1126 _share= share/syscons/scrnmaps
1129 .if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
1130 _gcc_tools= gnu/usr.bin/cc/cc_tools
1133 .if ${MK_RESCUE} != "no"
1134 _rescue= rescue/rescue
1142 ${LOCAL_TOOL_DIRS} \
1143 lib/ncurses/ncurses \
1144 lib/ncurses/ncursesw \
1149 usr.bin/mkesdb_static \
1150 usr.bin/mkcsmapper_static
1151 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1152 cd ${.CURDIR}/${_tool}; \
1153 ${MAKE} DIRPRFX=${_tool}/ obj; \
1154 ${MAKE} DIRPRFX=${_tool}/ build-tools
1158 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1159 cd ${.CURDIR}/${_tool}; \
1160 ${MAKE} DIRPRFX=${_tool}/ obj; \
1161 ${MAKE} DIRPRFX=${_tool}/ depend; \
1162 ${MAKE} DIRPRFX=${_tool}/ all
1166 # cross-tools: Build cross-building tools
1168 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1169 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1170 _btxld= usr.sbin/btxld
1173 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1174 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1175 _crunchide= usr.sbin/crunch/crunchide
1177 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1178 _kgzip= usr.sbin/kgzip
1182 .if ${MK_BINUTILS} != "no"
1183 _binutils= gnu/usr.bin/binutils
1186 .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1187 _clang= usr.bin/clang
1188 _clang_libs= lib/clang
1191 .if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no"
1201 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1205 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1206 cd ${.CURDIR}/${_tool}; \
1207 ${MAKE} DIRPRFX=${_tool}/ obj; \
1208 ${MAKE} DIRPRFX=${_tool}/ depend; \
1209 ${MAKE} DIRPRFX=${_tool}/ all; \
1210 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1214 # hierarchy - ensure that all the needed directories are present
1217 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
1220 # libraries - build all libraries, and install them under ${DESTDIR}.
1222 # The list of libraries with dependents (${_prebuild_libs}) and their
1223 # interdependencies (__L) are built automatically by the
1224 # ${.CURDIR}/tools/make_libdeps.sh script.
1228 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1229 ${MAKE} -f Makefile.inc1 _startup_libs; \
1230 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1231 ${MAKE} -f Makefile.inc1 _generic_libs;
1234 # static libgcc.a prerequisite for shared libc
1236 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1238 # These dependencies are not automatically generated:
1240 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1241 # all shared libraries for ELF.
1243 _startup_libs= gnu/lib/csu
1244 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1245 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1246 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1247 _startup_libs+= lib/csu/${MACHINE_ARCH}
1249 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1251 _startup_libs+= gnu/lib/libgcc
1252 _startup_libs+= lib/libcompiler_rt
1253 _startup_libs+= lib/libc
1254 .if ${MK_LIBCPLUSPLUS} != "no"
1255 _startup_libs+= lib/libcxxrt
1258 gnu/lib/libgcc__L: lib/libc__L
1259 .if ${MK_LIBCPLUSPLUS} != "no"
1260 lib/libcxxrt__L: gnu/lib/libgcc__L
1263 _prebuild_libs= ${_kerberos5_lib_libasn1} \
1264 ${_kerberos5_lib_libhdb} \
1265 ${_kerberos5_lib_libheimbase} \
1266 ${_kerberos5_lib_libheimntlm} \
1267 ${_kerberos5_lib_libheimsqlite} \
1268 ${_kerberos5_lib_libheimipcc} \
1269 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1270 ${_kerberos5_lib_libroken} \
1271 ${_kerberos5_lib_libwind} \
1272 lib/libbz2 ${_libcom_err} lib/libcrypt \
1274 ${_lib_libgssapi} ${_lib_libipx} \
1275 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1276 lib/ncurses/ncurses lib/ncurses/ncursesw \
1277 lib/libopie lib/libpam ${_lib_libthr} \
1278 lib/libradius lib/libsbuf lib/libtacplus \
1279 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1280 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1281 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1282 ${_secure_lib_libssl}
1284 .if ${MK_LIBTHR} != "no"
1285 _lib_libthr= lib/libthr
1288 .if ${MK_OFED} != "no"
1289 _ofed_lib= contrib/ofed/usr.lib/
1292 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1293 .for _DIR in ${LOCAL_LIB_DIRS}
1294 .if exists(${.CURDIR}/${_DIR}/Makefile)
1295 _generic_libs+= ${_DIR}
1299 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1301 .if ${MK_CDDL} != "no"
1302 _cddl_lib_libumem= cddl/lib/libumem
1303 _cddl_lib_libnvpair= cddl/lib/libnvpair
1307 .if ${MK_CRYPT} != "no"
1308 .if ${MK_OPENSSL} != "no"
1309 _secure_lib_libcrypto= secure/lib/libcrypto
1310 _secure_lib_libssl= secure/lib/libssl
1311 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1312 .if ${MK_OPENSSH} != "no"
1313 _secure_lib_libssh= secure/lib/libssh
1314 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1315 .if ${MK_KERBEROS_SUPPORT} != "no"
1316 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1317 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1318 lib/libmd__L kerberos5/lib/libroken__L
1322 _secure_lib= secure/lib
1325 .if ${MK_KERBEROS} != "no"
1326 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1327 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1328 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \
1329 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L
1330 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \
1331 kerberos5/lib/libroken__L lib/libcom_err__L
1332 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1333 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L
1334 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1335 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1336 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \
1337 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L
1338 kerberos5/lib/libroken__L: lib/libcrypt__L
1339 kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L
1340 kerberos5/lib/libheimbase__L: lib/libthr__L
1341 kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L
1342 kerberos5/lib/libheimsqlite__L: lib/libthr__L
1345 .if ${MK_GSSAPI} != "no"
1346 _lib_libgssapi= lib/libgssapi
1349 .if ${MK_IPX} != "no"
1350 _lib_libipx= lib/libipx
1353 .if ${MK_KERBEROS} != "no"
1354 _kerberos5_lib= kerberos5/lib
1355 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1356 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1357 _kerberos5_lib_libheimbase= kerberos5/lib/libheimbase
1358 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1359 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1360 _kerberos5_lib_libroken= kerberos5/lib/libroken
1361 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1362 _kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite
1363 _kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc
1364 _kerberos5_lib_libwind= kerberos5/lib/libwind
1365 _libcom_err= lib/libcom_err
1368 .if ${MK_NIS} != "no"
1369 _lib_libypclnt= lib/libypclnt
1372 .if ${MK_OPENSSL} == "no"
1373 lib/libradius__L: lib/libmd__L
1376 .for _lib in ${_prereq_libs}
1378 .if exists(${.CURDIR}/${_lib})
1379 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1380 cd ${.CURDIR}/${_lib}; \
1381 ${MAKE} DIRPRFX=${_lib}/ obj; \
1382 ${MAKE} DIRPRFX=${_lib}/ depend; \
1383 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1384 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1388 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1390 .if exists(${.CURDIR}/${_lib})
1391 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1392 cd ${.CURDIR}/${_lib}; \
1393 ${MAKE} DIRPRFX=${_lib}/ obj; \
1394 ${MAKE} DIRPRFX=${_lib}/ depend; \
1395 ${MAKE} DIRPRFX=${_lib}/ all; \
1396 ${MAKE} DIRPRFX=${_lib}/ install
1400 # libpam is special: we need to build static PAM modules before
1401 # static PAM library, and dynamic PAM library before dynamic PAM
1403 lib/libpam__L: .PHONY
1404 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1405 cd ${.CURDIR}/lib/libpam; \
1406 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1407 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1408 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1409 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1411 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1412 _startup_libs: ${_startup_libs:S/$/__L/}
1413 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1414 _generic_libs: ${_generic_libs:S/$/__L/}
1416 .for __target in all clean cleandepend cleandir depend includes obj
1417 .for entry in ${SUBDIR}
1418 ${entry}.${__target}__D: .PHONY
1419 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1420 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1421 edir=${entry}.${MACHINE_ARCH}; \
1422 cd ${.CURDIR}/$${edir}; \
1424 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1426 cd ${.CURDIR}/$${edir}; \
1428 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1430 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1433 .include <bsd.subdir.mk>
1435 .if make(check-old) || make(check-old-dirs) || \
1436 make(check-old-files) || make(check-old-libs) || \
1437 make(delete-old) || make(delete-old-dirs) || \
1438 make(delete-old-files) || make(delete-old-libs)
1441 # check for / delete old files section
1444 .include "ObsoleteFiles.inc"
1446 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1447 else you can not start such an application. Consult UPDATING for more \
1448 information regarding how to cope with the removal/revision bump of a \
1451 .if !defined(BATCH_DELETE_OLD_FILES)
1458 @echo ">>> Removing old files (only deletes safe to delete libs)"
1459 # Ask for every old file if the user really wants to remove it.
1460 # It's annoying, but better safe than sorry.
1461 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1462 # argument list will get too long. Using .for/.endfor make "loops" will make
1463 # the Makefile parser segfault.
1465 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1466 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1467 while read file; do \
1468 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1469 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1470 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1473 # Remove catpages without corresponding manpages.
1475 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1476 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1477 while read catpage; do \
1479 if [ ! -e "$${manpage}" ]; then \
1480 rm ${RM_I} $${catpage} <&3; \
1483 @echo ">>> Old files removed"
1486 @echo ">>> Checking for old files"
1487 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1488 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1489 while read file; do \
1490 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1491 echo "${DESTDIR}/$${file}"; \
1494 # Check for catpages without corresponding manpages.
1495 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1496 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1497 while read catpage; do \
1499 if [ ! -e "$${manpage}" ]; then \
1505 @echo ">>> Removing old libraries"
1506 @echo "${OLD_LIBS_MESSAGE}" | fmt
1508 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1509 -V OLD_LIBS | xargs -n1 | \
1510 while read file; do \
1511 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1512 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1513 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1516 @echo ">>> Old libraries removed"
1519 @echo ">>> Checking for old libraries"
1520 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1521 -V OLD_LIBS | xargs -n1 | \
1522 while read file; do \
1523 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1524 echo "${DESTDIR}/$${file}"; \
1529 @echo ">>> Removing old directories"
1530 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1531 -V OLD_DIRS | xargs -n1 | \
1532 while read dir; do \
1533 if [ -d "${DESTDIR}/$${dir}" ]; then \
1534 rmdir -v "${DESTDIR}/$${dir}" || true; \
1535 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1536 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1539 @echo ">>> Old directories removed"
1542 @echo ">>> Checking for old directories"
1543 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1544 -V OLD_DIRS | xargs -n1 | \
1545 while read dir; do \
1546 if [ -d "${DESTDIR}/$${dir}" ]; then \
1547 echo "${DESTDIR}/$${dir}"; \
1548 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1549 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1553 delete-old: delete-old-files delete-old-dirs
1554 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1556 check-old: check-old-files check-old-libs check-old-dirs
1557 @echo "To remove old files and directories run '${MAKE} delete-old'."
1558 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1563 # showconfig - show build configuration.
1566 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1568 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1569 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1571 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1572 .if exists(${KERNCONFDIR}/${KERNCONF})
1573 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1574 ${KERNCONFDIR}/${KERNCONF} ; echo
1580 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1581 DTBOUTPUTPATH= ${.CURDIR}
1585 # Build 'standalone' Device Tree Blob
1588 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1589 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1592 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1593 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1597 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1598 echo "WARNING: DTB will be placed in the current working \
1603 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1604 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1608 .if defined(XDEV) && defined(XDEV_ARCH)
1610 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1611 XDEV_CPUTYPE?=${CPUTYPE}
1613 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1616 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1617 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \
1618 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1619 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1620 CPUTYPE=${XDEV_CPUTYPE}
1622 XDDIR=${XDEV_ARCH}-freebsd
1624 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR}
1626 _SHLIBDIRPREFIX=${XDTP} \
1627 TOOLS_PREFIX=${XDTP}
1629 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1631 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1632 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1633 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1634 XDDESTDIR=${DESTDIR}${XDTP}
1636 OSREL!= uname -r | sed -e 's/[-(].*//'
1639 .ORDER: xdev-build xdev-install
1640 xdev: xdev-build xdev-install
1642 .ORDER: _xb-build-tools _xb-cross-tools
1643 xdev-build: _xb-build-tools _xb-cross-tools
1646 ${_+_}@cd ${.CURDIR}; \
1647 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1651 gnu/usr.bin/binutils \
1654 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1655 cd ${.CURDIR}/${_tool}; \
1656 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1657 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1658 ${CDMAKE} DIRPRFX=${_tool}/ all
1662 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1663 mkdir -p ${XDDESTDIR}
1664 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1665 -p ${XDDESTDIR} >/dev/null
1666 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1667 -p ${XDDESTDIR}/usr >/dev/null
1668 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1669 -p ${XDDESTDIR}/usr/include >/dev/null
1671 .ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1672 xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1675 @echo "_xi-cross-tools"
1677 gnu/usr.bin/binutils \
1680 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1681 cd ${.CURDIR}/${_tool}; \
1682 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1686 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1687 DESTDIR=${XDDESTDIR}
1690 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1691 DESTDIR=${XDDESTDIR}
1694 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1696 ln -sf ../../${XDTP}/usr/bin/$$i \
1697 ../../../../usr/bin/${XDDIR}-$$i; \
1698 ln -sf ../../${XDTP}/usr/bin/$$i \
1699 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
1702 xdev xdev-buil xdev-install:
1703 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target"