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