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