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 # -DDB_FROM_SRC use the user/group databases in src/etc instead of
16 # the system database when installing.
17 # -DNO_CTF do not run the DTrace CTF conversion tools on built objects
18 # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
19 # LOCAL_MTREE="list of mtree files" to process to allow local directories
20 # to be created before files are installed
21 # TARGET="machine" to crossbuild world for a different machine type
22 # TARGET_ARCH= may be required when a TARGET supports multiple endians
25 # The intended user-driven targets are:
26 # buildworld - rebuild *everything*, including glue to help do upgrades
27 # installworld- install everything built by "buildworld"
28 # doxygen - build API documentation of the kernel
29 # update - convenient way to update your source tree (eg: cvsup/cvs)
31 # Standard targets (not defined here) are documented in the makefiles in
32 # /usr/share/mk. These include:
33 # obj depend all install clean cleandepend cleanobj
35 # You are supposed to define both of these when calling Makefile.inc1
36 # directly. However, some old scripts don't. Cope for the moment, but
37 # issue a new warning for a transition period.
38 .if defined(TARGET) && !defined(TARGET_ARCH)
39 .warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}."
42 .if !defined(TARGET) || !defined(TARGET_ARCH)
43 .error "Both TARGET and TARGET_ARCH must be defined."
47 .include <bsd.arch.inc.mk>
48 .include <bsd.compiler.mk>
50 # We must do share/info early so that installation of info `dir'
51 # entries works correctly. Do it first since it is less likely to
52 # grow dependencies on include and lib than vice versa.
54 # We must do lib/ and libexec/ before bin/, because if installworld
55 # installs a new /bin/sh, the 'make' command will *immediately*
56 # use that new version. And the new (dynamically-linked) /bin/sh
57 # will expect to find appropriate libraries in /lib and /libexec.
59 SUBDIR= share/info lib libexec
61 .if ${MK_GAMES} != "no"
64 .if ${MK_CDDL} != "no"
68 .if ${MK_KERBEROS} != "no"
71 .if ${MK_RESCUE} != "no"
75 .if ${MK_CRYPT} != "no"
78 .if !defined(NO_SHARE)
81 SUBDIR+=sys usr.bin usr.sbin
82 .if ${MK_OFED} != "no"
86 # We must do etc/ last for install/distribute to work.
90 # These are last, since it is nice to at least get the base system
91 # rebuilt before you do them.
92 .for _DIR in ${LOCAL_DIRS}
93 .if exists(${.CURDIR}/${_DIR}/Makefile)
98 .if defined(SUBDIR_OVERRIDE)
99 SUBDIR= ${SUBDIR_OVERRIDE}
105 .if defined(NO_CLEANDIR)
106 CLEANDIR= clean cleandepend
112 CVSFLAGS?= -A -P -d -I!
118 SUPFLAGS+= -h ${SUPHOST}
121 MAKEOBJDIRPREFIX?= /usr/obj
122 .if !defined(OSRELDATE)
123 .if exists(/usr/include/osreldate.h)
124 OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
125 /usr/include/osreldate.h
131 .if !defined(VERSION)
133 VERSION+= ${OSRELDATE}
136 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
137 .if ${TARGET} == ${TARGET_ARCH}
140 _t= ${TARGET_ARCH}/${TARGET}
143 .if empty(KNOWN_ARCHES:M${_t})
144 .error Unknown target ${TARGET_ARCH}:${TARGET}.
148 .if ${TARGET} == ${MACHINE}
149 TARGET_CPUTYPE?=${CPUTYPE}
154 .if !empty(TARGET_CPUTYPE)
155 _TARGET_CPUTYPE=${TARGET_CPUTYPE}
157 _TARGET_CPUTYPE=dummy
159 _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
160 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
161 .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
162 .error CPUTYPE global should be set with ?=.
165 BUILD_ARCH!= uname -p
166 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
167 .error To cross-build, set TARGET_ARCH.
170 .if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING)
171 OBJTREE= ${MAKEOBJDIRPREFIX}
173 OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}
175 WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
176 # /usr/games added for fortune which depend on strfile
177 BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
178 XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
179 STRICTTMPPATH= ${BPATH}:${XPATH}
180 TMPPATH= ${STRICTTMPPATH}:${PATH}
183 # Avoid running mktemp(1) unless actually needed.
184 # It may not be functional, e.g., due to new ABI
185 # when in the middle of installing over this system.
187 .if make(distributeworld) || make(installworld)
188 INSTALLTMP!= /usr/bin/mktemp -d -u -t install
192 # Building a world goes through the following stages
194 # 1. legacy stage [BMAKE]
195 # This stage is responsible for creating compatibility
196 # shims that are needed by the bootstrap-tools,
197 # build-tools and cross-tools stages.
198 # 1. bootstrap-tools stage [BMAKE]
199 # This stage is responsible for creating programs that
200 # are needed for backward compatibility reasons. They
201 # are not built as cross-tools.
202 # 2. build-tools stage [TMAKE]
203 # This stage is responsible for creating the object
204 # tree and building any tools that are needed during
206 # 3. cross-tools stage [XMAKE]
207 # This stage is responsible for creating any tools that
208 # are needed for cross-builds. A cross-compiler is one
210 # 4. world stage [WMAKE]
211 # This stage actually builds the world.
212 # 5. install stage (optional) [IMAKE]
213 # This stage installs a previously built world.
218 # Common environment for world related stages
219 CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
220 MACHINE_ARCH=${TARGET_ARCH} \
222 CPUTYPE=${TARGET_CPUTYPE}
223 .if ${OSRELDATE} < 700044
224 CROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib
226 .if ${MK_GROFF} != "no"
227 CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
228 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
229 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
232 # bootstrap-tools stage
233 BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
234 PATH=${BPATH}:${PATH} \
235 WORLDTMP=${WORLDTMP} \
236 VERSION="${VERSION}" \
237 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
238 COMPILER_TYPE=${COMPILER_TYPE}
239 BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
240 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
242 BOOTSTRAPPING=${OSRELDATE} \
244 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
245 -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
246 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
249 TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
250 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
251 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
253 BOOTSTRAPPING=${OSRELDATE} \
256 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
259 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
260 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
264 WMAKEENV= ${CROSSENV} \
265 _SHLIBDIRPREFIX=${WORLDTMP} \
267 VERSION="${VERSION}" \
268 INSTALL="sh ${.CURDIR}/tools/install.sh" \
270 .if ${MK_CDDL} == "no"
273 .if ${CC:T:Mgcc} == "gcc"
274 WMAKE_COMPILER_TYPE= gcc
275 .elif ${CC:T:Mclang} == "clang"
276 WMAKE_COMPILER_TYPE= clang
277 .elif ${MK_CLANG_IS_CC} == "no"
278 WMAKE_COMPILER_TYPE= gcc
280 WMAKE_COMPILER_TYPE= clang
282 WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
283 WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
285 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
287 LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
289 .if ${TARGET_ARCH} == "amd64"
290 .if empty(TARGET_CPUTYPE)
291 LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
293 LIB32CPUFLAGS= -march=${TARGET_CPUTYPE}
295 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \
296 MACHINE_CPU="i686 mmx sse sse2" \
297 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
300 .elif ${TARGET_ARCH} == "powerpc64"
301 .if empty(TARGET_CPUTYPE)
302 LIB32CPUFLAGS= -mcpu=powerpc
304 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
306 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc \
307 LD="${LD} -m elf32ppc"
311 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
312 -isystem ${LIB32TMP}/usr/include/ \
313 -L${LIB32TMP}/usr/lib32 \
314 -B${LIB32TMP}/usr/lib32
316 # Yes, the flags are redundant.
317 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
318 _SHLIBDIRPREFIX=${LIB32TMP} \
319 _LDSCRIPTROOT=${LIB32TMP} \
320 VERSION="${VERSION}" \
321 INSTALL="sh ${.CURDIR}/tools/install.sh" \
323 CC="${CC} ${LIB32FLAGS}" \
324 CXX="${CXX} ${LIB32FLAGS}" \
326 SHLIBDIR=/usr/lib32 \
327 COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
329 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
330 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \
331 -DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \
333 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
337 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
338 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
339 ${IMAKE_INSTALL} ${IMAKE_MTREE}
340 .if empty(.MAKEFLAGS:M-n)
341 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
342 LD_LIBRARY_PATH=${INSTALLTMP} \
343 PATH_LOCALE=${INSTALLTMP}/locale
344 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
346 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
348 .if defined(DB_FROM_SRC)
349 IMAKE_INSTALL= INSTALL="install -N ${.CURDIR}/etc"
350 IMAKE_MTREE= MTREE_CMD="nmtree -N ${.CURDIR}/etc"
354 KMAKEENV= ${WMAKEENV}
355 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
360 # Attempt to rebuild the entire system, with reasonable chance of
361 # success, regardless of how old your existing system is.
364 .if ${.CURDIR:C/[^,]//g} != ""
365 # The m4 build of sendmail files doesn't like it if ',' is used
366 # anywhere in the path of it's files.
368 @echo "*** Error: path to source tree contains a comma ','"
373 @echo "--------------------------------------------------------------"
374 @echo ">>> Rebuilding the temporary build tree"
375 @echo "--------------------------------------------------------------"
376 .if !defined(NO_CLEAN)
378 .if defined(LIB32TMP)
382 rm -rf ${WORLDTMP}/legacy/usr/include
383 # XXX - These three can depend on any header file.
384 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
385 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
386 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
390 mkdir -p ${WORLDTMP}/${_dir}
392 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
393 -p ${WORLDTMP}/legacy/usr >/dev/null
394 .if ${MK_GROFF} != "no"
395 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
396 -p ${WORLDTMP}/legacy/usr >/dev/null
398 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
399 -p ${WORLDTMP}/usr >/dev/null
400 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
401 -p ${WORLDTMP}/usr/include >/dev/null
402 ln -sf ${.CURDIR}/sys ${WORLDTMP}
403 .if ${MK_BIND_LIBS} != "no"
404 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
405 -p ${WORLDTMP}/usr/include >/dev/null
407 .for _mtree in ${LOCAL_MTREE}
408 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
412 @echo "--------------------------------------------------------------"
413 @echo ">>> stage 1.1: legacy release compatibility shims"
414 @echo "--------------------------------------------------------------"
415 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
418 @echo "--------------------------------------------------------------"
419 @echo ">>> stage 1.2: bootstrap tools"
420 @echo "--------------------------------------------------------------"
421 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
423 .if !defined(NO_CLEAN)
425 @echo "--------------------------------------------------------------"
426 @echo ">>> stage 2.1: cleaning up the object tree"
427 @echo "--------------------------------------------------------------"
428 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
429 .if defined(LIB32TMP)
430 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
435 @echo "--------------------------------------------------------------"
436 @echo ">>> stage 2.2: rebuilding the object tree"
437 @echo "--------------------------------------------------------------"
438 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
441 @echo "--------------------------------------------------------------"
442 @echo ">>> stage 2.3: build tools"
443 @echo "--------------------------------------------------------------"
444 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
447 @echo "--------------------------------------------------------------"
448 @echo ">>> stage 3: cross tools"
449 @echo "--------------------------------------------------------------"
450 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
453 @echo "--------------------------------------------------------------"
454 @echo ">>> stage 4.1: building includes"
455 @echo "--------------------------------------------------------------"
456 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
459 @echo "--------------------------------------------------------------"
460 @echo ">>> stage 4.2: building libraries"
461 @echo "--------------------------------------------------------------"
462 ${_+_}cd ${.CURDIR}; \
463 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
464 -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
467 @echo "--------------------------------------------------------------"
468 @echo ">>> stage 4.3: make dependencies"
469 @echo "--------------------------------------------------------------"
470 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
473 @echo "--------------------------------------------------------------"
474 @echo ">>> stage 4.4: building everything"
475 @echo "--------------------------------------------------------------"
476 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
477 .if defined(LIB32TMP)
480 @echo "--------------------------------------------------------------"
481 @echo ">>> stage 5.1: building 32 bit shim libraries"
482 @echo "--------------------------------------------------------------"
483 mkdir -p ${LIB32TMP}/usr/include
484 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
485 -p ${LIB32TMP}/usr >/dev/null
486 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
487 -p ${LIB32TMP}/usr/include >/dev/null
489 ln -sf ${.CURDIR}/sys ${WORLDTMP}
490 .if ${MK_KERBEROS} != "no"
491 .for _t in obj depend all
492 cd ${.CURDIR}/kerberos5/tools; \
493 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
494 DIRPRFX=kerberos5/tools/ ${_t}
497 .for _t in obj includes
498 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
499 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
500 .if ${MK_CDDL} != "no"
501 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
503 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
504 .if ${MK_CRYPT} != "no"
505 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
507 .if ${MK_KERBEROS} != "no"
508 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
511 .for _dir in usr.bin/lex/lib
512 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
514 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
515 cd ${.CURDIR}/${_dir}; \
516 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
517 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
518 -DEARLY_BUILD build-tools
521 ${LIB32WMAKE} -f Makefile.inc1 libraries
522 .for _t in obj depend all
523 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
524 DIRPRFX=libexec/rtld-elf/ ${_t}
525 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
526 DIRPRFX=usr.bin/ldd ${_t}
529 distribute32 install32:
530 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
531 .if ${MK_CDDL} != "no"
532 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
534 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
535 .if ${MK_CRYPT} != "no"
536 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
538 .if ${MK_KERBEROS} != "no"
539 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
541 cd ${.CURDIR}/libexec/rtld-elf; \
542 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
543 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
547 .if !defined(SUBDIR_OVERRIDE)
548 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
550 WMAKE_TGTS+= _cleanobj _obj _build-tools
551 .if !defined(SUBDIR_OVERRIDE)
552 WMAKE_TGTS+= _cross-tools
554 WMAKE_TGTS+= _includes _libraries _depend everything
555 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
559 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
560 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
563 @echo "--------------------------------------------------------------"
564 @echo ">>> World build started on `LC_ALL=C date`"
565 @echo "--------------------------------------------------------------"
569 @echo "--------------------------------------------------------------"
570 @echo ">>> World build completed on `LC_ALL=C date`"
571 @echo "--------------------------------------------------------------"
574 # We need to have this as a target because the indirection between Makefile
575 # and Makefile.inc1 causes the correct PATH to be used, rather than a
576 # modification of the current environment's PATH. In addition, we need
577 # to quote multiword values.
583 @echo Entering world for ${TARGET_ARCH}:${TARGET}
584 @cd ${.CURDIR} && env ${WMAKEENV} sh || true
586 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
587 toolchain: ${TOOLCHAIN_TGTS}
588 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
593 # Checks to be sure system is ready for installworld/installkernel.
598 # Require DESTDIR to be set if installing for a different architecture or
599 # using the user/group database in the source tree.
601 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
603 .if !make(distributeworld)
604 installcheck: installcheck_DESTDIR
605 installcheck_DESTDIR:
606 .if !defined(DESTDIR) || empty(DESTDIR)
607 @echo "ERROR: Please set DESTDIR!"; \
613 .if !defined(DB_FROM_SRC)
615 # Check for missing UIDs/GIDs.
617 CHECK_UIDS= auditdistd
619 .if ${MK_SENDMAIL} != "no"
625 CHECK_GIDS+= proxy authpf
627 installcheck: installcheck_UGID
629 .for uid in ${CHECK_UIDS}
630 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
631 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
635 .for gid in ${CHECK_GIDS}
636 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
637 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
644 # Required install tools to be saved in a scratch dir for safety.
646 .if ${MK_INFO} != "no"
647 _install-info= install-info
649 .if ${MK_ZONEINFO} != "no"
650 _zoneinfo= zic tzsetup
653 .if exists(/usr/sbin/nmtree)
654 _nmtree_itools= nmtree
657 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
658 date echo egrep find grep ${_install-info} \
659 ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
660 rm sed sh sysctl test true uname wc ${_zoneinfo}
665 # Distributes everything compiled by a `buildworld'.
669 # Installs everything compiled by a 'buildworld'.
672 # Non-base distributions produced by the base system
673 EXTRA_DISTRIBUTIONS= doc
674 .if ${MK_GAMES} != "no"
675 EXTRA_DISTRIBUTIONS+= games
677 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
678 EXTRA_DISTRIBUTIONS+= lib32
681 distributeworld installworld: installcheck
682 mkdir -p ${INSTALLTMP}
683 progs=$$(for prog in ${ITOOLS}; do \
684 if progpath=`which $$prog`; then \
687 echo "Required tool $$prog not found in PATH." >&2; \
691 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
692 while read line; do \
694 if [ "$$2 $$3" != "not found" ]; then \
697 echo "Required library $$1 not found." >&2; \
701 cp $$libs $$progs ${INSTALLTMP}
702 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
703 .if make(distributeworld)
704 .for dist in ${EXTRA_DISTRIBUTIONS}
705 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
706 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
707 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
708 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
709 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
710 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
711 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
713 -mkdir ${DESTDIR}/${DISTDIR}/base
714 ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
715 LOCAL_MTREE=${LOCAL_MTREE} DESTDIR=${DESTDIR}/${DISTDIR}/base
717 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
718 ${IMAKEENV} rm -rf ${INSTALLTMP}
719 .if make(distributeworld)
720 .for dist in ${EXTRA_DISTRIBUTIONS}
721 find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
726 .for dist in base ${EXTRA_DISTRIBUTIONS}
727 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
728 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
734 # If you have a build server, you can NFS mount the source and obj directories
735 # and do a 'make reinstall' on the *client* to install new binaries from the
736 # most recent server build.
739 @echo "--------------------------------------------------------------"
740 @echo ">>> Making hierarchy"
741 @echo "--------------------------------------------------------------"
742 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
743 LOCAL_MTREE=${LOCAL_MTREE} hierarchy
745 @echo "--------------------------------------------------------------"
746 @echo ">>> Installing everything"
747 @echo "--------------------------------------------------------------"
748 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
749 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
750 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
754 @echo "--------------------------------------------------------------"
755 @echo ">>> Distributing everything"
756 @echo "--------------------------------------------------------------"
757 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
758 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
759 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
763 distrib-dirs distribution:
764 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
765 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${.TARGET}
768 # buildkernel and installkernel
770 # Which kernels to build and/or install is specified by setting
771 # KERNCONF. If not defined a GENERIC kernel is built/installed.
772 # Only the existing (depending TARGET) config files are used
773 # for building kernels and only the first of these is designated
774 # as the one being installed.
776 # Note that we have to use TARGET instead of TARGET_ARCH when
777 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
778 # be set to cross-build, we have to make sure TARGET is set
781 .if defined(KERNFAST)
786 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
787 .if !defined(KERNCONF) && ${KERNFAST} != "1"
791 .if !defined(KERNCONF) && defined(KERNEL)
795 .if ${TARGET_ARCH} == "powerpc64"
801 INSTKERNNAME?= kernel
803 KERNSRCDIR?= ${.CURDIR}/sys
804 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
805 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
806 KERNCONFDIR?= ${KRNLCONFDIR}
810 .for _kernel in ${KERNCONF}
811 .if exists(${KERNCONFDIR}/${_kernel})
812 BUILDKERNELS+= ${_kernel}
813 .if empty(INSTALLKERNEL)
814 INSTALLKERNEL= ${_kernel}
822 # Builds all kernels defined by BUILDKERNELS.
825 .if empty(BUILDKERNELS)
826 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
829 .if defined(KERNWARN)
830 @echo "--------------------------------------------------------------"
831 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
832 @echo "--------------------------------------------------------------"
836 .for _kernel in ${BUILDKERNELS}
837 @echo "--------------------------------------------------------------"
838 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
839 @echo "--------------------------------------------------------------"
840 @echo "===> ${_kernel}"
841 mkdir -p ${KRNLOBJDIR}
842 .if !defined(NO_KERNELCONFIG)
844 @echo "--------------------------------------------------------------"
845 @echo ">>> stage 1: configuring the kernel"
846 @echo "--------------------------------------------------------------"
849 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
850 ${KERNCONFDIR}/${_kernel}
852 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
854 @echo "--------------------------------------------------------------"
855 @echo ">>> stage 2.1: cleaning up the object tree"
856 @echo "--------------------------------------------------------------"
857 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
859 .if !defined(NO_KERNELOBJ)
861 @echo "--------------------------------------------------------------"
862 @echo ">>> stage 2.2: rebuilding the object tree"
863 @echo "--------------------------------------------------------------"
864 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
867 @echo "--------------------------------------------------------------"
868 @echo ">>> stage 2.3: build tools"
869 @echo "--------------------------------------------------------------"
870 cd ${KRNLOBJDIR}/${_kernel}; \
871 PATH=${BPATH}:${PATH} \
872 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
873 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
874 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
875 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
876 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
877 .for target in obj depend all
878 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
879 PATH=${BPATH}:${PATH} \
880 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
881 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
884 .if !defined(NO_KERNELDEPEND)
886 @echo "--------------------------------------------------------------"
887 @echo ">>> stage 3.1: making dependencies"
888 @echo "--------------------------------------------------------------"
889 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
892 @echo "--------------------------------------------------------------"
893 @echo ">>> stage 3.2: building everything"
894 @echo "--------------------------------------------------------------"
895 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
896 @echo "--------------------------------------------------------------"
897 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
898 @echo "--------------------------------------------------------------"
902 # installkernel, etc.
904 # Install the kernel defined by INSTALLKERNEL
906 installkernel installkernel.debug \
907 reinstallkernel reinstallkernel.debug: installcheck
908 .if empty(INSTALLKERNEL)
909 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
912 @echo "--------------------------------------------------------------"
913 @echo ">>> Installing kernel ${INSTALLKERNEL}"
914 @echo "--------------------------------------------------------------"
915 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
916 ${CROSSENV} PATH=${TMPPATH} \
917 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
919 distributekernel distributekernel.debug:
920 .if empty(INSTALLKERNEL)
921 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
924 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
925 ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
926 DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
927 ${.TARGET:S/distributekernel/install/}
928 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
929 cd ${KRNLOBJDIR}/${_kernel}; \
930 ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
931 KERNEL=${INSTKERNNAME}.${_kernel} \
932 DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
933 ${.TARGET:S/distributekernel/install/}
937 cd ${DESTDIR}/${DISTDIR}/kernel; \
938 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
939 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
940 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
941 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
947 # Build the API documentation with doxygen
950 @if [ ! -x `/usr/bin/which doxygen` ]; then \
951 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
954 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
959 # Update the source tree(s), by running cvsup/cvs/svn to update to the
963 .if defined(SUP_UPDATE)
964 @echo "--------------------------------------------------------------"
965 @echo ">>> Running ${SUP}"
966 @echo "--------------------------------------------------------------"
967 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
968 @echo "!! Update methods with ${SUP} are deprecated."
969 @echo "!! Please see http://www.freebsd.org/handbook/svn.html"
970 @echo "!! and convert your update method to SVN_UPDATE or"
971 @echo "!! freebsd-update(8)."
972 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
975 @${SUP} ${SUPFLAGS} ${SUPFILE}
977 .if defined(SUPFILE1)
978 @${SUP} ${SUPFLAGS} ${SUPFILE1}
980 .if defined(SUPFILE2)
981 @${SUP} ${SUPFLAGS} ${SUPFILE2}
983 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
984 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
986 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
987 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
990 .if defined(CVS_UPDATE)
992 if [ -d CVS ] ; then \
993 echo "--------------------------------------------------------------" ; \
994 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
995 echo "--------------------------------------------------------------" ; \
996 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
997 echo "!! Update methods with CVS are deprecated." ; \
998 echo "!! Please see http://www.freebsd.org/handbook/svn.html" ; \
999 echo "!! and convert your update method to SVN_UPDATE or" ; \
1000 echo "!! freebsd-update(8)." ; \
1001 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
1003 echo ${CVS} -R -q update ${CVSFLAGS} ; \
1004 ${CVS} -R -q update ${CVSFLAGS} ; \
1007 .if defined(SVN_UPDATE)
1009 if [ -d .svn ] ; then \
1010 echo "--------------------------------------------------------------" ; \
1011 echo ">>> Updating ${.CURDIR} using Subversion" ; \
1012 echo "--------------------------------------------------------------" ; \
1013 echo ${SVN} update ${SVNFLAGS} ; \
1014 ${SVN} update ${SVNFLAGS} ; \
1019 # ------------------------------------------------------------------------
1021 # From here onwards are utility targets used by the 'make world' and
1022 # related targets. If your 'world' breaks, you may like to try to fix
1023 # the problem and manually run the following targets to attempt to
1024 # complete the build. Beware, this is *not* guaranteed to work, you
1025 # need to have a pretty good grip on the current state of the system
1026 # to attempt to manually finish it. If in doubt, 'make world' again.
1030 # legacy: Build compatibility shims for the next three targets
1033 .if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0
1034 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \
1037 .for _tool in tools/build
1038 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1039 cd ${.CURDIR}/${_tool}; \
1040 ${MAKE} DIRPRFX=${_tool}/ obj; \
1041 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
1042 ${MAKE} DIRPRFX=${_tool}/ depend; \
1043 ${MAKE} DIRPRFX=${_tool}/ all; \
1044 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1048 # bootstrap-tools: Build tools needed for compatibility
1050 .if ${MK_GAMES} != "no"
1051 _strfile= games/fortune/strfile
1054 .if ${MK_CXX} != "no"
1055 _gperf= gnu/usr.bin/gperf
1058 .if ${MK_GROFF} != "no"
1059 _groff= gnu/usr.bin/groff
1062 .if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022
1066 .if ${BOOTSTRAPPING} < 800013
1067 _mklocale= usr.bin/mklocale
1070 .if ${BOOTSTRAPPING} < 900002
1074 .if ${BOOTSTRAPPING} < 900006
1078 .if ${BOOTSTRAPPING} < 900006 || ${BOOTSTRAPPING} >= 1000013
1082 .if ${BOOTSTRAPPING} < 1000026
1083 _nmtree= lib/libnetbsd \
1087 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1091 .if ${MK_BSNMP} != "no" && \
1092 (${BOOTSTRAPPING} < 700018 || !exists(/usr/sbin/gensnmptree))
1093 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1096 .if ${MK_RESCUE} != "no" && \
1097 ${BOOTSTRAPPING} < 700026
1098 _crunchgen= usr.sbin/crunch/crunchgen
1101 .if ${MK_CLANG} != "no"
1103 lib/clang/libllvmsupport \
1104 lib/clang/libllvmtablegen \
1105 usr.bin/clang/tblgen \
1106 usr.bin/clang/clang-tblgen
1109 .if ${MK_CDDL} != "no" && \
1110 ${BOOTSTRAPPING} < 800038 && \
1111 !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)
1112 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1113 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1116 .if ${MK_FDT} != "no"
1117 _dtc= gnu/usr.bin/dtc
1120 # Please document (add comment) why something is in 'bootstrap-tools'.
1121 # Try to bound the building of the bootstrap-tool to just the
1122 # FreeBSD versions that need the tool built at this stage of the build.
1134 usr.bin/makewhatis \
1146 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1147 cd ${.CURDIR}/${_tool}; \
1148 ${MAKE} DIRPRFX=${_tool}/ obj; \
1149 ${MAKE} DIRPRFX=${_tool}/ depend; \
1150 ${MAKE} DIRPRFX=${_tool}/ all; \
1151 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1155 # build-tools: Build special purpose build tools
1157 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
1158 _aicasm= sys/modules/aic7xxx/aicasm
1161 .if !defined(NO_SHARE)
1162 _share= share/syscons/scrnmaps
1165 .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1166 _gcc_tools= gnu/usr.bin/cc/cc_tools
1169 .if ${MK_KERBEROS} != "no"
1170 _kerberos5_tools= kerberos5/tools
1173 .if ${MK_RESCUE} != "no"
1174 _rescue= rescue/rescue
1182 lib/ncurses/ncurses \
1183 lib/ncurses/ncursesw \
1188 usr.sbin/sysinstall \
1189 usr.bin/mkesdb_static \
1190 usr.bin/mkcsmapper_static
1191 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1192 cd ${.CURDIR}/${_tool}; \
1193 ${MAKE} DIRPRFX=${_tool}/ obj; \
1194 ${MAKE} DIRPRFX=${_tool}/ build-tools
1199 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1200 cd ${.CURDIR}/${_tool}; \
1201 ${MAKE} DIRPRFX=${_tool}/ obj; \
1202 ${MAKE} DIRPRFX=${_tool}/ depend; \
1203 ${MAKE} DIRPRFX=${_tool}/ all
1207 # cross-tools: Build cross-building tools
1209 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1210 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1211 _btxld= usr.sbin/btxld
1214 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1215 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1216 _crunchide= usr.sbin/crunch/crunchide
1218 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1219 _kgzip= usr.sbin/kgzip
1223 .if ${MK_BINUTILS} != "no"
1224 _binutils= gnu/usr.bin/binutils
1227 .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1228 _clang= usr.bin/clang
1229 _clang_libs= lib/clang
1232 .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1242 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1246 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1247 cd ${.CURDIR}/${_tool}; \
1248 ${MAKE} DIRPRFX=${_tool}/ obj; \
1249 ${MAKE} DIRPRFX=${_tool}/ depend; \
1250 ${MAKE} DIRPRFX=${_tool}/ all; \
1251 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1255 # hierarchy - ensure that all the needed directories are present
1258 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
1261 # libraries - build all libraries, and install them under ${DESTDIR}.
1263 # The list of libraries with dependents (${_prebuild_libs}) and their
1264 # interdependencies (__L) are built automatically by the
1265 # ${.CURDIR}/tools/make_libdeps.sh script.
1269 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1270 ${MAKE} -f Makefile.inc1 _startup_libs; \
1271 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1272 ${MAKE} -f Makefile.inc1 _generic_libs;
1275 # static libgcc.a prerequisite for shared libc
1277 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1279 # These dependencies are not automatically generated:
1281 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1282 # all shared libraries for ELF.
1284 _startup_libs= gnu/lib/csu
1285 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1286 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1287 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1288 _startup_libs+= lib/csu/${MACHINE_ARCH}
1290 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1292 _startup_libs+= gnu/lib/libgcc
1293 _startup_libs+= lib/libcompiler_rt
1294 _startup_libs+= lib/libc
1295 .if ${MK_LIBCPLUSPLUS} != "no"
1296 _startup_libs+= lib/libcxxrt
1299 gnu/lib/libgcc__L: lib/libc__L
1300 .if ${MK_LIBCPLUSPLUS} != "no"
1301 lib/libcxxrt__L: gnu/lib/libgcc__L
1304 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \
1305 ${_kerberos5_lib_libheimntlm} \
1306 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1307 ${_kerberos5_lib_libroken} \
1308 lib/libbz2 lib/libcom_err lib/libcrypt \
1310 ${_lib_libgssapi} ${_lib_libipx} \
1311 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1312 lib/ncurses/ncurses lib/ncurses/ncursesw \
1313 lib/libopie lib/libpam ${_lib_libthr} \
1314 lib/libradius lib/libsbuf lib/libtacplus \
1315 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1316 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1317 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1318 ${_secure_lib_libssl}
1320 .if ${MK_LIBTHR} != "no"
1321 _lib_libthr= lib/libthr
1324 .if ${MK_OFED} != "no"
1325 _ofed_lib= contrib/ofed/usr.lib/
1328 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1330 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1332 .if ${MK_CDDL} != "no"
1333 _cddl_lib_libumem= cddl/lib/libumem
1334 _cddl_lib_libnvpair= cddl/lib/libnvpair
1338 .if ${MK_CRYPT} != "no"
1339 .if ${MK_OPENSSL} != "no"
1340 _secure_lib_libcrypto= secure/lib/libcrypto
1341 _secure_lib_libssl= secure/lib/libssl
1342 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1343 .if ${MK_OPENSSH} != "no"
1344 _secure_lib_libssh= secure/lib/libssh
1345 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1346 .if ${MK_KERBEROS_SUPPORT} != "no"
1347 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1348 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1349 lib/libmd__L kerberos5/lib/libroken__L
1353 _secure_lib= secure/lib
1356 .if ${MK_KERBEROS} != "no"
1357 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1358 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1359 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L
1360 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L
1361 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1362 secure/lib/libcrypto__L kerberos5/lib/libroken__L
1363 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1364 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1365 kerberos5/lib/libroken__L
1366 kerberos5/lib/libroken__L: lib/libcrypt__L
1369 .if ${MK_GSSAPI} != "no"
1370 _lib_libgssapi= lib/libgssapi
1373 .if ${MK_IPX} != "no"
1374 _lib_libipx= lib/libipx
1377 .if ${MK_KERBEROS} != "no"
1378 _kerberos5_lib= kerberos5/lib
1379 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1380 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1381 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1382 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1383 _kerberos5_lib_libroken= kerberos5/lib/libroken
1384 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1387 .if ${MK_NIS} != "no"
1388 _lib_libypclnt= lib/libypclnt
1391 .if ${MK_OPENSSL} == "no"
1392 lib/libradius__L: lib/libmd__L
1395 .for _lib in ${_prereq_libs}
1397 .if exists(${.CURDIR}/${_lib})
1398 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1399 cd ${.CURDIR}/${_lib}; \
1400 ${MAKE} DIRPRFX=${_lib}/ obj; \
1401 ${MAKE} DIRPRFX=${_lib}/ depend; \
1402 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1403 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1407 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1409 .if exists(${.CURDIR}/${_lib})
1410 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1411 cd ${.CURDIR}/${_lib}; \
1412 ${MAKE} DIRPRFX=${_lib}/ obj; \
1413 ${MAKE} DIRPRFX=${_lib}/ depend; \
1414 ${MAKE} DIRPRFX=${_lib}/ all; \
1415 ${MAKE} DIRPRFX=${_lib}/ install
1419 # libpam is special: we need to build static PAM modules before
1420 # static PAM library, and dynamic PAM library before dynamic PAM
1422 lib/libpam__L: .PHONY
1423 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1424 cd ${.CURDIR}/lib/libpam; \
1425 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1426 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1427 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1428 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1430 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1431 _startup_libs: ${_startup_libs:S/$/__L/}
1432 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1433 _generic_libs: ${_generic_libs:S/$/__L/}
1435 .for __target in all clean cleandepend cleandir depend includes obj
1436 .for entry in ${SUBDIR}
1437 ${entry}.${__target}__D: .PHONY
1438 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1439 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1440 edir=${entry}.${MACHINE_ARCH}; \
1441 cd ${.CURDIR}/$${edir}; \
1443 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1445 cd ${.CURDIR}/$${edir}; \
1447 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1449 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1452 .include <bsd.subdir.mk>
1454 .if make(check-old) || make(check-old-dirs) || \
1455 make(check-old-files) || make(check-old-libs) || \
1456 make(delete-old) || make(delete-old-dirs) || \
1457 make(delete-old-files) || make(delete-old-libs)
1460 # check for / delete old files section
1463 .include "ObsoleteFiles.inc"
1465 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1466 else you can not start such an application. Consult UPDATING for more \
1467 information regarding how to cope with the removal/revision bump of a \
1470 .if !defined(BATCH_DELETE_OLD_FILES)
1477 @echo ">>> Removing old files (only deletes safe to delete libs)"
1478 # Ask for every old file if the user really wants to remove it.
1479 # It's annoying, but better safe than sorry.
1480 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1481 # argument list will get too long. Using .for/.endfor make "loops" will make
1482 # the Makefile parser segfault.
1484 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1485 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1486 while read file; do \
1487 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1488 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1489 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1492 # Remove catpages without corresponding manpages.
1494 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1495 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1496 while read catpage; do \
1498 if [ ! -e "$${manpage}" ]; then \
1499 rm ${RM_I} $${catpage} <&3; \
1502 @echo ">>> Old files removed"
1505 @echo ">>> Checking for old files"
1506 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1507 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1508 while read file; do \
1509 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1510 echo "${DESTDIR}/$${file}"; \
1513 # Check for catpages without corresponding manpages.
1514 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1515 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1516 while read catpage; do \
1518 if [ ! -e "$${manpage}" ]; then \
1524 @echo ">>> Removing old libraries"
1525 @echo "${OLD_LIBS_MESSAGE}" | fmt
1527 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1528 -V OLD_LIBS | xargs -n1 | \
1529 while read file; do \
1530 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1531 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1532 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1535 @echo ">>> Old libraries removed"
1538 @echo ">>> Checking for old libraries"
1539 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1540 -V OLD_LIBS | xargs -n1 | \
1541 while read file; do \
1542 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1543 echo "${DESTDIR}/$${file}"; \
1548 @echo ">>> Removing old directories"
1549 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1550 -V OLD_DIRS | xargs -n1 | \
1551 while read dir; do \
1552 if [ -d "${DESTDIR}/$${dir}" ]; then \
1553 rmdir -v "${DESTDIR}/$${dir}" || true; \
1554 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1555 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1558 @echo ">>> Old directories removed"
1561 @echo ">>> Checking for old directories"
1562 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1563 -V OLD_DIRS | xargs -n1 | \
1564 while read dir; do \
1565 if [ -d "${DESTDIR}/$${dir}" ]; then \
1566 echo "${DESTDIR}/$${dir}"; \
1567 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1568 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1572 delete-old: delete-old-files delete-old-dirs
1573 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1575 check-old: check-old-files check-old-libs check-old-dirs
1576 @echo "To remove old files and directories run '${MAKE} delete-old'."
1577 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1582 # showconfig - show build configuration.
1585 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1587 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1588 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1590 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1591 .if exists(${KERNCONFDIR}/${KERNCONF})
1592 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1593 ${KERNCONFDIR}/${KERNCONF}
1599 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1600 DTBOUTPUTPATH= ${.CURDIR}
1604 # Build 'standalone' Device Tree Blob
1607 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1608 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1611 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1612 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1616 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1617 echo "WARNING: DTB will be placed in the current working \
1622 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1623 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1627 .if defined(XDEV) && defined(XDEV_ARCH)
1629 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1630 XDEV_CPUTYPE?=${CPUTYPE}
1632 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1635 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1636 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1637 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1638 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1639 CPUTYPE=${XDEV_CPUTYPE}
1641 XDDIR=${XDEV_ARCH}-freebsd
1643 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR}
1645 _SHLIBDIRPREFIX=${XDTP} \
1646 TOOLS_PREFIX=${XDTP}
1648 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1650 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1651 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1652 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1653 XDDESTDIR=${DESTDIR}${XDTP}
1655 OSREL!= uname -r | sed -e 's/[-(].*//'
1658 .ORDER: xdev-build xdev-install
1659 xdev: xdev-build xdev-install
1661 .ORDER: _xb-build-tools _xb-cross-tools
1662 xdev-build: _xb-build-tools _xb-cross-tools
1665 ${_+_}@cd ${.CURDIR}; \
1666 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1670 gnu/usr.bin/binutils \
1673 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1674 cd ${.CURDIR}/${_tool}; \
1675 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1676 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1677 ${CDMAKE} DIRPRFX=${_tool}/ all
1681 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1682 mkdir -p ${XDDESTDIR}
1683 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1684 -p ${XDDESTDIR} >/dev/null
1685 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1686 -p ${XDDESTDIR}/usr >/dev/null
1687 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1688 -p ${XDDESTDIR}/usr/include >/dev/null
1690 .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1691 xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1694 @echo "_xi-cross-tools"
1696 gnu/usr.bin/binutils \
1699 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1700 cd ${.CURDIR}/${_tool}; \
1701 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1705 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1706 DESTDIR=${XDDESTDIR}
1709 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1710 DESTDIR=${XDDESTDIR}
1713 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1715 ln -sf ../../${XDTP}/usr/bin/$$i \
1716 ../../../../usr/bin/${XDDIR}-$$i; \
1717 ln -sf ../../${XDTP}/usr/bin/$$i \
1718 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \