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"
299 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32"
301 .elif ${TARGET_ARCH} == "powerpc64"
302 .if empty(TARGET_CPUTYPE)
303 LIB32CPUFLAGS= -mcpu=powerpc
305 LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
307 LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
309 LD="${LD} -m elf32ppc"
313 LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \
314 -isystem ${LIB32TMP}/usr/include/ \
315 -L${LIB32TMP}/usr/lib32 \
316 -B${LIB32TMP}/usr/lib32
318 # Yes, the flags are redundant.
319 LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
320 _SHLIBDIRPREFIX=${LIB32TMP} \
321 _LDSCRIPTROOT=${LIB32TMP} \
322 VERSION="${VERSION}" \
323 INSTALL="sh ${.CURDIR}/tools/install.sh" \
326 SHLIBDIR=/usr/lib32 \
327 COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
329 CC="${CC} ${LIB32FLAGS}" \
330 CXX="${CXX} ${LIB32FLAGS}" \
331 DESTDIR=${LIB32TMP} \
337 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
338 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
339 LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
343 IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*}
344 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
345 ${IMAKE_INSTALL} ${IMAKE_MTREE}
346 .if empty(.MAKEFLAGS:M-n)
347 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
348 LD_LIBRARY_PATH=${INSTALLTMP} \
349 PATH_LOCALE=${INSTALLTMP}/locale
350 IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh
352 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
354 .if defined(DB_FROM_SRC)
355 IMAKE_INSTALL= INSTALL="install -N ${.CURDIR}/etc"
356 IMAKE_MTREE= MTREE_CMD="nmtree -N ${.CURDIR}/etc"
360 KMAKEENV= ${WMAKEENV}
361 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
366 # Attempt to rebuild the entire system, with reasonable chance of
367 # success, regardless of how old your existing system is.
370 .if ${.CURDIR:C/[^,]//g} != ""
371 # The m4 build of sendmail files doesn't like it if ',' is used
372 # anywhere in the path of it's files.
374 @echo "*** Error: path to source tree contains a comma ','"
379 @echo "--------------------------------------------------------------"
380 @echo ">>> Rebuilding the temporary build tree"
381 @echo "--------------------------------------------------------------"
382 .if !defined(NO_CLEAN)
384 .if defined(LIB32TMP)
388 rm -rf ${WORLDTMP}/legacy/usr/include
389 # XXX - These three can depend on any header file.
390 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
391 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c
392 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
396 mkdir -p ${WORLDTMP}/${_dir}
398 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
399 -p ${WORLDTMP}/legacy/usr >/dev/null
400 .if ${MK_GROFF} != "no"
401 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \
402 -p ${WORLDTMP}/legacy/usr >/dev/null
404 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
405 -p ${WORLDTMP}/usr >/dev/null
406 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
407 -p ${WORLDTMP}/usr/include >/dev/null
408 ln -sf ${.CURDIR}/sys ${WORLDTMP}
409 .if ${MK_BIND_LIBS} != "no"
410 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
411 -p ${WORLDTMP}/usr/include >/dev/null
413 .for _mtree in ${LOCAL_MTREE}
414 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null
418 @echo "--------------------------------------------------------------"
419 @echo ">>> stage 1.1: legacy release compatibility shims"
420 @echo "--------------------------------------------------------------"
421 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
424 @echo "--------------------------------------------------------------"
425 @echo ">>> stage 1.2: bootstrap tools"
426 @echo "--------------------------------------------------------------"
427 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
429 .if !defined(NO_CLEAN)
431 @echo "--------------------------------------------------------------"
432 @echo ">>> stage 2.1: cleaning up the object tree"
433 @echo "--------------------------------------------------------------"
434 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
435 .if defined(LIB32TMP)
436 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
441 @echo "--------------------------------------------------------------"
442 @echo ">>> stage 2.2: rebuilding the object tree"
443 @echo "--------------------------------------------------------------"
444 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
447 @echo "--------------------------------------------------------------"
448 @echo ">>> stage 2.3: build tools"
449 @echo "--------------------------------------------------------------"
450 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
453 @echo "--------------------------------------------------------------"
454 @echo ">>> stage 3: cross tools"
455 @echo "--------------------------------------------------------------"
456 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
459 @echo "--------------------------------------------------------------"
460 @echo ">>> stage 4.1: building includes"
461 @echo "--------------------------------------------------------------"
462 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
465 @echo "--------------------------------------------------------------"
466 @echo ">>> stage 4.2: building libraries"
467 @echo "--------------------------------------------------------------"
468 ${_+_}cd ${.CURDIR}; \
469 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
470 -DWITHOUT_MAN -DWITHOUT_PROFILE libraries
473 @echo "--------------------------------------------------------------"
474 @echo ">>> stage 4.3: make dependencies"
475 @echo "--------------------------------------------------------------"
476 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
479 @echo "--------------------------------------------------------------"
480 @echo ">>> stage 4.4: building everything"
481 @echo "--------------------------------------------------------------"
482 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
483 .if defined(LIB32TMP)
486 @echo "--------------------------------------------------------------"
487 @echo ">>> stage 5.1: building 32 bit shim libraries"
488 @echo "--------------------------------------------------------------"
489 mkdir -p ${LIB32TMP}/usr/include
490 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
491 -p ${LIB32TMP}/usr >/dev/null
492 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
493 -p ${LIB32TMP}/usr/include >/dev/null
495 ln -sf ${.CURDIR}/sys ${WORLDTMP}
496 .if ${MK_KERBEROS} != "no"
497 .for _t in obj depend all
498 cd ${.CURDIR}/kerberos5/tools; \
499 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
500 DIRPRFX=kerberos5/tools/ ${_t}
503 .for _t in obj includes
504 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t}
505 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t}
506 .if ${MK_CDDL} != "no"
507 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t}
509 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t}
510 .if ${MK_CRYPT} != "no"
511 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t}
513 .if ${MK_KERBEROS} != "no"
514 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t}
517 .for _dir in usr.bin/lex/lib
518 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj
520 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
521 cd ${.CURDIR}/${_dir}; \
522 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \
523 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \
524 -DEARLY_BUILD build-tools
527 ${LIB32WMAKE} -f Makefile.inc1 libraries
528 .for _t in obj depend all
529 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \
530 DIRPRFX=libexec/rtld-elf/ ${_t}
531 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \
532 DIRPRFX=usr.bin/ldd ${_t}
535 distribute32 install32:
536 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
537 .if ${MK_CDDL} != "no"
538 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
540 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
541 .if ${MK_CRYPT} != "no"
542 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
544 .if ${MK_KERBEROS} != "no"
545 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
547 cd ${.CURDIR}/libexec/rtld-elf; \
548 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
549 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//}
553 .if !defined(SUBDIR_OVERRIDE)
554 WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
556 WMAKE_TGTS+= _cleanobj _obj _build-tools
557 .if !defined(SUBDIR_OVERRIDE)
558 WMAKE_TGTS+= _cross-tools
560 WMAKE_TGTS+= _includes _libraries _depend everything
561 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
565 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
566 .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
569 @echo "--------------------------------------------------------------"
570 @echo ">>> World build started on `LC_ALL=C date`"
571 @echo "--------------------------------------------------------------"
575 @echo "--------------------------------------------------------------"
576 @echo ">>> World build completed on `LC_ALL=C date`"
577 @echo "--------------------------------------------------------------"
580 # We need to have this as a target because the indirection between Makefile
581 # and Makefile.inc1 causes the correct PATH to be used, rather than a
582 # modification of the current environment's PATH. In addition, we need
583 # to quote multiword values.
589 @echo Entering world for ${TARGET_ARCH}:${TARGET}
590 @cd ${.CURDIR} && env ${WMAKEENV} sh || true
592 TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
593 toolchain: ${TOOLCHAIN_TGTS}
594 kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
599 # Checks to be sure system is ready for installworld/installkernel.
604 # Require DESTDIR to be set if installing for a different architecture or
605 # using the user/group database in the source tree.
607 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
609 .if !make(distributeworld)
610 installcheck: installcheck_DESTDIR
611 installcheck_DESTDIR:
612 .if !defined(DESTDIR) || empty(DESTDIR)
613 @echo "ERROR: Please set DESTDIR!"; \
619 .if !defined(DB_FROM_SRC)
621 # Check for missing UIDs/GIDs.
623 CHECK_UIDS= auditdistd
625 .if ${MK_SENDMAIL} != "no"
631 CHECK_GIDS+= proxy authpf
633 installcheck: installcheck_UGID
635 .for uid in ${CHECK_UIDS}
636 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
637 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
641 .for gid in ${CHECK_GIDS}
642 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
643 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
650 # Required install tools to be saved in a scratch dir for safety.
652 .if ${MK_INFO} != "no"
653 _install-info= install-info
655 .if ${MK_ZONEINFO} != "no"
656 _zoneinfo= zic tzsetup
659 .if exists(/usr/sbin/nmtree)
660 _nmtree_itools= nmtree
663 ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
664 date echo egrep find grep ${_install-info} \
665 ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
666 rm sed sh sysctl test true uname wc ${_zoneinfo}
671 # Distributes everything compiled by a `buildworld'.
675 # Installs everything compiled by a 'buildworld'.
678 # Non-base distributions produced by the base system
679 EXTRA_DISTRIBUTIONS= doc
680 .if ${MK_GAMES} != "no"
681 EXTRA_DISTRIBUTIONS+= games
683 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
684 EXTRA_DISTRIBUTIONS+= lib32
687 distributeworld installworld: installcheck
688 mkdir -p ${INSTALLTMP}
689 progs=$$(for prog in ${ITOOLS}; do \
690 if progpath=`which $$prog`; then \
693 echo "Required tool $$prog not found in PATH." >&2; \
697 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \
698 while read line; do \
700 if [ "$$2 $$3" != "not found" ]; then \
703 echo "Required library $$1 not found." >&2; \
707 cp $$libs $$progs ${INSTALLTMP}
708 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
709 .if make(distributeworld)
710 .for dist in ${EXTRA_DISTRIBUTIONS}
711 -mkdir ${DESTDIR}/${DISTDIR}/${dist}
712 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
713 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null
714 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
715 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null
716 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
717 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null
719 -mkdir ${DESTDIR}/${DISTDIR}/base
720 ${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \
721 LOCAL_MTREE=${LOCAL_MTREE} DESTDIR=${DESTDIR}/${DISTDIR}/base
723 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \
724 ${IMAKEENV} rm -rf ${INSTALLTMP}
725 .if make(distributeworld)
726 .for dist in ${EXTRA_DISTRIBUTIONS}
727 find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
732 .for dist in base ${EXTRA_DISTRIBUTIONS}
733 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \
734 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz .
740 # If you have a build server, you can NFS mount the source and obj directories
741 # and do a 'make reinstall' on the *client* to install new binaries from the
742 # most recent server build.
745 @echo "--------------------------------------------------------------"
746 @echo ">>> Making hierarchy"
747 @echo "--------------------------------------------------------------"
748 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \
749 LOCAL_MTREE=${LOCAL_MTREE} hierarchy
751 @echo "--------------------------------------------------------------"
752 @echo ">>> Installing everything"
753 @echo "--------------------------------------------------------------"
754 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
755 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
756 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
760 @echo "--------------------------------------------------------------"
761 @echo ">>> Distributing everything"
762 @echo "--------------------------------------------------------------"
763 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
764 .if defined(LIB32TMP) && ${MK_LIB32} != "no"
765 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \
769 distrib-dirs distribution:
770 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
771 ${IMAKE_INSTALL} ${IMAKE_MTREE} ${.TARGET}
774 # buildkernel and installkernel
776 # Which kernels to build and/or install is specified by setting
777 # KERNCONF. If not defined a GENERIC kernel is built/installed.
778 # Only the existing (depending TARGET) config files are used
779 # for building kernels and only the first of these is designated
780 # as the one being installed.
782 # Note that we have to use TARGET instead of TARGET_ARCH when
783 # we're in kernel-land. Since only TARGET_ARCH is (expected) to
784 # be set to cross-build, we have to make sure TARGET is set
787 .if defined(KERNFAST)
792 # Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah
793 .if !defined(KERNCONF) && ${KERNFAST} != "1"
797 .if !defined(KERNCONF) && defined(KERNEL)
801 .if ${TARGET_ARCH} == "powerpc64"
807 INSTKERNNAME?= kernel
809 KERNSRCDIR?= ${.CURDIR}/sys
810 KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
811 KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
812 KERNCONFDIR?= ${KRNLCONFDIR}
816 .for _kernel in ${KERNCONF}
817 .if exists(${KERNCONFDIR}/${_kernel})
818 BUILDKERNELS+= ${_kernel}
819 .if empty(INSTALLKERNEL)
820 INSTALLKERNEL= ${_kernel}
828 # Builds all kernels defined by BUILDKERNELS.
831 .if empty(BUILDKERNELS)
832 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
835 .if defined(KERNWARN)
836 @echo "--------------------------------------------------------------"
837 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
838 @echo "--------------------------------------------------------------"
842 .for _kernel in ${BUILDKERNELS}
843 @echo "--------------------------------------------------------------"
844 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
845 @echo "--------------------------------------------------------------"
846 @echo "===> ${_kernel}"
847 mkdir -p ${KRNLOBJDIR}
848 .if !defined(NO_KERNELCONFIG)
850 @echo "--------------------------------------------------------------"
851 @echo ">>> stage 1: configuring the kernel"
852 @echo "--------------------------------------------------------------"
855 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
856 ${KERNCONFDIR}/${_kernel}
858 .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
860 @echo "--------------------------------------------------------------"
861 @echo ">>> stage 2.1: cleaning up the object tree"
862 @echo "--------------------------------------------------------------"
863 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
865 .if !defined(NO_KERNELOBJ)
867 @echo "--------------------------------------------------------------"
868 @echo ">>> stage 2.2: rebuilding the object tree"
869 @echo "--------------------------------------------------------------"
870 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
873 @echo "--------------------------------------------------------------"
874 @echo ">>> stage 2.3: build tools"
875 @echo "--------------------------------------------------------------"
876 cd ${KRNLOBJDIR}/${_kernel}; \
877 PATH=${BPATH}:${PATH} \
878 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
879 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \
880 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
881 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
882 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
883 .for target in obj depend all
884 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
885 PATH=${BPATH}:${PATH} \
886 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
887 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target}
890 .if !defined(NO_KERNELDEPEND)
892 @echo "--------------------------------------------------------------"
893 @echo ">>> stage 3.1: making dependencies"
894 @echo "--------------------------------------------------------------"
895 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
898 @echo "--------------------------------------------------------------"
899 @echo ">>> stage 3.2: building everything"
900 @echo "--------------------------------------------------------------"
901 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
902 @echo "--------------------------------------------------------------"
903 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
904 @echo "--------------------------------------------------------------"
908 # installkernel, etc.
910 # Install the kernel defined by INSTALLKERNEL
912 installkernel installkernel.debug \
913 reinstallkernel reinstallkernel.debug: installcheck
914 .if empty(INSTALLKERNEL)
915 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
918 @echo "--------------------------------------------------------------"
919 @echo ">>> Installing kernel ${INSTALLKERNEL}"
920 @echo "--------------------------------------------------------------"
921 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
922 ${CROSSENV} PATH=${TMPPATH} \
923 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
925 distributekernel distributekernel.debug:
926 .if empty(INSTALLKERNEL)
927 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
930 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
931 ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \
932 DESTDIR=${DESTDIR}/${DISTDIR}/kernel \
933 ${.TARGET:S/distributekernel/install/}
934 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
935 cd ${KRNLOBJDIR}/${_kernel}; \
936 ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
937 KERNEL=${INSTKERNNAME}.${_kernel} \
938 DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \
939 ${.TARGET:S/distributekernel/install/}
943 cd ${DESTDIR}/${DISTDIR}/kernel; \
944 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz .
945 .for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//}
946 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
947 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz .
953 # Build the API documentation with doxygen
956 @if [ ! -x `/usr/bin/which doxygen` ]; then \
957 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
960 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
965 # Update the source tree(s), by running cvsup/cvs/svn to update to the
969 .if defined(SUP_UPDATE)
970 @echo "--------------------------------------------------------------"
971 @echo ">>> Running ${SUP}"
972 @echo "--------------------------------------------------------------"
973 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
974 @echo "!! Update methods with ${SUP} are deprecated."
975 @echo "!! Please see http://www.freebsd.org/handbook/svn.html"
976 @echo "!! and convert your update method to SVN_UPDATE or"
977 @echo "!! freebsd-update(8)."
978 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!"
981 @${SUP} ${SUPFLAGS} ${SUPFILE}
983 .if defined(SUPFILE1)
984 @${SUP} ${SUPFLAGS} ${SUPFILE1}
986 .if defined(SUPFILE2)
987 @${SUP} ${SUPFLAGS} ${SUPFILE2}
989 .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
990 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
992 .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
993 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
996 .if defined(CVS_UPDATE)
998 if [ -d CVS ] ; then \
999 echo "--------------------------------------------------------------" ; \
1000 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \
1001 echo "--------------------------------------------------------------" ; \
1002 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
1003 echo "!! Update methods with CVS are deprecated." ; \
1004 echo "!! Please see http://www.freebsd.org/handbook/svn.html" ; \
1005 echo "!! and convert your update method to SVN_UPDATE or" ; \
1006 echo "!! freebsd-update(8)." ; \
1007 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \
1009 echo ${CVS} -R -q update ${CVSFLAGS} ; \
1010 ${CVS} -R -q update ${CVSFLAGS} ; \
1013 .if defined(SVN_UPDATE)
1015 if [ -d .svn ] ; then \
1016 echo "--------------------------------------------------------------" ; \
1017 echo ">>> Updating ${.CURDIR} using Subversion" ; \
1018 echo "--------------------------------------------------------------" ; \
1019 echo ${SVN} update ${SVNFLAGS} ; \
1020 ${SVN} update ${SVNFLAGS} ; \
1025 # ------------------------------------------------------------------------
1027 # From here onwards are utility targets used by the 'make world' and
1028 # related targets. If your 'world' breaks, you may like to try to fix
1029 # the problem and manually run the following targets to attempt to
1030 # complete the build. Beware, this is *not* guaranteed to work, you
1031 # need to have a pretty good grip on the current state of the system
1032 # to attempt to manually finish it. If in doubt, 'make world' again.
1036 # legacy: Build compatibility shims for the next three targets
1039 .if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0
1040 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \
1043 .for _tool in tools/build
1044 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
1045 cd ${.CURDIR}/${_tool}; \
1046 ${MAKE} DIRPRFX=${_tool}/ obj; \
1047 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
1048 ${MAKE} DIRPRFX=${_tool}/ depend; \
1049 ${MAKE} DIRPRFX=${_tool}/ all; \
1050 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1054 # bootstrap-tools: Build tools needed for compatibility
1056 .if ${MK_GAMES} != "no"
1057 _strfile= games/fortune/strfile
1060 .if ${MK_CXX} != "no"
1061 _gperf= gnu/usr.bin/gperf
1064 .if ${MK_GROFF} != "no"
1065 _groff= gnu/usr.bin/groff
1068 .if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022
1072 .if ${BOOTSTRAPPING} < 800013
1073 _mklocale= usr.bin/mklocale
1076 .if ${BOOTSTRAPPING} < 900002
1080 .if ${BOOTSTRAPPING} < 900006
1084 .if ${BOOTSTRAPPING} < 900006 || ${BOOTSTRAPPING} >= 1000013
1088 .if ${BOOTSTRAPPING} < 1000026
1089 _nmtree= lib/libnetbsd \
1093 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
1097 .if ${MK_BSNMP} != "no" && \
1098 (${BOOTSTRAPPING} < 700018 || !exists(/usr/sbin/gensnmptree))
1099 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
1102 .if ${MK_RESCUE} != "no" && \
1103 ${BOOTSTRAPPING} < 700026
1104 _crunchgen= usr.sbin/crunch/crunchgen
1107 .if ${MK_CLANG} != "no"
1109 lib/clang/libllvmsupport \
1110 lib/clang/libllvmtablegen \
1111 usr.bin/clang/tblgen \
1112 usr.bin/clang/clang-tblgen
1115 .if ${MK_CDDL} != "no" && \
1116 ${BOOTSTRAPPING} < 800038 && \
1117 !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)
1118 _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
1119 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
1122 .if ${MK_FDT} != "no"
1123 _dtc= gnu/usr.bin/dtc
1126 # Please document (add comment) why something is in 'bootstrap-tools'.
1127 # Try to bound the building of the bootstrap-tool to just the
1128 # FreeBSD versions that need the tool built at this stage of the build.
1140 usr.bin/makewhatis \
1152 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1153 cd ${.CURDIR}/${_tool}; \
1154 ${MAKE} DIRPRFX=${_tool}/ obj; \
1155 ${MAKE} DIRPRFX=${_tool}/ depend; \
1156 ${MAKE} DIRPRFX=${_tool}/ all; \
1157 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
1161 # build-tools: Build special purpose build tools
1163 .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
1164 _aicasm= sys/modules/aic7xxx/aicasm
1167 .if !defined(NO_SHARE)
1168 _share= share/syscons/scrnmaps
1171 .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1172 _gcc_tools= gnu/usr.bin/cc/cc_tools
1175 .if ${MK_KERBEROS} != "no"
1176 _kerberos5_tools= kerberos5/tools
1179 .if ${MK_RESCUE} != "no"
1180 _rescue= rescue/rescue
1188 lib/ncurses/ncurses \
1189 lib/ncurses/ncursesw \
1194 usr.sbin/sysinstall \
1195 usr.bin/mkesdb_static \
1196 usr.bin/mkcsmapper_static
1197 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
1198 cd ${.CURDIR}/${_tool}; \
1199 ${MAKE} DIRPRFX=${_tool}/ obj; \
1200 ${MAKE} DIRPRFX=${_tool}/ build-tools
1205 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
1206 cd ${.CURDIR}/${_tool}; \
1207 ${MAKE} DIRPRFX=${_tool}/ obj; \
1208 ${MAKE} DIRPRFX=${_tool}/ depend; \
1209 ${MAKE} DIRPRFX=${_tool}/ all
1213 # cross-tools: Build cross-building tools
1215 .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035
1216 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
1217 _btxld= usr.sbin/btxld
1220 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
1221 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
1222 _crunchide= usr.sbin/crunch/crunchide
1224 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
1225 _kgzip= usr.sbin/kgzip
1229 .if ${MK_BINUTILS} != "no"
1230 _binutils= gnu/usr.bin/binutils
1233 .if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang")
1234 _clang= usr.bin/clang
1235 _clang_libs= lib/clang
1238 .if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98")
1248 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
1252 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
1253 cd ${.CURDIR}/${_tool}; \
1254 ${MAKE} DIRPRFX=${_tool}/ obj; \
1255 ${MAKE} DIRPRFX=${_tool}/ depend; \
1256 ${MAKE} DIRPRFX=${_tool}/ all; \
1257 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
1261 # hierarchy - ensure that all the needed directories are present
1264 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs
1267 # libraries - build all libraries, and install them under ${DESTDIR}.
1269 # The list of libraries with dependents (${_prebuild_libs}) and their
1270 # interdependencies (__L) are built automatically by the
1271 # ${.CURDIR}/tools/make_libdeps.sh script.
1275 ${MAKE} -f Makefile.inc1 _prereq_libs; \
1276 ${MAKE} -f Makefile.inc1 _startup_libs; \
1277 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
1278 ${MAKE} -f Makefile.inc1 _generic_libs;
1281 # static libgcc.a prerequisite for shared libc
1283 _prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt
1285 # These dependencies are not automatically generated:
1287 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1288 # all shared libraries for ELF.
1290 _startup_libs= gnu/lib/csu
1291 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1292 _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1293 .elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
1294 _startup_libs+= lib/csu/${MACHINE_ARCH}
1296 _startup_libs+= lib/csu/${MACHINE_CPUARCH}
1298 _startup_libs+= gnu/lib/libgcc
1299 _startup_libs+= lib/libcompiler_rt
1300 _startup_libs+= lib/libc
1301 .if ${MK_LIBCPLUSPLUS} != "no"
1302 _startup_libs+= lib/libcxxrt
1305 gnu/lib/libgcc__L: lib/libc__L
1306 .if ${MK_LIBCPLUSPLUS} != "no"
1307 lib/libcxxrt__L: gnu/lib/libgcc__L
1310 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libhdb} \
1311 ${_kerberos5_lib_libheimntlm} \
1312 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
1313 ${_kerberos5_lib_libroken} \
1314 lib/libbz2 lib/libcom_err lib/libcrypt \
1316 ${_lib_libgssapi} ${_lib_libipx} \
1317 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \
1318 lib/ncurses/ncurses lib/ncurses/ncursesw \
1319 lib/libopie lib/libpam ${_lib_libthr} \
1320 lib/libradius lib/libsbuf lib/libtacplus \
1321 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
1322 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \
1323 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1324 ${_secure_lib_libssl}
1326 .if ${MK_LIBTHR} != "no"
1327 _lib_libthr= lib/libthr
1330 .if ${MK_OFED} != "no"
1331 _ofed_lib= contrib/ofed/usr.lib/
1334 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib}
1336 lib/libopie__L lib/libtacplus__L: lib/libmd__L
1338 .if ${MK_CDDL} != "no"
1339 _cddl_lib_libumem= cddl/lib/libumem
1340 _cddl_lib_libnvpair= cddl/lib/libnvpair
1344 .if ${MK_CRYPT} != "no"
1345 .if ${MK_OPENSSL} != "no"
1346 _secure_lib_libcrypto= secure/lib/libcrypto
1347 _secure_lib_libssl= secure/lib/libssl
1348 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1349 .if ${MK_OPENSSH} != "no"
1350 _secure_lib_libssh= secure/lib/libssh
1351 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1352 .if ${MK_KERBEROS_SUPPORT} != "no"
1353 secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1354 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \
1355 lib/libmd__L kerberos5/lib/libroken__L
1359 _secure_lib= secure/lib
1362 .if ${MK_KERBEROS} != "no"
1363 kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L
1364 kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1365 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L
1366 kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L
1367 kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1368 secure/lib/libcrypto__L kerberos5/lib/libroken__L
1369 kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \
1370 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \
1371 kerberos5/lib/libroken__L
1372 kerberos5/lib/libroken__L: lib/libcrypt__L
1375 .if ${MK_GSSAPI} != "no"
1376 _lib_libgssapi= lib/libgssapi
1379 .if ${MK_IPX} != "no"
1380 _lib_libipx= lib/libipx
1383 .if ${MK_KERBEROS} != "no"
1384 _kerberos5_lib= kerberos5/lib
1385 _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1386 _kerberos5_lib_libhdb= kerberos5/lib/libhdb
1387 _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1388 _kerberos5_lib_libhx509= kerberos5/lib/libhx509
1389 _kerberos5_lib_libroken= kerberos5/lib/libroken
1390 _kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm
1393 .if ${MK_NIS} != "no"
1394 _lib_libypclnt= lib/libypclnt
1397 .if ${MK_OPENSSL} == "no"
1398 lib/libradius__L: lib/libmd__L
1401 .for _lib in ${_prereq_libs}
1403 .if exists(${.CURDIR}/${_lib})
1404 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1405 cd ${.CURDIR}/${_lib}; \
1406 ${MAKE} DIRPRFX=${_lib}/ obj; \
1407 ${MAKE} DIRPRFX=${_lib}/ depend; \
1408 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1409 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1413 .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1415 .if exists(${.CURDIR}/${_lib})
1416 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1417 cd ${.CURDIR}/${_lib}; \
1418 ${MAKE} DIRPRFX=${_lib}/ obj; \
1419 ${MAKE} DIRPRFX=${_lib}/ depend; \
1420 ${MAKE} DIRPRFX=${_lib}/ all; \
1421 ${MAKE} DIRPRFX=${_lib}/ install
1425 # libpam is special: we need to build static PAM modules before
1426 # static PAM library, and dynamic PAM library before dynamic PAM
1428 lib/libpam__L: .PHONY
1429 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1430 cd ${.CURDIR}/lib/libpam; \
1431 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1432 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1433 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1434 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1436 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1437 _startup_libs: ${_startup_libs:S/$/__L/}
1438 _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1439 _generic_libs: ${_generic_libs:S/$/__L/}
1441 .for __target in all clean cleandepend cleandir depend includes obj
1442 .for entry in ${SUBDIR}
1443 ${entry}.${__target}__D: .PHONY
1444 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1445 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1446 edir=${entry}.${MACHINE_ARCH}; \
1447 cd ${.CURDIR}/$${edir}; \
1449 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1451 cd ${.CURDIR}/$${edir}; \
1453 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1455 par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1458 .include <bsd.subdir.mk>
1460 .if make(check-old) || make(check-old-dirs) || \
1461 make(check-old-files) || make(check-old-libs) || \
1462 make(delete-old) || make(delete-old-dirs) || \
1463 make(delete-old-files) || make(delete-old-libs)
1466 # check for / delete old files section
1469 .include "ObsoleteFiles.inc"
1471 OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1472 else you can not start such an application. Consult UPDATING for more \
1473 information regarding how to cope with the removal/revision bump of a \
1476 .if !defined(BATCH_DELETE_OLD_FILES)
1483 @echo ">>> Removing old files (only deletes safe to delete libs)"
1484 # Ask for every old file if the user really wants to remove it.
1485 # It's annoying, but better safe than sorry.
1486 # NB: We cannot pass the list of OLD_FILES as a parameter because the
1487 # argument list will get too long. Using .for/.endfor make "loops" will make
1488 # the Makefile parser segfault.
1490 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1491 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1492 while read file; do \
1493 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1494 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1495 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1498 # Remove catpages without corresponding manpages.
1500 find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1501 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1502 while read catpage; do \
1504 if [ ! -e "$${manpage}" ]; then \
1505 rm ${RM_I} $${catpage} <&3; \
1508 @echo ">>> Old files removed"
1511 @echo ">>> Checking for old files"
1512 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1513 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \
1514 while read file; do \
1515 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1516 echo "${DESTDIR}/$${file}"; \
1519 # Check for catpages without corresponding manpages.
1520 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1521 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1522 while read catpage; do \
1524 if [ ! -e "$${manpage}" ]; then \
1530 @echo ">>> Removing old libraries"
1531 @echo "${OLD_LIBS_MESSAGE}" | fmt
1533 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1534 -V OLD_LIBS | xargs -n1 | \
1535 while read file; do \
1536 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1537 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1538 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \
1541 @echo ">>> Old libraries removed"
1544 @echo ">>> Checking for old libraries"
1545 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1546 -V OLD_LIBS | xargs -n1 | \
1547 while read file; do \
1548 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1549 echo "${DESTDIR}/$${file}"; \
1554 @echo ">>> Removing old directories"
1555 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1556 -V OLD_DIRS | xargs -n1 | \
1557 while read dir; do \
1558 if [ -d "${DESTDIR}/$${dir}" ]; then \
1559 rmdir -v "${DESTDIR}/$${dir}" || true; \
1560 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1561 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1564 @echo ">>> Old directories removed"
1567 @echo ">>> Checking for old directories"
1568 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \
1569 -V OLD_DIRS | xargs -n1 | \
1570 while read dir; do \
1571 if [ -d "${DESTDIR}/$${dir}" ]; then \
1572 echo "${DESTDIR}/$${dir}"; \
1573 elif [ -L "${DESTDIR}/$${dir}" ]; then \
1574 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1578 delete-old: delete-old-files delete-old-dirs
1579 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1581 check-old: check-old-files check-old-libs check-old-dirs
1582 @echo "To remove old files and directories run '${MAKE} delete-old'."
1583 @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1588 # showconfig - show build configuration.
1591 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
1593 .if !empty(KRNLOBJDIR) && !empty(KERNCONF)
1594 DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/
1596 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
1597 .if exists(${KERNCONFDIR}/${KERNCONF})
1598 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \
1599 ${KERNCONFDIR}/${KERNCONF}
1605 .if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH})
1606 DTBOUTPUTPATH= ${.CURDIR}
1610 # Build 'standalone' Device Tree Blob
1613 @if [ "${FDT_DTS_FILE}" = "" ]; then \
1614 echo "ERROR: FDT_DTS_FILE must be specified!"; \
1617 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \
1618 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \
1622 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \
1623 echo "WARNING: DTB will be placed in the current working \
1628 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \
1629 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE}
1633 .if defined(XDEV) && defined(XDEV_ARCH)
1635 .if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH}
1636 XDEV_CPUTYPE?=${CPUTYPE}
1638 XDEV_CPUTYPE?=${TARGET_CPUTYPE}
1641 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
1642 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
1643 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
1644 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
1645 CPUTYPE=${XDEV_CPUTYPE}
1647 XDDIR=${XDEV_ARCH}-freebsd
1649 CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR}
1651 _SHLIBDIRPREFIX=${XDTP} \
1652 TOOLS_PREFIX=${XDTP}
1654 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
1656 CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
1657 CDMAKE=${CDENV} ${MAKE} ${NOFUN}
1658 CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
1659 XDDESTDIR=${DESTDIR}${XDTP}
1661 OSREL!= uname -r | sed -e 's/[-(].*//'
1664 .ORDER: xdev-build xdev-install
1665 xdev: xdev-build xdev-install
1667 .ORDER: _xb-build-tools _xb-cross-tools
1668 xdev-build: _xb-build-tools _xb-cross-tools
1671 ${_+_}@cd ${.CURDIR}; \
1672 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
1676 gnu/usr.bin/binutils \
1679 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
1680 cd ${.CURDIR}/${_tool}; \
1681 ${CDMAKE} DIRPRFX=${_tool}/ obj; \
1682 ${CDMAKE} DIRPRFX=${_tool}/ depend; \
1683 ${CDMAKE} DIRPRFX=${_tool}/ all
1687 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
1688 mkdir -p ${XDDESTDIR}
1689 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
1690 -p ${XDDESTDIR} >/dev/null
1691 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
1692 -p ${XDDESTDIR}/usr >/dev/null
1693 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
1694 -p ${XDDESTDIR}/usr/include >/dev/null
1696 .ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1697 xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
1700 @echo "_xi-cross-tools"
1702 gnu/usr.bin/binutils \
1705 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
1706 cd ${.CURDIR}/${_tool}; \
1707 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
1711 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
1712 DESTDIR=${XDDESTDIR}
1715 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
1716 DESTDIR=${XDDESTDIR}
1719 ${_+_}cd ${XDDESTDIR}/usr/bin; \
1721 ln -sf ../../${XDTP}/usr/bin/$$i \
1722 ../../../../usr/bin/${XDDIR}-$$i; \
1723 ln -sf ../../${XDTP}/usr/bin/$$i \
1724 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \