Makefile.inc1 revision 249807
1# 2# $FreeBSD: head/Makefile.inc1 249807 2013-04-23 13:07:58Z bdrewery $ 3# 4# Make command line options: 5# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 6# -DNO_CLEAN do not clean at all 7# -DDB_FROM_SRC use the user/group databases in src/etc instead of 8# the system database when installing. 9# -DNO_SHARE do not go into share subdir 10# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ} 11# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 12# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 13# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 14# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel 15# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 16# -DNO_ROOT install without using root privilege 17# -DNO_DOCUPDATE do not update doc in ${MAKE} update 18# -DNO_CTF do not run the DTrace CTF conversion tools on built objects 19# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 20# LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target 21# LOCAL_MTREE="list of mtree files" to process to allow local directories 22# to be created before files are installed 23# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools 24# list 25# METALOG="path to metadata log" to write permission and ownership 26# when NO_ROOT is set. (default: ${DESTDIR}/METALOG) 27# TARGET="machine" to crossbuild world for a different machine type 28# TARGET_ARCH= may be required when a TARGET supports multiple endians 29# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh) 30# WORLD_FLAGS= additional flags to pass to make(1) during buildworld 31# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel 32 33# 34# The intended user-driven targets are: 35# buildworld - rebuild *everything*, including glue to help do upgrades 36# installworld- install everything built by "buildworld" 37# doxygen - build API documentation of the kernel 38# update - convenient way to update your source tree (eg: cvsup/cvs) 39# 40# Standard targets (not defined here) are documented in the makefiles in 41# /usr/share/mk. These include: 42# obj depend all install clean cleandepend cleanobj 43 44# You are supposed to define both of these when calling Makefile.inc1 45# directly. However, some old scripts don't. Cope for the moment, but 46# issue a new warning for a transition period. 47.if defined(TARGET) && !defined(TARGET_ARCH) 48.warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}." 49TARGET_ARCH=${TARGET} 50.endif 51.if !defined(TARGET) || !defined(TARGET_ARCH) 52.error "Both TARGET and TARGET_ARCH must be defined." 53.endif 54 55.include <bsd.own.mk> 56.include <bsd.arch.inc.mk> 57.include <bsd.compiler.mk> 58 59# We must do share/info early so that installation of info `dir' 60# entries works correctly. Do it first since it is less likely to 61# grow dependencies on include and lib than vice versa. 62# 63# We must do lib/ and libexec/ before bin/, because if installworld 64# installs a new /bin/sh, the 'make' command will *immediately* 65# use that new version. And the new (dynamically-linked) /bin/sh 66# will expect to find appropriate libraries in /lib and /libexec. 67# 68SUBDIR= share/info lib libexec 69SUBDIR+=bin 70.if ${MK_GAMES} != "no" 71SUBDIR+=games 72.endif 73.if ${MK_CDDL} != "no" 74SUBDIR+=cddl 75.endif 76SUBDIR+=gnu include 77.if ${MK_KERBEROS} != "no" 78SUBDIR+=kerberos5 79.endif 80.if ${MK_RESCUE} != "no" 81SUBDIR+=rescue 82.endif 83SUBDIR+=sbin 84.if ${MK_CRYPT} != "no" 85SUBDIR+=secure 86.endif 87.if !defined(NO_SHARE) 88SUBDIR+=share 89.endif 90SUBDIR+=sys usr.bin usr.sbin 91.if ${MK_OFED} != "no" 92SUBDIR+=contrib/ofed 93.endif 94# 95# We must do etc/ last for install/distribute to work. 96# 97SUBDIR+=etc 98 99# These are last, since it is nice to at least get the base system 100# rebuilt before you do them. 101.for _DIR in ${LOCAL_LIB_DIRS} ${LOCAL_DIRS} 102.if exists(${.CURDIR}/${_DIR}/Makefile) 103SUBDIR+= ${_DIR} 104.endif 105.endfor 106 107.if defined(SUBDIR_OVERRIDE) 108SUBDIR= ${SUBDIR_OVERRIDE} 109.endif 110 111.if defined(NOCLEAN) 112NO_CLEAN= ${NOCLEAN} 113.endif 114.if defined(NO_CLEANDIR) 115CLEANDIR= clean cleandepend 116.else 117CLEANDIR= cleandir 118.endif 119 120LOCAL_TOOL_DIRS?= 121 122BUILDENV_SHELL?=/bin/sh 123 124CVS?= cvs 125CVSFLAGS?= -A -P -d -I! 126SVN?= svn 127SVNFLAGS?= -r HEAD 128SUP?= /usr/bin/csup 129SUPFLAGS?= -g -L 2 130.if defined(SUPHOST) 131SUPFLAGS+= -h ${SUPHOST} 132.endif 133 134MAKEOBJDIRPREFIX?= /usr/obj 135.if !defined(OSRELDATE) 136.if exists(/usr/include/osreldate.h) 137OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 138 /usr/include/osreldate.h 139.else 140OSRELDATE= 0 141.endif 142.endif 143 144.if !defined(VERSION) 145VERSION!= uname -srp 146VERSION+= ${OSRELDATE} 147.endif 148 149KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm armv6eb/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 150.if ${TARGET} == ${TARGET_ARCH} 151_t= ${TARGET} 152.else 153_t= ${TARGET_ARCH}/${TARGET} 154.endif 155.for _t in ${_t} 156.if empty(KNOWN_ARCHES:M${_t}) 157.error Unknown target ${TARGET_ARCH}:${TARGET}. 158.endif 159.endfor 160 161.if ${TARGET} == ${MACHINE} 162TARGET_CPUTYPE?=${CPUTYPE} 163.else 164TARGET_CPUTYPE?= 165.endif 166 167.if !empty(TARGET_CPUTYPE) 168_TARGET_CPUTYPE=${TARGET_CPUTYPE} 169.else 170_TARGET_CPUTYPE=dummy 171.endif 172_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ 173 -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE 174.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 175.error CPUTYPE global should be set with ?=. 176.endif 177.if make(buildworld) 178BUILD_ARCH!= uname -p 179.if ${MACHINE_ARCH} != ${BUILD_ARCH} 180.error To cross-build, set TARGET_ARCH. 181.endif 182.endif 183.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) 184OBJTREE= ${MAKEOBJDIRPREFIX} 185.else 186OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} 187.endif 188WORLDTMP= ${OBJTREE}${.CURDIR}/tmp 189# /usr/games added for fortune which depend on strfile 190BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games:${WORLDTMP}/legacy/bin 191XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 192STRICTTMPPATH= ${BPATH}:${XPATH} 193TMPPATH= ${STRICTTMPPATH}:${PATH} 194 195# 196# Avoid running mktemp(1) unless actually needed. 197# It may not be functional, e.g., due to new ABI 198# when in the middle of installing over this system. 199# 200.if make(distributeworld) || make(installworld) 201INSTALLTMP!= /usr/bin/mktemp -d -u -t install 202.endif 203 204# 205# Building a world goes through the following stages 206# 207# 1. legacy stage [BMAKE] 208# This stage is responsible for creating compatibility 209# shims that are needed by the bootstrap-tools, 210# build-tools and cross-tools stages. 211# 1. bootstrap-tools stage [BMAKE] 212# This stage is responsible for creating programs that 213# are needed for backward compatibility reasons. They 214# are not built as cross-tools. 215# 2. build-tools stage [TMAKE] 216# This stage is responsible for creating the object 217# tree and building any tools that are needed during 218# the build process. 219# 3. cross-tools stage [XMAKE] 220# This stage is responsible for creating any tools that 221# are needed for cross-builds. A cross-compiler is one 222# of them. 223# 4. world stage [WMAKE] 224# This stage actually builds the world. 225# 5. install stage (optional) [IMAKE] 226# This stage installs a previously built world. 227# 228 229BOOTSTRAPPING?= 0 230 231# Common environment for world related stages 232CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 233 MACHINE_ARCH=${TARGET_ARCH} \ 234 MACHINE=${TARGET} \ 235 CPUTYPE=${TARGET_CPUTYPE} 236.if ${MK_GROFF} != "no" 237CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 238 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 239 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 240.endif 241 242# bootstrap-tools stage 243BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 244 PATH=${BPATH}:${PATH} \ 245 WORLDTMP=${WORLDTMP} \ 246 VERSION="${VERSION}" \ 247 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 248 COMPILER_TYPE=${COMPILER_TYPE} 249BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 250 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 251 DESTDIR= \ 252 BOOTSTRAPPING=${OSRELDATE} \ 253 SSP_CFLAGS= \ 254 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ 255 -DNO_PIC -DNO_PROFILE -DNO_SHARED \ 256 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 257 258# build-tools stage 259TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 260 ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ 261 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 262 DESTDIR= \ 263 BOOTSTRAPPING=${OSRELDATE} \ 264 SSP_CFLAGS= \ 265 -DNO_LINT \ 266 -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD 267 268# cross-tools stage 269XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 270 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 271 -DWITHOUT_GDB 272 273# world stage 274WMAKEENV= ${CROSSENV} \ 275 _SHLIBDIRPREFIX=${WORLDTMP} \ 276 _LDSCRIPTROOT= \ 277 VERSION="${VERSION}" \ 278 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 279 PATH=${TMPPATH} 280.if ${MK_CDDL} == "no" 281WMAKEENV+= NO_CTF=1 282.endif 283.if ${CC:T:Mgcc} == "gcc" 284WMAKE_COMPILER_TYPE= gcc 285.elif ${CC:T:Mclang} == "clang" 286WMAKE_COMPILER_TYPE= clang 287.elif ${MK_CLANG_IS_CC} == "no" 288WMAKE_COMPILER_TYPE= gcc 289.else 290WMAKE_COMPILER_TYPE= clang 291.endif 292WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 293WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} 294 295.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" 296# 32 bit world 297LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 298 299.if ${TARGET_ARCH} == "amd64" 300.if empty(TARGET_CPUTYPE) 301LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 302.else 303LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} 304.endif 305LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ 306 MACHINE_CPU="i686 mmx sse sse2" 307LIB32WMAKEFLAGS= \ 308 AS="${AS} --32" \ 309 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" 310 311.elif ${TARGET_ARCH} == "powerpc64" 312.if empty(TARGET_CPUTYPE) 313LIB32CPUFLAGS= -mcpu=powerpc 314.else 315LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE} 316.endif 317LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc 318LIB32WMAKEFLAGS= \ 319 LD="${LD} -m elf32ppc_fbsd" 320.endif 321 322 323LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \ 324 -isystem ${LIB32TMP}/usr/include/ \ 325 -L${LIB32TMP}/usr/lib32 \ 326 -B${LIB32TMP}/usr/lib32 327 328# Yes, the flags are redundant. 329LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ 330 _SHLIBDIRPREFIX=${LIB32TMP} \ 331 _LDSCRIPTROOT=${LIB32TMP} \ 332 VERSION="${VERSION}" \ 333 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 334 PATH=${TMPPATH} \ 335 LIBDIR=/usr/lib32 \ 336 SHLIBDIR=/usr/lib32 \ 337 COMPILER_TYPE=${WMAKE_COMPILER_TYPE} 338LIB32WMAKEFLAGS+= \ 339 CC="${CC} ${LIB32FLAGS}" \ 340 CXX="${CXX} ${LIB32FLAGS}" \ 341 DESTDIR=${LIB32TMP} \ 342 -DCOMPAT_32BIT \ 343 -DLIBRARIES_ONLY \ 344 -DNO_CPU_CFLAGS \ 345 -DNO_CTF \ 346 -DNO_LINT 347 348LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \ 349 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML 350LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \ 351 ${IMAKE_INSTALL} 352.endif 353 354IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} 355IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \ 356 ${IMAKE_INSTALL} ${IMAKE_MTREE} 357.if empty(.MAKEFLAGS:M-n) 358IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ 359 LD_LIBRARY_PATH=${INSTALLTMP} \ 360 PATH_LOCALE=${INSTALLTMP}/locale 361IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh 362.else 363IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} 364.endif 365.if defined(DB_FROM_SRC) 366INSTALLFLAGS+= -N ${.CURDIR}/etc 367MTREEFLAGS+= -N ${.CURDIR}/etc 368.endif 369.if defined(NO_ROOT) 370METALOG?= ${DESTDIR}/${DISTDIR}/METALOG 371IMAKE+= -DNO_ROOT METALOG=${METALOG} 372INSTALL_DDIR= ${DESTDIR}/${DISTDIR} 373INSTALLFLAGS+= -U -M ${METALOG} -D ${INSTALL_DDIR:S://:/:g:C:/$::} 374MTREEFLAGS+= -W 375.endif 376.if defined(DB_FROM_SRC) || defined(NO_ROOT) 377IMAKE_INSTALL= INSTALL="install ${INSTALLFLAGS}" 378IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}" 379.endif 380 381# kernel stage 382KMAKEENV= ${WMAKEENV} 383KMAKE= ${KMAKEENV} ${MAKE} ${.MAKEFLAGS} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} 384 385# 386# buildworld 387# 388# Attempt to rebuild the entire system, with reasonable chance of 389# success, regardless of how old your existing system is. 390# 391_worldtmp: 392.if ${.CURDIR:C/[^,]//g} != "" 393# The m4 build of sendmail files doesn't like it if ',' is used 394# anywhere in the path of it's files. 395 @echo 396 @echo "*** Error: path to source tree contains a comma ','" 397 @echo 398 false 399.endif 400 @echo 401 @echo "--------------------------------------------------------------" 402 @echo ">>> Rebuilding the temporary build tree" 403 @echo "--------------------------------------------------------------" 404.if !defined(NO_CLEAN) 405 rm -rf ${WORLDTMP} 406.if defined(LIB32TMP) 407 rm -rf ${LIB32TMP} 408.endif 409.else 410 rm -rf ${WORLDTMP}/legacy/usr/include 411# XXX - These three can depend on any header file. 412 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 413 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c 414 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 415.endif 416.for _dir in \ 417 lib usr legacy/bin legacy/usr 418 mkdir -p ${WORLDTMP}/${_dir} 419.endfor 420 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 421 -p ${WORLDTMP}/legacy/usr >/dev/null 422.if ${MK_GROFF} != "no" 423 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ 424 -p ${WORLDTMP}/legacy/usr >/dev/null 425.endif 426 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 427 -p ${WORLDTMP}/usr >/dev/null 428 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 429 -p ${WORLDTMP}/usr/include >/dev/null 430 ln -sf ${.CURDIR}/sys ${WORLDTMP} 431.if ${MK_BIND_LIBS} != "no" 432 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ 433 -p ${WORLDTMP}/usr/include >/dev/null 434.endif 435.for _mtree in ${LOCAL_MTREE} 436 mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null 437.endfor 438_legacy: 439 @echo 440 @echo "--------------------------------------------------------------" 441 @echo ">>> stage 1.1: legacy release compatibility shims" 442 @echo "--------------------------------------------------------------" 443 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 444_bootstrap-tools: 445 @echo 446 @echo "--------------------------------------------------------------" 447 @echo ">>> stage 1.2: bootstrap tools" 448 @echo "--------------------------------------------------------------" 449 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 450_cleanobj: 451.if !defined(NO_CLEAN) 452 @echo 453 @echo "--------------------------------------------------------------" 454 @echo ">>> stage 2.1: cleaning up the object tree" 455 @echo "--------------------------------------------------------------" 456 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 457.if defined(LIB32TMP) 458 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} 459.endif 460.endif 461_obj: 462 @echo 463 @echo "--------------------------------------------------------------" 464 @echo ">>> stage 2.2: rebuilding the object tree" 465 @echo "--------------------------------------------------------------" 466 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj 467_build-tools: 468 @echo 469 @echo "--------------------------------------------------------------" 470 @echo ">>> stage 2.3: build tools" 471 @echo "--------------------------------------------------------------" 472 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 473_cross-tools: 474 @echo 475 @echo "--------------------------------------------------------------" 476 @echo ">>> stage 3: cross tools" 477 @echo "--------------------------------------------------------------" 478 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 479_includes: 480 @echo 481 @echo "--------------------------------------------------------------" 482 @echo ">>> stage 4.1: building includes" 483 @echo "--------------------------------------------------------------" 484 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 485_libraries: 486 @echo 487 @echo "--------------------------------------------------------------" 488 @echo ">>> stage 4.2: building libraries" 489 @echo "--------------------------------------------------------------" 490 ${_+_}cd ${.CURDIR}; \ 491 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 492 -DWITHOUT_MAN -DNO_PROFILE libraries 493_depend: 494 @echo 495 @echo "--------------------------------------------------------------" 496 @echo ">>> stage 4.3: make dependencies" 497 @echo "--------------------------------------------------------------" 498 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend 499everything: 500 @echo 501 @echo "--------------------------------------------------------------" 502 @echo ">>> stage 4.4: building everything" 503 @echo "--------------------------------------------------------------" 504 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all 505.if defined(LIB32TMP) 506build32: 507 @echo 508 @echo "--------------------------------------------------------------" 509 @echo ">>> stage 5.1: building 32 bit shim libraries" 510 @echo "--------------------------------------------------------------" 511 mkdir -p ${LIB32TMP}/usr/include 512 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 513 -p ${LIB32TMP}/usr >/dev/null 514 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 515 -p ${LIB32TMP}/usr/include >/dev/null 516 mkdir -p ${WORLDTMP} 517 ln -sf ${.CURDIR}/sys ${WORLDTMP} 518.for _t in obj includes 519 cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t} 520 cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t} 521.if ${MK_CDDL} != "no" 522 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t} 523.endif 524 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t} 525.if ${MK_CRYPT} != "no" 526 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t} 527.endif 528.if ${MK_KERBEROS} != "no" 529 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t} 530.endif 531.endfor 532.for _dir in usr.bin/lex/lib 533 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj 534.endfor 535.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic 536 cd ${.CURDIR}/${_dir}; \ 537 WORLDTMP=${WORLDTMP} \ 538 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ 539 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ 540 DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \ 541 -DEARLY_BUILD build-tools 542.endfor 543 cd ${.CURDIR}; \ 544 ${LIB32WMAKE} -f Makefile.inc1 libraries 545.for _t in obj depend all 546 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \ 547 DIRPRFX=libexec/rtld-elf/ ${_t} 548 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \ 549 DIRPRFX=usr.bin/ldd ${_t} 550.endfor 551 552distribute32 install32: 553 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 554.if ${MK_CDDL} != "no" 555 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 556.endif 557 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 558.if ${MK_CRYPT} != "no" 559 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 560.endif 561.if ${MK_KERBEROS} != "no" 562 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 563.endif 564 cd ${.CURDIR}/libexec/rtld-elf; \ 565 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} 566 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} 567.endif 568 569WMAKE_TGTS= 570.if !defined(SUBDIR_OVERRIDE) 571WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 572.endif 573WMAKE_TGTS+= _cleanobj _obj _build-tools 574.if !defined(SUBDIR_OVERRIDE) 575WMAKE_TGTS+= _cross-tools 576.endif 577WMAKE_TGTS+= _includes _libraries _depend everything 578.if defined(LIB32TMP) && ${MK_LIB32} != "no" 579WMAKE_TGTS+= build32 580.endif 581 582buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 583.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 584 585buildworld_prologue: 586 @echo "--------------------------------------------------------------" 587 @echo ">>> World build started on `LC_ALL=C date`" 588 @echo "--------------------------------------------------------------" 589 590buildworld_epilogue: 591 @echo 592 @echo "--------------------------------------------------------------" 593 @echo ">>> World build completed on `LC_ALL=C date`" 594 @echo "--------------------------------------------------------------" 595 596# 597# We need to have this as a target because the indirection between Makefile 598# and Makefile.inc1 causes the correct PATH to be used, rather than a 599# modification of the current environment's PATH. In addition, we need 600# to quote multiword values. 601# 602buildenvvars: 603 @echo ${WMAKEENV:Q} 604 605buildenv: 606 @echo Entering world for ${TARGET_ARCH}:${TARGET} 607 @cd ${.CURDIR} && env ${WMAKEENV} ${BUILDENV_SHELL} || true 608 609TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} 610toolchain: ${TOOLCHAIN_TGTS} 611kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 612 613# 614# installcheck 615# 616# Checks to be sure system is ready for installworld/installkernel. 617# 618installcheck: 619 620# 621# Require DESTDIR to be set if installing for a different architecture or 622# using the user/group database in the source tree. 623# 624.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \ 625 defined(DB_FROM_SRC) 626.if !make(distributeworld) 627installcheck: installcheck_DESTDIR 628installcheck_DESTDIR: 629.if !defined(DESTDIR) || empty(DESTDIR) 630 @echo "ERROR: Please set DESTDIR!"; \ 631 false 632.endif 633.endif 634.endif 635 636.if !defined(DB_FROM_SRC) 637# 638# Check for missing UIDs/GIDs. 639# 640CHECK_UIDS= auditdistd 641CHECK_GIDS= audit 642.if ${MK_SENDMAIL} != "no" 643CHECK_UIDS+= smmsp 644CHECK_GIDS+= smmsp 645.endif 646.if ${MK_PF} != "no" 647CHECK_UIDS+= proxy 648CHECK_GIDS+= proxy authpf 649.endif 650installcheck_UGID: 651.for uid in ${CHECK_UIDS} 652 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 653 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 654 false; \ 655 fi 656.endfor 657.for gid in ${CHECK_GIDS} 658 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 659 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 660 false; \ 661 fi 662.endfor 663.endif 664 665# 666# Required install tools to be saved in a scratch dir for safety. 667# 668.if ${MK_INFO} != "no" 669_install-info= install-info 670.endif 671.if ${MK_ZONEINFO} != "no" 672_zoneinfo= zic tzsetup 673.endif 674 675.if exists(/usr/sbin/nmtree) 676_nmtree_itools= nmtree 677.endif 678 679ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ 680 date echo egrep find grep id install ${_install-info} \ 681 ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \ 682 rm sed sh sysctl test true uname wc ${_zoneinfo} 683 684# 685# distributeworld 686# 687# Distributes everything compiled by a `buildworld'. 688# 689# installworld 690# 691# Installs everything compiled by a 'buildworld'. 692# 693 694# Non-base distributions produced by the base system 695EXTRA_DISTRIBUTIONS= doc 696.if ${MK_GAMES} != "no" 697EXTRA_DISTRIBUTIONS+= games 698.endif 699.if defined(LIB32TMP) && ${MK_LIB32} != "no" 700EXTRA_DISTRIBUTIONS+= lib32 701.endif 702 703MTREE_MAGIC?= mtree 2.0 704 705distributeworld installworld: installcheck installcheck_UGID 706 mkdir -p ${INSTALLTMP} 707 progs=$$(for prog in ${ITOOLS}; do \ 708 if progpath=`which $$prog`; then \ 709 echo $$progpath; \ 710 else \ 711 echo "Required tool $$prog not found in PATH." >&2; \ 712 exit 1; \ 713 fi; \ 714 done); \ 715 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 716 while read line; do \ 717 set -- $$line; \ 718 if [ "$$2 $$3" != "not found" ]; then \ 719 echo $$2; \ 720 else \ 721 echo "Required library $$1 not found." >&2; \ 722 exit 1; \ 723 fi; \ 724 done); \ 725 cp $$libs $$progs ${INSTALLTMP} 726 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 727.if defined(NO_ROOT) 728 echo "#${MTREE_MAGIC}" > ${METALOG} 729.endif 730.if make(distributeworld) 731.for dist in ${EXTRA_DISTRIBUTIONS} 732 -mkdir ${DESTDIR}/${DISTDIR}/${dist} 733 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 734 -p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null 735 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 736 -p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null 737 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 738 -p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null 739.if defined(NO_ROOT) 740 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.root.dist | \ 741 sed -e 's#^\./#./${dist}/#' >> ${METALOG} 742 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.usr.dist | \ 743 sed -e 's#^\./#./${dist}/usr/#' >> ${METALOG} 744 ${IMAKEENV} nmtree -C -f ${.CURDIR}/etc/mtree/BSD.include.dist | \ 745 sed -e 's#^\./#./${dist}/usr/include/#' >> ${METALOG} 746.endif 747.endfor 748 -mkdir ${DESTDIR}/${DISTDIR}/base 749 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 750 METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ 751 DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ 752 LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs 753.endif 754 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 755 ${IMAKEENV} rm -rf ${INSTALLTMP} 756.if make(distributeworld) 757.for dist in ${EXTRA_DISTRIBUTIONS} 758 find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete 759.endfor 760.if defined(NO_ROOT) 761.for dist in base ${EXTRA_DISTRIBUTIONS} 762 @# For each file that exists in this dist, print the corresponding 763 @# line from the METALOG. This relies on the fact that 764 @# a line containing only the filename will sort immediatly before 765 @# the relevant mtree line. 766 cd ${DESTDIR}/${DISTDIR}; \ 767 find ./${dist} | sort -u ${METALOG} - | \ 768 awk 'BEGIN { print "#${MTREE_MAGIC}" } !/ type=/ { file = $$1 } / type=/ { if ($$1 == file) { sub(/^\.\/${dist}\//, "./"); print } }' > \ 769 ${DESTDIR}/${DISTDIR}/${dist}.meta 770.endfor 771.endif 772.endif 773 774packageworld: 775.for dist in base ${EXTRA_DISTRIBUTIONS} 776.if defined(NO_ROOT) 777 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 778 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz \ 779 @${DESTDIR}/${DISTDIR}/${dist}.meta 780.else 781 ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ 782 tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz . 783.endif 784.endfor 785 786# 787# reinstall 788# 789# If you have a build server, you can NFS mount the source and obj directories 790# and do a 'make reinstall' on the *client* to install new binaries from the 791# most recent server build. 792# 793reinstall: 794 @echo "--------------------------------------------------------------" 795 @echo ">>> Making hierarchy" 796 @echo "--------------------------------------------------------------" 797 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ 798 LOCAL_MTREE=${LOCAL_MTREE} hierarchy 799 @echo 800 @echo "--------------------------------------------------------------" 801 @echo ">>> Installing everything" 802 @echo "--------------------------------------------------------------" 803 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 804.if defined(LIB32TMP) && ${MK_LIB32} != "no" 805 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 806.endif 807 808redistribute: 809 @echo "--------------------------------------------------------------" 810 @echo ">>> Distributing everything" 811 @echo "--------------------------------------------------------------" 812 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 813.if defined(LIB32TMP) && ${MK_LIB32} != "no" 814 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ 815 DISTRIBUTION=lib32 816.endif 817 818distrib-dirs distribution: 819 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 820 ${IMAKE_INSTALL} ${IMAKE_MTREE} METALOG=${METALOG} ${.TARGET} 821 822# 823# buildkernel and installkernel 824# 825# Which kernels to build and/or install is specified by setting 826# KERNCONF. If not defined a GENERIC kernel is built/installed. 827# Only the existing (depending TARGET) config files are used 828# for building kernels and only the first of these is designated 829# as the one being installed. 830# 831# Note that we have to use TARGET instead of TARGET_ARCH when 832# we're in kernel-land. Since only TARGET_ARCH is (expected) to 833# be set to cross-build, we have to make sure TARGET is set 834# properly. 835 836.if defined(KERNFAST) 837NO_KERNELCLEAN= t 838NO_KERNELCONFIG= t 839NO_KERNELDEPEND= t 840NO_KERNELOBJ= t 841# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 842.if !defined(KERNCONF) && ${KERNFAST} != "1" 843KERNCONF=${KERNFAST} 844.endif 845.endif 846.if !defined(KERNCONF) && defined(KERNEL) 847KERNCONF= ${KERNEL} 848KERNWARN= 849.else 850.if ${TARGET_ARCH} == "powerpc64" 851KERNCONF?= GENERIC64 852.else 853KERNCONF?= GENERIC 854.endif 855.endif 856INSTKERNNAME?= kernel 857 858KERNSRCDIR?= ${.CURDIR}/sys 859KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 860KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 861KERNCONFDIR?= ${KRNLCONFDIR} 862 863BUILDKERNELS= 864INSTALLKERNEL= 865.for _kernel in ${KERNCONF} 866.if exists(${KERNCONFDIR}/${_kernel}) 867BUILDKERNELS+= ${_kernel} 868.if empty(INSTALLKERNEL) 869INSTALLKERNEL= ${_kernel} 870.endif 871.endif 872.endfor 873 874# 875# buildkernel 876# 877# Builds all kernels defined by BUILDKERNELS. 878# 879buildkernel: 880.if empty(BUILDKERNELS) 881 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 882 false 883.endif 884.if defined(KERNWARN) 885 @echo "--------------------------------------------------------------" 886 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 887 @echo "--------------------------------------------------------------" 888 @sleep 3 889.endif 890 @echo 891.for _kernel in ${BUILDKERNELS} 892 @echo "--------------------------------------------------------------" 893 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 894 @echo "--------------------------------------------------------------" 895 @echo "===> ${_kernel}" 896 mkdir -p ${KRNLOBJDIR} 897.if !defined(NO_KERNELCONFIG) 898 @echo 899 @echo "--------------------------------------------------------------" 900 @echo ">>> stage 1: configuring the kernel" 901 @echo "--------------------------------------------------------------" 902 cd ${KRNLCONFDIR}; \ 903 PATH=${TMPPATH} \ 904 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 905 ${KERNCONFDIR}/${_kernel} 906.endif 907.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 908 @echo 909 @echo "--------------------------------------------------------------" 910 @echo ">>> stage 2.1: cleaning up the object tree" 911 @echo "--------------------------------------------------------------" 912 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 913.endif 914.if !defined(NO_KERNELOBJ) 915 @echo 916 @echo "--------------------------------------------------------------" 917 @echo ">>> stage 2.2: rebuilding the object tree" 918 @echo "--------------------------------------------------------------" 919 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 920.endif 921 @echo 922 @echo "--------------------------------------------------------------" 923 @echo ">>> stage 2.3: build tools" 924 @echo "--------------------------------------------------------------" 925 cd ${KRNLOBJDIR}/${_kernel}; \ 926 PATH=${BPATH}:${PATH} \ 927 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 928 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \ 929 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 930# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 931.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 932.for target in obj depend all 933 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 934 PATH=${BPATH}:${PATH} \ 935 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 936 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target} 937.endfor 938.endif 939.if !defined(NO_KERNELDEPEND) 940 @echo 941 @echo "--------------------------------------------------------------" 942 @echo ">>> stage 3.1: making dependencies" 943 @echo "--------------------------------------------------------------" 944 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 945.endif 946 @echo 947 @echo "--------------------------------------------------------------" 948 @echo ">>> stage 3.2: building everything" 949 @echo "--------------------------------------------------------------" 950 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 951 @echo "--------------------------------------------------------------" 952 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 953 @echo "--------------------------------------------------------------" 954.endfor 955 956# 957# installkernel, etc. 958# 959# Install the kernel defined by INSTALLKERNEL 960# 961installkernel installkernel.debug \ 962reinstallkernel reinstallkernel.debug: installcheck 963.if empty(INSTALLKERNEL) 964 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 965 false 966.endif 967 @echo "--------------------------------------------------------------" 968 @echo ">>> Installing kernel ${INSTALLKERNEL}" 969 @echo "--------------------------------------------------------------" 970 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 971 ${CROSSENV} PATH=${TMPPATH} \ 972 ${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 973 974distributekernel distributekernel.debug: 975.if empty(INSTALLKERNEL) 976 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 977 false 978.endif 979 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 980 ${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ 981 DESTDIR=${DESTDIR}/${DISTDIR}/kernel \ 982 ${.TARGET:S/distributekernel/install/} 983.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 984 cd ${KRNLOBJDIR}/${_kernel}; \ 985 ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ 986 KERNEL=${INSTKERNNAME}.${_kernel} \ 987 DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \ 988 ${.TARGET:S/distributekernel/install/} 989.endfor 990 991packagekernel: 992 cd ${DESTDIR}/${DISTDIR}/kernel; \ 993 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . 994.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} 995 cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ 996 tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . 997.endfor 998 999# 1000# doxygen 1001# 1002# Build the API documentation with doxygen 1003# 1004doxygen: 1005 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 1006 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 1007 exit 1; \ 1008 fi 1009 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 1010 1011# 1012# update 1013# 1014# Update the source tree(s), by running cvsup/cvs/svn to update to the 1015# latest copy. 1016# 1017update: 1018.if defined(SUP_UPDATE) 1019 @echo "--------------------------------------------------------------" 1020 @echo ">>> Running ${SUP}" 1021 @echo "--------------------------------------------------------------" 1022 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" 1023 @echo "!! Update methods with ${SUP} are deprecated." 1024 @echo "!! Please see http://www.freebsd.org/handbook/svn.html" 1025 @echo "!! and convert your update method to SVN_UPDATE or" 1026 @echo "!! freebsd-update(8)." 1027 @echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" 1028 @sleep 5 1029.if defined(SUPFILE) 1030 @${SUP} ${SUPFLAGS} ${SUPFILE} 1031.endif 1032.if defined(SUPFILE1) 1033 @${SUP} ${SUPFLAGS} ${SUPFILE1} 1034.endif 1035.if defined(SUPFILE2) 1036 @${SUP} ${SUPFLAGS} ${SUPFILE2} 1037.endif 1038.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 1039 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 1040.endif 1041.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 1042 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 1043.endif 1044.endif 1045.if defined(CVS_UPDATE) 1046 @cd ${.CURDIR} ; \ 1047 if [ -d CVS ] ; then \ 1048 echo "--------------------------------------------------------------" ; \ 1049 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \ 1050 echo "--------------------------------------------------------------" ; \ 1051 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \ 1052 echo "!! Update methods with CVS are deprecated." ; \ 1053 echo "!! Please see http://www.freebsd.org/handbook/svn.html" ; \ 1054 echo "!! and convert your update method to SVN_UPDATE or" ; \ 1055 echo "!! freebsd-update(8)." ; \ 1056 echo "!! WARNING WARNING WARNING WARNING WARNING WARNING WARNING !!" ; \ 1057 sleep 5 ; \ 1058 echo ${CVS} -R -q update ${CVSFLAGS} ; \ 1059 ${CVS} -R -q update ${CVSFLAGS} ; \ 1060 fi 1061.endif 1062.if defined(SVN_UPDATE) 1063 @cd ${.CURDIR} ; \ 1064 if [ -d .svn ] ; then \ 1065 echo "--------------------------------------------------------------" ; \ 1066 echo ">>> Updating ${.CURDIR} using Subversion" ; \ 1067 echo "--------------------------------------------------------------" ; \ 1068 echo ${SVN} update ${SVNFLAGS} ; \ 1069 ${SVN} update ${SVNFLAGS} ; \ 1070 fi 1071.endif 1072 1073# 1074# ------------------------------------------------------------------------ 1075# 1076# From here onwards are utility targets used by the 'make world' and 1077# related targets. If your 'world' breaks, you may like to try to fix 1078# the problem and manually run the following targets to attempt to 1079# complete the build. Beware, this is *not* guaranteed to work, you 1080# need to have a pretty good grip on the current state of the system 1081# to attempt to manually finish it. If in doubt, 'make world' again. 1082# 1083 1084# 1085# legacy: Build compatibility shims for the next three targets 1086# 1087legacy: 1088.if ${BOOTSTRAPPING} < 700055 && ${BOOTSTRAPPING} != 0 1089 @echo "ERROR: Source upgrades from versions prior to 7.0 not supported."; \ 1090 false 1091.endif 1092.for _tool in tools/build 1093 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 1094 cd ${.CURDIR}/${_tool}; \ 1095 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1096 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 1097 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1098 ${MAKE} DIRPRFX=${_tool}/ all; \ 1099 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1100.endfor 1101 1102# 1103# bootstrap-tools: Build tools needed for compatibility 1104# 1105.if ${MK_GAMES} != "no" 1106_strfile= games/fortune/strfile 1107.endif 1108 1109.if ${MK_CXX} != "no" 1110_gperf= gnu/usr.bin/gperf 1111.endif 1112 1113.if ${MK_GROFF} != "no" 1114_groff= gnu/usr.bin/groff 1115.endif 1116 1117.if ${BOOTSTRAPPING} < 800022 1118_ar= usr.bin/ar 1119.endif 1120 1121.if ${BOOTSTRAPPING} < 800013 1122_mklocale= usr.bin/mklocale 1123.endif 1124 1125.if ${BOOTSTRAPPING} < 900002 1126_sed= usr.bin/sed 1127.endif 1128 1129.if ${BOOTSTRAPPING} < 900006 1130_lex= usr.bin/lex 1131.endif 1132 1133.if ${BOOTSTRAPPING} < 1000013 1134_yacc= lib/liby \ 1135 usr.bin/yacc 1136.endif 1137 1138.if ${BOOTSTRAPPING} < 1000026 1139_nmtree= lib/libnetbsd \ 1140 usr.sbin/nmtree 1141.endif 1142 1143.if ${BOOTSTRAPPING} < 1000027 1144_cat= bin/cat 1145.endif 1146 1147.if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041 1148_awk= usr.bin/awk 1149.endif 1150 1151.if ${MK_BSNMP} != "no" && !exists(/usr/sbin/gensnmptree) 1152_gensnmptree= usr.sbin/bsnmpd/gensnmptree 1153.endif 1154 1155.if ${MK_CLANG} != "no" 1156_clang_tblgen= \ 1157 lib/clang/libllvmsupport \ 1158 lib/clang/libllvmtablegen \ 1159 usr.bin/clang/tblgen \ 1160 usr.bin/clang/clang-tblgen 1161.endif 1162 1163# dtrace tools are required for older bootstrap env and cross-build 1164.if ${MK_CDDL} != "no" && \ 1165 ((${BOOTSTRAPPING} < 800038 && \ 1166 !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999)) \ 1167 || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH})) 1168_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 1169 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 1170.endif 1171 1172# Default to building the BSDL DTC, but build the GPL one if users explicitly 1173# request it. 1174_dtc= usr.bin/dtc 1175.if ${MK_GPL_DTC} != "no" 1176_dtc= gnu/usr.bin/dtc 1177.endif 1178 1179.if ${MK_KERBEROS} != "no" 1180_kerberos5_bootstrap_tools= \ 1181 kerberos5/tools/make-roken \ 1182 kerberos5/lib/libroken \ 1183 kerberos5/lib/libvers \ 1184 kerberos5/tools/asn1_compile \ 1185 kerberos5/tools/slc 1186.endif 1187 1188# Please document (add comment) why something is in 'bootstrap-tools'. 1189# Try to bound the building of the bootstrap-tool to just the 1190# FreeBSD versions that need the tool built at this stage of the build. 1191bootstrap-tools: 1192.for _tool in \ 1193 ${_clang_tblgen} \ 1194 ${_kerberos5_bootstrap_tools} \ 1195 ${_dtrace_tools} \ 1196 ${_strfile} \ 1197 ${_gperf} \ 1198 ${_groff} \ 1199 ${_ar} \ 1200 ${_dtc} \ 1201 ${_awk} \ 1202 ${_cat} \ 1203 usr.bin/lorder \ 1204 usr.bin/makewhatis \ 1205 ${_mklocale} \ 1206 usr.bin/rpcgen \ 1207 ${_sed} \ 1208 ${_yacc} \ 1209 ${_lex} \ 1210 lib/libmd \ 1211 usr.bin/xinstall \ 1212 ${_gensnmptree} \ 1213 usr.sbin/config \ 1214 ${_nmtree} 1215 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1216 cd ${.CURDIR}/${_tool}; \ 1217 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1218 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1219 ${MAKE} DIRPRFX=${_tool}/ all; \ 1220 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1221.endfor 1222 1223# 1224# build-tools: Build special purpose build tools 1225# 1226.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 1227_aicasm= sys/modules/aic7xxx/aicasm 1228.endif 1229 1230.if !defined(NO_SHARE) 1231_share= share/syscons/scrnmaps 1232.endif 1233 1234.if ${MK_GCC} != "no" 1235_gcc_tools= gnu/usr.bin/cc/cc_tools 1236.endif 1237 1238.if ${MK_RESCUE} != "no" 1239_rescue= rescue/rescue 1240.endif 1241 1242build-tools: 1243.for _tool in \ 1244 bin/csh \ 1245 bin/sh \ 1246 ${_rescue} \ 1247 ${LOCAL_TOOL_DIRS} \ 1248 lib/ncurses/ncurses \ 1249 lib/ncurses/ncursesw \ 1250 ${_share} \ 1251 ${_aicasm} \ 1252 usr.bin/awk \ 1253 lib/libmagic \ 1254 usr.bin/mkesdb_static \ 1255 usr.bin/mkcsmapper_static 1256 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1257 cd ${.CURDIR}/${_tool}; \ 1258 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1259 ${MAKE} DIRPRFX=${_tool}/ build-tools 1260.endfor 1261.for _tool in \ 1262 ${_gcc_tools} 1263 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1264 cd ${.CURDIR}/${_tool}; \ 1265 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1266 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1267 ${MAKE} DIRPRFX=${_tool}/ all 1268.endfor 1269 1270# 1271# cross-tools: Build cross-building tools 1272# 1273.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1274.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1275_btxld= usr.sbin/btxld 1276.endif 1277.endif 1278.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1279.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1280_crunchide= usr.sbin/crunch/crunchide 1281.endif 1282.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1283_kgzip= usr.sbin/kgzip 1284.endif 1285.endif 1286 1287.if ${MK_BINUTILS} != "no" 1288_binutils= gnu/usr.bin/binutils 1289.endif 1290 1291.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") 1292_clang= usr.bin/clang 1293_clang_libs= lib/clang 1294.endif 1295 1296.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98") 1297_cc= gnu/usr.bin/cc 1298.endif 1299 1300cross-tools: 1301.for _tool in \ 1302 ${_clang_libs} \ 1303 ${_clang} \ 1304 ${_binutils} \ 1305 ${_cc} \ 1306 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1307 ${_btxld} \ 1308 ${_crunchide} \ 1309 ${_kgzip} 1310 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1311 cd ${.CURDIR}/${_tool}; \ 1312 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1313 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1314 ${MAKE} DIRPRFX=${_tool}/ all; \ 1315 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1316.endfor 1317 1318# 1319# hierarchy - ensure that all the needed directories are present 1320# 1321hierarchy hier: 1322.if defined(NO_ROOT) 1323 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} \ 1324 -DNO_ROOT METALOG=${METALOG} distrib-dirs 1325.else 1326 cd ${.CURDIR}/etc; ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs 1327.endif 1328 1329# 1330# libraries - build all libraries, and install them under ${DESTDIR}. 1331# 1332# The list of libraries with dependents (${_prebuild_libs}) and their 1333# interdependencies (__L) are built automatically by the 1334# ${.CURDIR}/tools/make_libdeps.sh script. 1335# 1336libraries: 1337 cd ${.CURDIR}; \ 1338 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1339 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1340 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1341 ${MAKE} -f Makefile.inc1 _generic_libs; 1342 1343# 1344# static libgcc.a prerequisite for shared libc 1345# 1346_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1347 1348# These dependencies are not automatically generated: 1349# 1350# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1351# all shared libraries for ELF. 1352# 1353_startup_libs= gnu/lib/csu 1354.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1355_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1356.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 1357_startup_libs+= lib/csu/${MACHINE_ARCH} 1358.else 1359_startup_libs+= lib/csu/${MACHINE_CPUARCH} 1360.endif 1361_startup_libs+= gnu/lib/libgcc 1362_startup_libs+= lib/libcompiler_rt 1363_startup_libs+= lib/libc 1364.if ${MK_LIBCPLUSPLUS} != "no" 1365_startup_libs+= lib/libcxxrt 1366.endif 1367 1368gnu/lib/libgcc__L: lib/libc__L 1369.if ${MK_LIBCPLUSPLUS} != "no" 1370lib/libcxxrt__L: gnu/lib/libgcc__L 1371.endif 1372 1373_prebuild_libs= ${_kerberos5_lib_libasn1} \ 1374 ${_kerberos5_lib_libhdb} \ 1375 ${_kerberos5_lib_libheimbase} \ 1376 ${_kerberos5_lib_libheimntlm} \ 1377 ${_kerberos5_lib_libheimsqlite} \ 1378 ${_kerberos5_lib_libheimipcc} \ 1379 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1380 ${_kerberos5_lib_libroken} \ 1381 ${_kerberos5_lib_libwind} \ 1382 ${_lib_atf_libatf_c} \ 1383 lib/libbz2 ${_libcom_err} lib/libcrypt \ 1384 lib/libelf lib/libexpat \ 1385 ${_lib_libgssapi} ${_lib_libipx} \ 1386 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ 1387 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1388 lib/libopie lib/libpam ${_lib_libthr} \ 1389 lib/libradius lib/libsbuf lib/libtacplus \ 1390 ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ 1391 ${_cddl_lib_libzfs_core} \ 1392 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ 1393 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1394 ${_secure_lib_libssl} 1395 1396.if ${MK_ATF} != "no" 1397_lib_atf_libatf_c= lib/atf/libatf-c 1398.endif 1399 1400.if ${MK_LIBTHR} != "no" 1401_lib_libthr= lib/libthr 1402.endif 1403 1404.if ${MK_OFED} != "no" 1405_ofed_lib= contrib/ofed/usr.lib/ 1406.endif 1407 1408_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} 1409.for _DIR in ${LOCAL_LIB_DIRS} 1410.if exists(${.CURDIR}/${_DIR}/Makefile) 1411_generic_libs+= ${_DIR} 1412.endif 1413.endfor 1414 1415lib/libopie__L lib/libtacplus__L: lib/libmd__L 1416 1417.if ${MK_CDDL} != "no" 1418_cddl_lib_libumem= cddl/lib/libumem 1419_cddl_lib_libnvpair= cddl/lib/libnvpair 1420_cddl_lib_libzfs_core= cddl/lib/libzfs_core 1421_cddl_lib= cddl/lib 1422cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L 1423.endif 1424 1425.if ${MK_CRYPT} != "no" 1426.if ${MK_OPENSSL} != "no" 1427_secure_lib_libcrypto= secure/lib/libcrypto 1428_secure_lib_libssl= secure/lib/libssl 1429lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1430.if ${MK_OPENSSH} != "no" 1431_secure_lib_libssh= secure/lib/libssh 1432secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1433.if ${MK_KERBEROS_SUPPORT} != "no" 1434secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1435 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1436 lib/libmd__L kerberos5/lib/libroken__L 1437.endif 1438.endif 1439.endif 1440_secure_lib= secure/lib 1441.endif 1442 1443.if ${MK_KERBEROS} != "no" 1444kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L 1445kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1446 kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ 1447 kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L 1448kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ 1449 kerberos5/lib/libroken__L lib/libcom_err__L 1450kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1451 secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L 1452kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ 1453 lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ 1454 kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ 1455 kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L 1456kerberos5/lib/libroken__L: lib/libcrypt__L 1457kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L 1458kerberos5/lib/libheimbase__L: lib/libthr__L 1459kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L 1460kerberos5/lib/libheimsqlite__L: lib/libthr__L 1461.endif 1462 1463.if ${MK_GSSAPI} != "no" 1464_lib_libgssapi= lib/libgssapi 1465.endif 1466 1467.if ${MK_IPX} != "no" 1468_lib_libipx= lib/libipx 1469.endif 1470 1471.if ${MK_KERBEROS} != "no" 1472_kerberos5_lib= kerberos5/lib 1473_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1474_kerberos5_lib_libhdb= kerberos5/lib/libhdb 1475_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase 1476_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1477_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1478_kerberos5_lib_libroken= kerberos5/lib/libroken 1479_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1480_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite 1481_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc 1482_kerberos5_lib_libwind= kerberos5/lib/libwind 1483_libcom_err= lib/libcom_err 1484.endif 1485 1486.if ${MK_NIS} != "no" 1487_lib_libypclnt= lib/libypclnt 1488.endif 1489 1490.if ${MK_OPENSSL} == "no" 1491lib/libradius__L: lib/libmd__L 1492.endif 1493 1494.for _lib in ${_prereq_libs} 1495${_lib}__PL: .PHONY 1496.if exists(${.CURDIR}/${_lib}) 1497 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1498 cd ${.CURDIR}/${_lib}; \ 1499 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1500 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1501 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1502 ${MAKE} -DNO_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1503.endif 1504.endfor 1505 1506.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1507${_lib}__L: .PHONY 1508.if exists(${.CURDIR}/${_lib}) 1509 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1510 cd ${.CURDIR}/${_lib}; \ 1511 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1512 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1513 ${MAKE} DIRPRFX=${_lib}/ all; \ 1514 ${MAKE} DIRPRFX=${_lib}/ install 1515.endif 1516.endfor 1517 1518# libpam is special: we need to build static PAM modules before 1519# static PAM library, and dynamic PAM library before dynamic PAM 1520# modules. 1521lib/libpam__L: .PHONY 1522 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1523 cd ${.CURDIR}/lib/libpam; \ 1524 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1525 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1526 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1527 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1528 1529_prereq_libs: ${_prereq_libs:S/$/__PL/} 1530_startup_libs: ${_startup_libs:S/$/__L/} 1531_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1532_generic_libs: ${_generic_libs:S/$/__L/} 1533 1534.for __target in all clean cleandepend cleandir depend includes obj 1535.for entry in ${SUBDIR} 1536${entry}.${__target}__D: .PHONY 1537 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1538 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1539 edir=${entry}.${MACHINE_ARCH}; \ 1540 cd ${.CURDIR}/$${edir}; \ 1541 else \ 1542 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1543 edir=${entry}; \ 1544 cd ${.CURDIR}/$${edir}; \ 1545 fi; \ 1546 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1547.endfor 1548par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1549.endfor 1550 1551.include <bsd.subdir.mk> 1552 1553.if make(check-old) || make(check-old-dirs) || \ 1554 make(check-old-files) || make(check-old-libs) || \ 1555 make(delete-old) || make(delete-old-dirs) || \ 1556 make(delete-old-files) || make(delete-old-libs) 1557 1558# 1559# check for / delete old files section 1560# 1561 1562.include "ObsoleteFiles.inc" 1563 1564OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1565else you can not start such an application. Consult UPDATING for more \ 1566information regarding how to cope with the removal/revision bump of a \ 1567specific library." 1568 1569.if !defined(BATCH_DELETE_OLD_FILES) 1570RM_I=-i 1571.else 1572RM_I=-v 1573.endif 1574 1575delete-old-files: 1576 @echo ">>> Removing old files (only deletes safe to delete libs)" 1577# Ask for every old file if the user really wants to remove it. 1578# It's annoying, but better safe than sorry. 1579# NB: We cannot pass the list of OLD_FILES as a parameter because the 1580# argument list will get too long. Using .for/.endfor make "loops" will make 1581# the Makefile parser segfault. 1582 @exec 3<&0; \ 1583 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1584 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1585 while read file; do \ 1586 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1587 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1588 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1589 fi; \ 1590 done 1591# Remove catpages without corresponding manpages. 1592 @exec 3<&0; \ 1593 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1594 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1595 while read catpage; do \ 1596 read manpage; \ 1597 if [ ! -e "$${manpage}" ]; then \ 1598 rm ${RM_I} $${catpage} <&3; \ 1599 fi; \ 1600 done 1601 @echo ">>> Old files removed" 1602 1603check-old-files: 1604 @echo ">>> Checking for old files" 1605 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1606 -V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ 1607 while read file; do \ 1608 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1609 echo "${DESTDIR}/$${file}"; \ 1610 fi; \ 1611 done 1612# Check for catpages without corresponding manpages. 1613 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1614 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1615 while read catpage; do \ 1616 read manpage; \ 1617 if [ ! -e "$${manpage}" ]; then \ 1618 echo $${catpage}; \ 1619 fi; \ 1620 done 1621 1622delete-old-libs: 1623 @echo ">>> Removing old libraries" 1624 @echo "${OLD_LIBS_MESSAGE}" | fmt 1625 @exec 3<&0; \ 1626 ${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1627 -V OLD_LIBS | xargs -n1 | \ 1628 while read file; do \ 1629 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1630 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1631 rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ 1632 fi; \ 1633 done 1634 @echo ">>> Old libraries removed" 1635 1636check-old-libs: 1637 @echo ">>> Checking for old libraries" 1638 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1639 -V OLD_LIBS | xargs -n1 | \ 1640 while read file; do \ 1641 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1642 echo "${DESTDIR}/$${file}"; \ 1643 fi; \ 1644 done 1645 1646delete-old-dirs: 1647 @echo ">>> Removing old directories" 1648 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1649 -V OLD_DIRS | xargs -n1 | \ 1650 while read dir; do \ 1651 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1652 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1653 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1654 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1655 fi; \ 1656 done 1657 @echo ">>> Old directories removed" 1658 1659check-old-dirs: 1660 @echo ">>> Checking for old directories" 1661 @${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ 1662 -V OLD_DIRS | xargs -n1 | \ 1663 while read dir; do \ 1664 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1665 echo "${DESTDIR}/$${dir}"; \ 1666 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1667 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1668 fi; \ 1669 done 1670 1671delete-old: delete-old-files delete-old-dirs 1672 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1673 1674check-old: check-old-files check-old-libs check-old-dirs 1675 @echo "To remove old files and directories run '${MAKE} delete-old'." 1676 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1677 1678.endif 1679 1680# 1681# showconfig - show build configuration. 1682# 1683showconfig: 1684 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort 1685 1686.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 1687DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 1688 1689.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 1690.if exists(${KERNCONFDIR}/${KERNCONF}) 1691FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 1692 ${KERNCONFDIR}/${KERNCONF} ; echo 1693.endif 1694.endif 1695 1696.endif 1697 1698.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 1699DTBOUTPUTPATH= ${.CURDIR} 1700.endif 1701 1702# 1703# Build 'standalone' Device Tree Blob 1704# 1705builddtb: 1706 @if [ "${FDT_DTS_FILE}" = "" ]; then \ 1707 echo "ERROR: FDT_DTS_FILE must be specified!"; \ 1708 exit 1; \ 1709 fi; \ 1710 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \ 1711 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ 1712 exist!"; \ 1713 exit 1; \ 1714 fi; \ 1715 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ 1716 echo "WARNING: DTB will be placed in the current working \ 1717 directory"; \ 1718 fi 1719 @PATH=${TMPPATH} \ 1720 dtc -O dtb -o \ 1721 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \ 1722 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} 1723 1724############### 1725 1726.if defined(XDEV) && defined(XDEV_ARCH) 1727 1728.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} 1729XDEV_CPUTYPE?=${CPUTYPE} 1730.else 1731XDEV_CPUTYPE?=${TARGET_CPUTYPE} 1732.endif 1733 1734NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 1735 -DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \ 1736 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ 1737 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ 1738 CPUTYPE=${XDEV_CPUTYPE} 1739 1740XDDIR=${XDEV_ARCH}-freebsd 1741XDTP=/usr/${XDDIR} 1742CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ 1743 INSTALL="sh ${.CURDIR}/tools/install.sh" 1744CDENV= ${CDBENV} \ 1745 _SHLIBDIRPREFIX=${XDDESTDIR} \ 1746 TOOLS_PREFIX=${XDDESTDIR} 1747CD2CFLAGS=-isystem ${XDDESTDIR}/usr/include -L${XDDESTDIR}/usr/lib \ 1748 -B${XDDESTDIR}/usr/lib 1749CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" \ 1750 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1751 1752CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp 1753CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1754CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1755XDDESTDIR=${DESTDIR}${XDTP} 1756.if !defined(OSREL) 1757OSREL!= uname -r | sed -e 's/[-(].*//' 1758.endif 1759 1760.ORDER: xdev-build xdev-install 1761xdev: xdev-build xdev-install 1762 1763.ORDER: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1764xdev-build: _xb-worldtmp _xb-bootstrap-tools _xb-build-tools _xb-cross-tools 1765 1766_xb-worldtmp: 1767 mkdir -p ${CDTMP}/usr 1768 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1769 -p ${CDTMP}/usr >/dev/null 1770 1771_xb-bootstrap-tools: 1772.for _tool in \ 1773 ${_clang_tblgen} 1774 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1775 cd ${.CURDIR}/${_tool}; \ 1776 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1777 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1778 ${CDMAKE} DIRPRFX=${_tool}/ all; \ 1779 ${CDMAKE} DIRPRFX=${_tool}/ DESTDIR=${CDTMP} install 1780.endfor 1781 1782_xb-build-tools: 1783 ${_+_}@cd ${.CURDIR}; \ 1784 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1785 1786_xb-cross-tools: 1787.for _tool in \ 1788 gnu/usr.bin/binutils \ 1789 gnu/usr.bin/cc \ 1790 usr.bin/ar \ 1791 ${_clang_libs} \ 1792 ${_clang} 1793 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1794 cd ${.CURDIR}/${_tool}; \ 1795 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1796 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1797 ${CDMAKE} DIRPRFX=${_tool}/ all 1798.endfor 1799 1800_xi-mtree: 1801 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1802 mkdir -p ${XDDESTDIR} 1803 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1804 -p ${XDDESTDIR} >/dev/null 1805 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1806 -p ${XDDESTDIR}/usr >/dev/null 1807 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1808 -p ${XDDESTDIR}/usr/include >/dev/null 1809 1810.ORDER: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1811xdev-install: xdev-build _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1812 1813_xi-cross-tools: 1814 @echo "_xi-cross-tools" 1815.for _tool in \ 1816 gnu/usr.bin/binutils \ 1817 gnu/usr.bin/cc \ 1818 usr.bin/ar \ 1819 ${_clang} 1820 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1821 cd ${.CURDIR}/${_tool}; \ 1822 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1823.endfor 1824 1825_xi-includes: 1826 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1827 DESTDIR=${XDDESTDIR} 1828 1829_xi-libraries: 1830 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1831 DESTDIR=${XDDESTDIR} 1832 1833_xi-links: 1834 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1835 for i in *; do \ 1836 ln -sf ../../${XDTP}/usr/bin/$$i \ 1837 ../../../../usr/bin/${XDDIR}-$$i; \ 1838 ln -sf ../../${XDTP}/usr/bin/$$i \ 1839 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1840 done 1841.else 1842xdev xdev-build xdev-install: 1843 @echo "*** Error: Both XDEV and XDEV_ARCH must be defined for \"${.TARGET}\" target" 1844.endif 1845