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_CTF do not run the DTrace CTF conversion tools on built objects
16 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
17 # TARGET="machine" to crossbuild world for a different machine type
18 # TARGET_ARCH= may be required when a TARGET supports multiple endians
21 # The intended user-driven targets are:
22 # buildworld - rebuild *everything*, including glue to help do upgrades
23 # installworld- install everything built by "buildworld"
24 # doxygen - build API documentation of the kernel
25 # update - convenient way to update your source tree (eg: cvsup/cvs)
27 # Standard targets (not defined here) are documented in the makefiles in
28 # /usr/share/mk. These include:
29 # obj depend all install clean cleandepend cleanobj
31 # You are supposed to define both of these when calling Makefile.inc1
32 # directly. However, some old scripts don't. Cope for the moment, but
33 # issue a new warning for a transition period.
34 .if defined(TARGET) && !defined(TARGET_ARCH)
35 .warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}."
38 .if !defined(TARGET) || !defined(TARGET_ARCH)
39 .error "Both TARGET and TARGET_ARCH must be defined."
43 .include <bsd.arch.inc.mk>
44 .include <bsd.compiler.mk>
46 # We must do share/info early so that installation of info `dir'
47 # entries works correctly. Do it first since it is less likely to
48 # grow dependencies on include and lib than vice versa.
50 # We must do lib/ and libexec/ before bin/, because if installworld
51 # installs a new /bin/sh, the 'make' command will *immediately*
52 # use that new version. And the new (dynamically-linked) /bin/sh
53 # will expect to find appropriate libraries in /lib and /libexec.
55 SUBDIR= share/info lib libexec
57 .if ${MK_GAMES} != "no"
60 .if ${MK_CDDL} != "no"
64 .if ${MK_KERBEROS} != "no"
67 .if ${MK_RESCUE} != "no"
71 .if ${MK_CRYPT} != "no"
74 .if !defined(NO_SHARE)
77 SUBDIR+=sys usr.bin usr.sbin
78 .if ${MK_OFED} != "no"
82 # We must do etc/ last for install/distribute to work.
86 # These are last, since it is nice to at least get the base system
87 # rebuilt before you do them.
88 .for _DIR in ${LOCAL_DIRS}
89 .if exists(${.CURDIR}/${_DIR}/Makefile)
94 .if defined(SUBDIR_OVERRIDE)
95 SUBDIR= ${SUBDIR_OVERRIDE}
101 .if defined(NO_CLEANDIR)
102 CLEANDIR= clean cleandepend
108 CVSFLAGS?= -A -P -d -I!
114 SUPFLAGS+= -h ${SUPHOST}
117 MAKEOBJDIRPREFIX?= /usr/obj
118 .if !defined(OSRELDATE)
119 .if exists(/usr/include/osreldate.h)
120 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
121 /usr/include/osreldate.h
127 .if !defined(VERSION)
129 VERSION+= ${OSRELDATE}
132 KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64
133 .if ${TARGET} == ${TARGET_ARCH}
136 _t= ${TARGET_ARCH}/${TARGET}
139 .if empty(KNOWN_ARCHES:M${_t})
140 .error Unknown target ${TARGET_ARCH}:${TARGET}.
144 .if ${TARGET} == ${MACHINE}
145 TARGET_CPUTYPE?=${CPUTYPE}
150 .if !empty(TARGET_CPUTYPE)
151 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
153 _TARGET_CPUTYPE=dummy
155 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
156 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
157 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
158 .error CPUTYPE global should be set with ?=.
161 BUILD_ARCH!= uname -p
162 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
163 .error To cross-build, set TARGET_ARCH.
166 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
167 OBJTREE= ${MAKEOBJDIRPREFIX}
169 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
171 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
172 # /usr/games added for fortune which depend on strfile
173 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
174 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
175 STRICTTMPPATH= ${BPATH}:${XPATH}
176 TMPPATH= ${STRICTTMPPATH}:${PATH}
179 # Avoid running mktemp(1) unless actually needed.
180 # It may not be functional, e.g., due to new ABI
181 # when in the middle of installing over this system.
183 .if make(distributeworld) || make(installworld)
184 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
188 # Building a world goes through the following stages
190 # 1. legacy stage [BMAKE]
191 # This stage is responsible for creating compatibility
192 # shims that are needed by the bootstrap-tools,
193 # build-tools and cross-tools stages.
194 # 1. bootstrap-tools stage [BMAKE]
195 # This stage is responsible for creating programs that
196 # are needed for backward compatibility reasons. They
197 # are not built as cross-tools.
198 # 2. build-tools stage [TMAKE]
199 # This stage is responsible for creating the object
200 # tree and building any tools that are needed during
202 # 3. cross-tools stage [XMAKE]
203 # This stage is responsible for creating any tools that
204 # are needed for cross-builds. A cross-compiler is one
206 # 4. world stage [WMAKE]
207 # This stage actually builds the world.
208 # 5. install stage (optional) [IMAKE]
209 # This stage installs a previously built world.
214 # Common environment for world related stages
215 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
216 MACHINE_ARCH=${TARGET_ARCH} \
218 CPUTYPE=${TARGET_CPUTYPE}
219 .if ${OSRELDATE} < 700044
220 CROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib
222 .if ${MK_GROFF} != "no"
223 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
224 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
225 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
228 # bootstrap-tools stage
229 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
230 PATH=${BPATH}:${PATH} \
231 WORLDTMP=${WORLDTMP} \
232 VERSION="${VERSION}" \
233 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
234 COMPILER_TYPE=${COMPILER_TYPE}
235 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
236 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
238 BOOTSTRAPPING=${OSRELDATE} \
240 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
241 -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
242 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
245 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
246 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
247 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
249 BOOTSTRAPPING=${OSRELDATE} \
252 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
255 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
256 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
260 WMAKEENV= ${CROSSENV} \
261 _SHLIBDIRPREFIX=${WORLDTMP} \
263 VERSION="${VERSION}" \
264 INSTALL="sh ${.CURDIR}/tools/install.sh" \
266 .if ${MK_CDDL} == "no"
269 .if ${CC:T:Mgcc} == "gcc"
270 WMAKE_COMPILER_TYPE= gcc
271 .elif ${CC:T:Mclang} == "clang"
272 WMAKE_COMPILER_TYPE= clang
273 .elif ${MK_CLANG_IS_CC} == "no"
274 WMAKE_COMPILER_TYPE= gcc
276 WMAKE_COMPILER_TYPE= clang
278 WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
279 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
281 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
283 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
285 .if ${TARGET_ARCH} == "amd64"
286 .if empty(TARGET_CPUTYPE)
287 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
289 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
291 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
292 MACHINE_CPU="i686 mmx sse sse2" \
293 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
296 .elif ${TARGET_ARCH} == "powerpc64"
297 .if empty(TARGET_CPUTYPE)
298 LIB32CPUFLAGS= -mcpu=powerpc
300 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
302 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \
303 LD="${LD} -m elf32ppc"
307 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
308 -isystem ${LIB32TMP}/usr/include/ \
309 -L${LIB32TMP}/usr/lib32 \
310 -B${LIB32TMP}/usr/lib32
312 # Yes, the flags are redundant.
313 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
314 _SHLIBDIRPREFIX=${LIB32TMP} \
315 _LDSCRIPTROOT=${LIB32TMP} \
316 VERSION="${VERSION}" \
317 INSTALL="sh ${.CURDIR}/tools/install.sh" \
319 CC="${CC} ${LIB32FLAGS}" \
320 CXX="${CXX} ${LIB32FLAGS}" \
322 SHLIBDIR=/usr/lib32 \
323 COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
325 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
326 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
327 -DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
329 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
333 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
334 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
335 .if empty(.MAKEFLAGS:M-n)
336 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
337 LD_LIBRARY_PATH=${INSTALLTMP} \
338 PATH_LOCALE=${INSTALLTMP}/locale
339 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
341 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
345 KMAKEENV= ${WMAKEENV}
346 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
351 # Attempt to rebuild the entire system, with reasonable chance of
352 # success, regardless of how old your existing system is.
355 .if ${.CURDIR:C/[^,]//g} != ""
356 # The m4 build of sendmail files doesn't like it if ',' is used
357 # anywhere in the path of it's files.
359 @echo "*** Error: path to source tree contains a comma ','"
364 @echo "--------------------------------------------------------------"
365 @echo ">>> Rebuilding the temporary build tree"
366 @echo "--------------------------------------------------------------"
367 .if !defined(NO_CLEAN)
369 .if defined(LIB32TMP)
373 rm -rf ${WORLDTMP}/legacy/usr/include
374 # XXX - These three can depend on any header file.
375 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
376 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
377 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
381 mkdir -p ${WORLDTMP}/${_dir}
383 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
384 -p ${WORLDTMP}/legacy/usr >/dev/null
385 .if ${MK_GROFF} != "no"
386 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
387 -p ${WORLDTMP}/legacy/usr >/dev/null
389 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
390 -p ${WORLDTMP}/usr >/dev/null
391 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
392 -p ${WORLDTMP}/usr/include >/dev/null
393 ln -sf ${.CURDIR}/sys ${WORLDTMP}
394 .if ${MK_BIND_LIBS} != "no"
395 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
396 -p ${WORLDTMP}/usr/include >/dev/null
400 @echo "--------------------------------------------------------------"
401 @echo ">>> stage 1.1: legacy release compatibility shims"
402 @echo "--------------------------------------------------------------"
403 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
406 @echo "--------------------------------------------------------------"
407 @echo ">>> stage 1.2: bootstrap tools"
408 @echo "--------------------------------------------------------------"
409 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
411 .if !defined(NO_CLEAN)
413 @echo "--------------------------------------------------------------"
414 @echo ">>> stage 2.1: cleaning up the object tree"
415 @echo "--------------------------------------------------------------"
416 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
417 .if defined(LIB32TMP)
418 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
423 @echo "--------------------------------------------------------------"
424 @echo ">>> stage 2.2: rebuilding the object tree"
425 @echo "--------------------------------------------------------------"
426 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
429 @echo "--------------------------------------------------------------"
430 @echo ">>> stage 2.3: build tools"
431 @echo "--------------------------------------------------------------"
432 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
435 @echo "--------------------------------------------------------------"
436 @echo ">>> stage 3: cross tools"
437 @echo "--------------------------------------------------------------"
438 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
441 @echo "--------------------------------------------------------------"
442 @echo ">>> stage 4.1: building includes"
443 @echo "--------------------------------------------------------------"
444 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
447 @echo "--------------------------------------------------------------"
448 @echo ">>> stage 4.2: building libraries"
449 @echo "--------------------------------------------------------------"
450 ${_+_}cd ${.CURDIR}; \
451 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
452 -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
455 @echo "--------------------------------------------------------------"
456 @echo ">>> stage 4.3: make dependencies"
457 @echo "--------------------------------------------------------------"
458 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
461 @echo "--------------------------------------------------------------"
462 @echo ">>> stage 4.4: building everything"
463 @echo "--------------------------------------------------------------"
464 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
465 .if defined(LIB32TMP)
468 @echo "--------------------------------------------------------------"
469 @echo ">>> stage 5.1: building 32 bit shim libraries"
470 @echo "--------------------------------------------------------------"
471 mkdir -p ${LIB32TMP}/usr/include
472 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
473 -p ${LIB32TMP}/usr >/dev/null
474 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
475 -p ${LIB32TMP}/usr/include >/dev/null
477 ln -sf ${.CURDIR}/sys ${WORLDTMP}
478 .if ${MK_KERBEROS} != "no"
479 .for _t in obj depend all
480 cd ${.CURDIR}/kerberos5/tools; \
481 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
482 DIRPRFX=kerberos5/tools/ ${_t}
485 .for _t in obj includes
486 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
487 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
488 .if ${MK_CDDL} != "no"
489 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
491 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
492 .if ${MK_CRYPT} != "no"
493 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
495 .if ${MK_KERBEROS} != "no"
496 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
499 .for _dir in usr.bin/lex/lib
500 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
502 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
503 cd ${.CURDIR}/${_dir}; \
504 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
505 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
506 -DEARLY_BUILD build-tools
509 ${LIB32WMAKE} -f Makefile.inc1 libraries
510 .for _t in obj depend all
511 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
512 DIRPRFX=libexec/rtld-elf/ ${_t}
513 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
514 DIRPRFX=usr.bin/ldd ${_t}
517 distribute32 install32:
518 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
519 .if ${MK_CDDL} != "no"
520 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
522 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
523 .if ${MK_CRYPT} != "no"
524 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
526 .if ${MK_KERBEROS} != "no"
527 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
529 cd ${.CURDIR}/libexec/rtld-elf; \
530 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
531 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
535 .if !defined(SUBDIR_OVERRIDE)
536 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
538 WMAKE_TGTS+= _cleanobj _obj _build-tools
539 .if !defined(SUBDIR_OVERRIDE)
540 WMAKE_TGTS+= _cross-tools
542 WMAKE_TGTS+= _includes _libraries _depend everything
543 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
547 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
548 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
551 @echo "--------------------------------------------------------------"
552 @echo ">>> World build started on `LC_ALL=C date`"
553 @echo "--------------------------------------------------------------"
557 @echo "--------------------------------------------------------------"
558 @echo ">>> World build completed on `LC_ALL=C date`"
559 @echo "--------------------------------------------------------------"
562 # We need to have this as a target because the indirection between Makefile
563 # and Makefile.inc1 causes the correct PATH to be used, rather than a
564 # modification of the current environment's PATH. In addition, we need
565 # to quote multiword values.
571 @echo Entering world for ${TARGET_ARCH}:${TARGET}
572 @cd ${.CURDIR} && env ${WMAKEENV} sh || true
574 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
575 toolchain: ${TOOLCHAIN_TGTS}
576 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
581 # Checks to be sure system is ready for installworld/installkernel.
586 # Require DESTDIR to be set if installing for a different architecture.
588 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
589 .if !make(distributeworld)
590 installcheck: installcheck_DESTDIR
591 installcheck_DESTDIR:
592 .if !defined(DESTDIR) || empty(DESTDIR)
593 @echo "ERROR: Please set DESTDIR!"; \
600 # Check for missing UIDs/GIDs.
602 CHECK_UIDS= auditdistd
604 .if ${MK_SENDMAIL} != "no"
610 CHECK_GIDS+= proxy authpf
612 installcheck: installcheck_UGID
614 .for uid in ${CHECK_UIDS}
615 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
616 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
620 .for gid in ${CHECK_GIDS}
621 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
622 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
628 # Required install tools to be saved in a scratch dir for safety.
630 .if ${MK_INFO} != "no"
631 _install-info= install-info
633 .if ${MK_ZONEINFO} != "no"
634 _zoneinfo= zic tzsetup
637 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
638 date echo egrep find grep ${_install-info} \
639 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
640 test true uname wc ${_zoneinfo}
645 # Distributes everything compiled by a `buildworld'.
649 # Installs everything compiled by a 'buildworld'.
652 # Non-base distributions produced by the base system
653 EXTRA_DISTRIBUTIONS= doc
654 .if ${MK_GAMES} != "no"
655 EXTRA_DISTRIBUTIONS+= games
657 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
658 EXTRA_DISTRIBUTIONS+= lib32
661 distributeworld installworld: installcheck
662 mkdir -p ${INSTALLTMP}
663 progs=$$(for prog in ${ITOOLS}; do \
664 if progpath=`which $$prog`; then \
667 echo "Required tool $$prog not found in PATH." >&2; \
671 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
672 while read line; do \
674 if [ "$$2 $$3" != "not found" ]; then \
677 echo "Required library $$1 not found." >&2; \
681 cp $$libs $$progs ${INSTALLTMP}
682 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
683 .if make(distributeworld)
684 .for dist in ${EXTRA_DISTRIBUTIONS}
685 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
686 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
687 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
688 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
689 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
690 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
691 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
693 -mkdir ${DESTDIR}/${DISTDIR}/base
694 ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
695 DESTDIR=${DESTDIR}/${DISTDIR}/base
697 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
698 ${IMAKEENV} rm -rf ${INSTALLTMP}
699 .if make(distributeworld)
700 .for dist in ${EXTRA_DISTRIBUTIONS}
701 find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
706 .for dist in base ${EXTRA_DISTRIBUTIONS}
707 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
708 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
714 # If you have a build server, you can NFS mount the source and obj directories
715 # and do a 'make reinstall' on the *client* to install new binaries from the
716 # most recent server build.
719 @echo "--------------------------------------------------------------"
720 @echo ">>> Making hierarchy"
721 @echo "--------------------------------------------------------------"
722 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
724 @echo "--------------------------------------------------------------"
725 @echo ">>> Installing everything"
726 @echo "--------------------------------------------------------------"
727 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
728 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
729 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
733 @echo "--------------------------------------------------------------"
734 @echo ">>> Distributing everything"
735 @echo "--------------------------------------------------------------"
736 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
737 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
738 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
742 distrib-dirs distribution:
743 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
746 # buildkernel and installkernel
748 # Which kernels to build and/or install is specified by setting
749 # KERNCONF. If not defined a GENERIC kernel is built/installed.
750 # Only the existing (depending TARGET) config files are used
751 # for building kernels and only the first of these is designated
752 # as the one being installed.
754 # Note that we have to use TARGET instead of TARGET_ARCH when
755 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
756 # be set to cross-build, we have to make sure TARGET is set
759 .if defined(KERNFAST)
764 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
765 .if !defined(KERNCONF) && ${KERNFAST} != "1"
769 .if !defined(KERNCONF) && defined(KERNEL)
773 .if ${TARGET_ARCH} == "powerpc64"
779 INSTKERNNAME?= kernel
781 KERNSRCDIR?= ${.CURDIR}/sys
782 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
783 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
784 KERNCONFDIR?= ${KRNLCONFDIR}
788 .for _kernel in ${KERNCONF}
789 .if exists(${KERNCONFDIR}/${_kernel})
790 BUILDKERNELS+= ${_kernel}
791 .if empty(INSTALLKERNEL)
792 INSTALLKERNEL= ${_kernel}
800 # Builds all kernels defined by BUILDKERNELS.
803 .if empty(BUILDKERNELS)
804 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
807 .if defined(KERNWARN)
808 @echo "--------------------------------------------------------------"
809 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
810 @echo "--------------------------------------------------------------"
814 .for _kernel in ${BUILDKERNELS}
815 @echo "--------------------------------------------------------------"
816 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
817 @echo "--------------------------------------------------------------"
818 @echo "===> ${_kernel}"
819 mkdir -p ${KRNLOBJDIR}
820 .if !defined(NO_KERNELCONFIG)
822 @echo "--------------------------------------------------------------"
823 @echo ">>> stage 1: configuring the kernel"
824 @echo "--------------------------------------------------------------"
827 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
828 ${KERNCONFDIR}/${_kernel}
830 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
832 @echo "--------------------------------------------------------------"
833 @echo ">>> stage 2.1: cleaning up the object tree"
834 @echo "--------------------------------------------------------------"
835 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
837 .if !defined(NO_KERNELOBJ)
839 @echo "--------------------------------------------------------------"
840 @echo ">>> stage 2.2: rebuilding the object tree"
841 @echo "--------------------------------------------------------------"
842 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
845 @echo "--------------------------------------------------------------"
846 @echo ">>> stage 2.3: build tools"
847 @echo "--------------------------------------------------------------"
848 cd ${KRNLOBJDIR}/${_kernel}; \
849 PATH=${BPATH}:${PATH} \
850 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
851 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
852 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
853 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
854 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
855 .for target in obj depend all
856 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
857 PATH=${BPATH}:${PATH} \
858 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
859 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
862 .if !defined(NO_KERNELDEPEND)
864 @echo "--------------------------------------------------------------"
865 @echo ">>> stage 3.1: making dependencies"
866 @echo "--------------------------------------------------------------"
867 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
870 @echo "--------------------------------------------------------------"
871 @echo ">>> stage 3.2: building everything"
872 @echo "--------------------------------------------------------------"
873 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
874 @echo "--------------------------------------------------------------"
875 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
876 @echo "--------------------------------------------------------------"
880 # installkernel, etc.
882 # Install the kernel defined by INSTALLKERNEL
884 installkernel installkernel.debug \
885 reinstallkernel reinstallkernel.debug: installcheck
886 .if empty(INSTALLKERNEL)
887 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
890 @echo "--------------------------------------------------------------"
891 @echo ">>> Installing kernel ${INSTALLKERNEL}"
892 @echo "--------------------------------------------------------------"
893 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
894 ${CROSSENV} PATH=${TMPPATH} \
895 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
897 distributekernel distributekernel.debug:
898 .if empty(INSTALLKERNEL)
899 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
902 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
903 ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
904 DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
905 ${.TARGET:S/distributekernel/install/}
906 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
907 cd ${KRNLOBJDIR}/${_kernel}; \
908 ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
909 KERNEL=${INSTKERNNAME}.${_kernel} \
910 DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
911 ${.TARGET:S/distributekernel/install/}
915 cd ${DESTDIR}/${DISTDIR}/kernel; \
916 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
917 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
918 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
919 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
925 # Build the API documentation with doxygen
928 @if [ ! -x `/usr/bin/which doxygen` ]; then \
929 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
932 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
937 # Update the source tree(s), by running cvsup/cvs/svn to update to the
941 .if defined(SUP_UPDATE)
942 @echo "--------------------------------------------------------------"
943 @echo ">>> Running ${SUP}"
944 @echo "--------------------------------------------------------------"
945 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
946 @echo "!! Update methods with ${SUP} are deprecated."
947 @echo "!! Please see http://www.freebsd.org/handbook/svn.html"
948 @echo "!! and convert your update method to SVN_UPDATE or"
949 @echo "!! freebsd-update(8)."
950 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
953 @${SUP} ${SUPFLAGS} ${SUPFILE}
955 .if defined(SUPFILE1)
956 @${SUP} ${SUPFLAGS} ${SUPFILE1}
958 .if defined(SUPFILE2)
959 @${SUP} ${SUPFLAGS} ${SUPFILE2}
961 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
962 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
964 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
965 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
968 .if defined(CVS_UPDATE)
970 if [ -d CVS ] ; then \
971 echo "--------------------------------------------------------------" ; \
972 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
973 echo "--------------------------------------------------------------" ; \
974 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
975 echo "!! Update methods with CVS are deprecated." ; \
976 echo "!! Please see http://www.freebsd.org/handbook/svn.html" ; \
977 echo "!! and convert your update method to SVN_UPDATE or" ; \
978 echo "!! freebsd-update(8)." ; \
979 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
981 echo ${CVS} -R -q update ${CVSFLAGS} ; \
982 ${CVS} -R -q update ${CVSFLAGS} ; \
985 .if defined(SVN_UPDATE)
987 if [ -d .svn ] ; then \
988 echo "--------------------------------------------------------------" ; \
989 echo ">>> Updating ${.CURDIR} using Subversion" ; \
990 echo "--------------------------------------------------------------" ; \
991 echo ${SVN} update ${SVNFLAGS} ; \
992 ${SVN} update ${SVNFLAGS} ; \
997 # ------------------------------------------------------------------------
999 # From here onwards are utility targets used by the 'make world' and
1000 # related targets. If your 'world' breaks, you may like to try to fix
1001 # the problem and manually run the following targets to attempt to
1002 # complete the build. Beware, this is *not* guaranteed to work, you
1003 # need to have a pretty good grip on the current state of the system
1004 # to attempt to manually finish it. If in doubt, 'make world' again.
1008 # legacy: Build compatibility shims for the next three targets
1011 .if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0
1012 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \
1015 .for _tool in tools/build
1016 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1017 cd ${.CURDIR}/${_tool}; \
1018 ${MAKE} DIRPRFX=${_tool}/ obj; \
1019 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
1020 ${MAKE} DIRPRFX=${_tool}/ depend; \
1021 ${MAKE} DIRPRFX=${_tool}/ all; \
1022 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1026 # bootstrap-tools: Build tools needed for compatibility
1028 .if ${MK_GAMES} != "no"
1029 _strfile= games/fortune/strfile
1032 .if ${MK_CXX} != "no"
1033 _gperf= gnu/usr.bin/gperf
1036 .if ${MK_GROFF} != "no"
1037 _groff= gnu/usr.bin/groff
1040 .if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022
1044 .if ${BOOTSTRAPPING} < 800013
1045 _mklocale= usr.bin/mklocale
1048 .if ${BOOTSTRAPPING} < 900002
1052 .if ${BOOTSTRAPPING} < 900006
1056 .if ${BOOTSTRAPPING} < 900006 || ${BOOTSTRAPPING} >= 1000013
1060 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1064 .if ${MK_BSNMP} != "no" && \
1065 (${BOOTSTRAPPING} < 700018 || !exists(/usr/sbin/gensnmptree))
1066 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1069 .if ${MK_RESCUE} != "no" && \
1070 ${BOOTSTRAPPING} < 700026
1071 _crunchgen= usr.sbin/crunch/crunchgen
1074 .if ${MK_CLANG} != "no"
1076 lib/clang/libllvmsupport \
1077 lib/clang/libllvmtablegen \
1078 usr.bin/clang/tblgen \
1079 usr.bin/clang/clang-tblgen
1082 .if ${MK_CDDL} != "no" && \
1083 ${BOOTSTRAPPING} < 800038 && \
1084 !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)
1085 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1086 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1089 .if ${MK_FDT} != "no"
1090 _dtc= gnu/usr.bin/dtc
1093 # Please document (add comment) why something is in 'bootstrap-tools'.
1094 # Try to bound the building of the bootstrap-tool to just the
1095 # FreeBSD versions that need the tool built at this stage of the build.
1107 usr.bin/makewhatis \
1117 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1118 cd ${.CURDIR}/${_tool}; \
1119 ${MAKE} DIRPRFX=${_tool}/ obj; \
1120 ${MAKE} DIRPRFX=${_tool}/ depend; \
1121 ${MAKE} DIRPRFX=${_tool}/ all; \
1122 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1126 # build-tools: Build special purpose build tools
1128 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
1129 _aicasm= sys/modules/aic7xxx/aicasm
1132 .if !defined(NO_SHARE)
1133 _share= share/syscons/scrnmaps
1136 .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1137 _gcc_tools= gnu/usr.bin/cc/cc_tools
1140 .if ${MK_KERBEROS} != "no"
1141 _kerberos5_tools= kerberos5/tools
1144 .if ${MK_RESCUE} != "no"
1145 _rescue= rescue/rescue
1153 lib/ncurses/ncurses \
1154 lib/ncurses/ncursesw \
1159 usr.sbin/sysinstall \
1160 usr.bin/mkesdb_static \
1161 usr.bin/mkcsmapper_static
1162 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1163 cd ${.CURDIR}/${_tool}; \
1164 ${MAKE} DIRPRFX=${_tool}/ obj; \
1165 ${MAKE} DIRPRFX=${_tool}/ build-tools
1170 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1171 cd ${.CURDIR}/${_tool}; \
1172 ${MAKE} DIRPRFX=${_tool}/ obj; \
1173 ${MAKE} DIRPRFX=${_tool}/ depend; \
1174 ${MAKE} DIRPRFX=${_tool}/ all
1178 # cross-tools: Build cross-building tools
1180 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1181 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1182 _btxld= usr.sbin/btxld
1185 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1186 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1187 _crunchide= usr.sbin/crunch/crunchide
1189 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1190 _kgzip= usr.sbin/kgzip
1194 .if ${MK_BINUTILS} != "no"
1195 _binutils= gnu/usr.bin/binutils
1198 .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1199 _clang= usr.bin/clang
1200 _clang_libs= lib/clang
1203 .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1213 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1217 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1218 cd ${.CURDIR}/${_tool}; \
1219 ${MAKE} DIRPRFX=${_tool}/ obj; \
1220 ${MAKE} DIRPRFX=${_tool}/ depend; \
1221 ${MAKE} DIRPRFX=${_tool}/ all; \
1222 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1226 # hierarchy - ensure that all the needed directories are present
1229 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
1232 # libraries - build all libraries, and install them under ${DESTDIR}.
1234 # The list of libraries with dependents (${_prebuild_libs}) and their
1235 # interdependencies (__L) are built automatically by the
1236 # ${.CURDIR}/tools/make_libdeps.sh script.
1240 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1241 ${MAKE} -f Makefile.inc1 _startup_libs; \
1242 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1243 ${MAKE} -f Makefile.inc1 _generic_libs;
1246 # static libgcc.a prerequisite for shared libc
1248 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1250 # These dependencies are not automatically generated:
1252 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1253 # all shared libraries for ELF.
1255 _startup_libs= gnu/lib/csu
1256 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1257 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1258 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1259 _startup_libs+= lib/csu/${MACHINE_ARCH}
1261 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1263 _startup_libs+= gnu/lib/libgcc
1264 _startup_libs+= lib/libcompiler_rt
1265 _startup_libs+= lib/libc
1266 .if ${MK_LIBCPLUSPLUS} != "no"
1267 _startup_libs+= lib/libcxxrt
1270 gnu/lib/libgcc__L: lib/libc__L
1271 .if ${MK_LIBCPLUSPLUS} != "no"
1272 lib/libcxxrt__L: gnu/lib/libgcc__L
1275 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \
1276 ${_kerberos5_lib_libheimntlm} \
1277 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1278 ${_kerberos5_lib_libroken} \
1279 lib/libbz2 lib/libcom_err lib/libcrypt \
1281 ${_lib_libgssapi} ${_lib_libipx} \
1282 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1283 lib/ncurses/ncurses lib/ncurses/ncursesw \
1284 lib/libopie lib/libpam ${_lib_libthr} \
1285 lib/libradius lib/libsbuf lib/libtacplus \
1286 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1287 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1288 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1289 ${_secure_lib_libssl}
1291 .if ${MK_LIBTHR} != "no"
1292 _lib_libthr= lib/libthr
1295 .if ${MK_OFED} != "no"
1296 _ofed_lib= contrib/ofed/usr.lib/
1299 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1301 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1303 .if ${MK_CDDL} != "no"
1304 _cddl_lib_libumem= cddl/lib/libumem
1305 _cddl_lib_libnvpair= cddl/lib/libnvpair
1309 .if ${MK_CRYPT} != "no"
1310 .if ${MK_OPENSSL} != "no"
1311 _secure_lib_libcrypto= secure/lib/libcrypto
1312 _secure_lib_libssl= secure/lib/libssl
1313 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1314 .if ${MK_OPENSSH} != "no"
1315 _secure_lib_libssh= secure/lib/libssh
1316 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1317 .if ${MK_KERBEROS_SUPPORT} != "no"
1318 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1319 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1320 lib/libmd__L kerberos5/lib/libroken__L
1324 _secure_lib= secure/lib
1327 .if ${MK_KERBEROS} != "no"
1328 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1329 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1330 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L
1331 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L
1332 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1333 secure/lib/libcrypto__L kerberos5/lib/libroken__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
1337 kerberos5/lib/libroken__L: lib/libcrypt__L
1340 .if ${MK_GSSAPI} != "no"
1341 _lib_libgssapi= lib/libgssapi
1344 .if ${MK_IPX} != "no"
1345 _lib_libipx= lib/libipx
1348 .if ${MK_KERBEROS} != "no"
1349 _kerberos5_lib= kerberos5/lib
1350 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1351 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1352 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1353 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1354 _kerberos5_lib_libroken= kerberos5/lib/libroken
1355 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1358 .if ${MK_NIS} != "no"
1359 _lib_libypclnt= lib/libypclnt
1362 .if ${MK_OPENSSL} == "no"
1363 lib/libradius__L: lib/libmd__L
1366 .for _lib in ${_prereq_libs}
1368 .if exists(${.CURDIR}/${_lib})
1369 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1370 cd ${.CURDIR}/${_lib}; \
1371 ${MAKE} DIRPRFX=${_lib}/ obj; \
1372 ${MAKE} DIRPRFX=${_lib}/ depend; \
1373 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1374 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1378 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1380 .if exists(${.CURDIR}/${_lib})
1381 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1382 cd ${.CURDIR}/${_lib}; \
1383 ${MAKE} DIRPRFX=${_lib}/ obj; \
1384 ${MAKE} DIRPRFX=${_lib}/ depend; \
1385 ${MAKE} DIRPRFX=${_lib}/ all; \
1386 ${MAKE} DIRPRFX=${_lib}/ install
1390 # libpam is special: we need to build static PAM modules before
1391 # static PAM library, and dynamic PAM library before dynamic PAM
1393 lib/libpam__L: .PHONY
1394 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1395 cd ${.CURDIR}/lib/libpam; \
1396 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1397 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1398 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1399 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1401 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1402 _startup_libs: ${_startup_libs:S/$/__L/}
1403 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1404 _generic_libs: ${_generic_libs:S/$/__L/}
1406 .for __target in all clean cleandepend cleandir depend includes obj
1407 .for entry in ${SUBDIR}
1408 ${entry}.${__target}__D: .PHONY
1409 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1410 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1411 edir=${entry}.${MACHINE_ARCH}; \
1412 cd ${.CURDIR}/$${edir}; \
1414 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1416 cd ${.CURDIR}/$${edir}; \
1418 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1420 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1423 .include <bsd.subdir.mk>
1425 .if make(check-old) || make(check-old-dirs) || \
1426 make(check-old-files) || make(check-old-libs) || \
1427 make(delete-old) || make(delete-old-dirs) || \
1428 make(delete-old-files) || make(delete-old-libs)
1431 # check for / delete old files section
1434 .include "ObsoleteFiles.inc"
1436 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1437 else you can not start such an application. Consult UPDATING for more \
1438 information regarding how to cope with the removal/revision bump of a \
1441 .if !defined(BATCH_DELETE_OLD_FILES)
1448 @echo ">>> Removing old files (only deletes safe to delete libs)"
1449 # Ask for every old file if the user really wants to remove it.
1450 # It's annoying, but better safe than sorry.
1451 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1452 # argument list will get too long. Using .for/.endfor make "loops" will make
1453 # the Makefile parser segfault.
1455 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1456 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1457 while read file; do \
1458 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1459 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1460 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1463 # Remove catpages without corresponding manpages.
1465 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1466 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1467 while read catpage; do \
1469 if [ ! -e "$${manpage}" ]; then \
1470 rm ${RM_I} $${catpage} <&3; \
1473 @echo ">>> Old files removed"
1476 @echo ">>> Checking for old files"
1477 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1478 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1479 while read file; do \
1480 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1481 echo "${DESTDIR}/$${file}"; \
1484 # Check for catpages without corresponding manpages.
1485 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1486 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1487 while read catpage; do \
1489 if [ ! -e "$${manpage}" ]; then \
1495 @echo ">>> Removing old libraries"
1496 @echo "${OLD_LIBS_MESSAGE}" | fmt
1498 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1499 -V OLD_LIBS | xargs -n1 | \
1500 while read file; do \
1501 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1502 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1503 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1506 @echo ">>> Old libraries removed"
1509 @echo ">>> Checking for old libraries"
1510 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1511 -V OLD_LIBS | xargs -n1 | \
1512 while read file; do \
1513 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1514 echo "${DESTDIR}/$${file}"; \
1519 @echo ">>> Removing old directories"
1520 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1521 -V OLD_DIRS | xargs -n1 | \
1522 while read dir; do \
1523 if [ -d "${DESTDIR}/$${dir}" ]; then \
1524 rmdir -v "${DESTDIR}/$${dir}" || true; \
1525 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1526 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1529 @echo ">>> Old directories removed"
1532 @echo ">>> Checking for old directories"
1533 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1534 -V OLD_DIRS | xargs -n1 | \
1535 while read dir; do \
1536 if [ -d "${DESTDIR}/$${dir}" ]; then \
1537 echo "${DESTDIR}/$${dir}"; \
1538 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1539 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1543 delete-old: delete-old-files delete-old-dirs
1544 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1546 check-old: check-old-files check-old-libs check-old-dirs
1547 @echo "To remove old files and directories run '${MAKE} delete-old'."
1548 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1553 # showconfig - show build configuration.
1556 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1558 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1559 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1561 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1562 .if exists(${KERNCONFDIR}/${KERNCONF})
1563 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1564 ${KERNCONFDIR}/${KERNCONF}
1570 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1571 DTBOUTPUTPATH= ${.CURDIR}
1575 # Build 'standalone' Device Tree Blob
1578 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1579 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1582 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1583 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1587 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1588 echo "WARNING: DTB will be placed in the current working \
1593 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1594 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1598 .if defined(XDEV) && defined(XDEV_ARCH)
1600 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1601 XDEV_CPUTYPE?=${CPUTYPE}
1603 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1606 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1607 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1608 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1609 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1610 CPUTYPE=${XDEV_CPUTYPE}
1612 XDDIR=${XDEV_ARCH}-freebsd
1614 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR}
1616 _SHLIBDIRPREFIX=${XDTP} \
1617 TOOLS_PREFIX=${XDTP}
1619 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1621 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1622 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1623 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1624 XDDESTDIR=${DESTDIR}${XDTP}
1626 OSREL!= uname -r | sed -e 's/[-(].*//'
1629 .ORDER: xdev-build xdev-install
1630 xdev: xdev-build xdev-install
1632 .ORDER: _xb-build-tools _xb-cross-tools
1633 xdev-build: _xb-build-tools _xb-cross-tools
1636 ${_+_}@cd ${.CURDIR}; \
1637 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1641 gnu/usr.bin/binutils \
1644 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1645 cd ${.CURDIR}/${_tool}; \
1646 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1647 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1648 ${CDMAKE} DIRPRFX=${_tool}/ all
1652 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1653 mkdir -p ${XDDESTDIR}
1654 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1655 -p ${XDDESTDIR} >/dev/null
1656 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1657 -p ${XDDESTDIR}/usr >/dev/null
1658 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1659 -p ${XDDESTDIR}/usr/include >/dev/null
1661 .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1662 xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1665 @echo "_xi-cross-tools"
1667 gnu/usr.bin/binutils \
1670 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1671 cd ${.CURDIR}/${_tool}; \
1672 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1676 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1677 DESTDIR=${XDDESTDIR}
1680 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1681 DESTDIR=${XDDESTDIR}
1684 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1686 ln -sf ../../${XDTP}/usr/bin/$$i \
1687 ../../../../usr/bin/${XDDIR}-$$i; \
1688 ln -sf ../../${XDTP}/usr/bin/$$i \
1689 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \