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