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