Makefile.inc1 revision 218941
1# 2# $FreeBSD: head/Makefile.inc1 218941 2011-02-22 08:13:49Z uqs $ 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/lib32 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 ${_t} 467.endfor 468.endif 469.for _t in obj includes 470 cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t} 471 cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t} 472.if ${MK_CDDL} != "no" 473 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t} 474.endif 475 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t} 476.if ${MK_CRYPT} != "no" 477 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t} 478.endif 479.if ${MK_KERBEROS} != "no" 480 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t} 481.endif 482.endfor 483.for _dir in usr.bin/lex/lib 484 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} 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 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} ${_t} 495 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} ${_t} 496.endfor 497 498distribute32 install32: 499.if make(distribute32) 500 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree 501 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32/dtrace # XXX add to mtree 502.else 503 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree 504 mkdir -p ${DESTDIR}/usr/lib32/dtrace # XXX add to mtree 505.endif 506 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 507.if ${MK_CDDL} != "no" 508 cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 509.endif 510 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 511.if ${MK_CRYPT} != "no" 512 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 513.endif 514.if ${MK_KERBEROS} != "no" 515 cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 516.endif 517 cd ${.CURDIR}/libexec/rtld-elf; \ 518 PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} 519 cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} 520.endif 521 522WMAKE_TGTS= 523.if !defined(SUBDIR_OVERRIDE) 524WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 525.endif 526WMAKE_TGTS+= _cleanobj _obj _build-tools 527.if !defined(SUBDIR_OVERRIDE) 528WMAKE_TGTS+= _cross-tools 529.endif 530WMAKE_TGTS+= _includes _libraries _depend everything 531.if defined(LIB32TMP) && ${MK_LIB32} != "no" 532WMAKE_TGTS+= build32 533.endif 534 535buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 536.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 537 538buildworld_prologue: 539 @echo "--------------------------------------------------------------" 540 @echo ">>> World build started on `LC_ALL=C date`" 541 @echo "--------------------------------------------------------------" 542 543buildworld_epilogue: 544 @echo 545 @echo "--------------------------------------------------------------" 546 @echo ">>> World build completed on `LC_ALL=C date`" 547 @echo "--------------------------------------------------------------" 548 549# 550# We need to have this as a target because the indirection between Makefile 551# and Makefile.inc1 causes the correct PATH to be used, rather than a 552# modification of the current environment's PATH. In addition, we need 553# to quote multiword values. 554# 555buildenvvars: 556 @echo ${WMAKEENV:Q} 557 558buildenv: 559 @echo Entering world for ${TARGET_ARCH}:${TARGET} 560 @cd ${.CURDIR} && env ${WMAKEENV} sh || true 561 562TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} 563toolchain: ${TOOLCHAIN_TGTS} 564kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 565 566# 567# installcheck 568# 569# Checks to be sure system is ready for installworld/installkernel. 570# 571installcheck: 572 573# 574# Require DESTDIR to be set if installing for a different architecture. 575# 576.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} 577.if !make(distributeworld) 578installcheck: installcheck_DESTDIR 579installcheck_DESTDIR: 580.if !defined(DESTDIR) || empty(DESTDIR) 581 @echo "ERROR: Please set DESTDIR!"; \ 582 false 583.endif 584.endif 585.endif 586 587# 588# Check for missing UIDs/GIDs. 589# 590CHECK_UIDS= 591CHECK_GIDS= audit 592.if ${MK_SENDMAIL} != "no" 593CHECK_UIDS+= smmsp 594CHECK_GIDS+= smmsp 595.endif 596.if ${MK_PF} != "no" 597CHECK_UIDS+= proxy 598CHECK_GIDS+= proxy authpf 599.endif 600installcheck: installcheck_UGID 601installcheck_UGID: 602.for uid in ${CHECK_UIDS} 603 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 604 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 605 false; \ 606 fi 607.endfor 608.for gid in ${CHECK_GIDS} 609 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 610 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 611 false; \ 612 fi 613.endfor 614 615# 616# Required install tools to be saved in a scratch dir for safety. 617# 618.if ${MK_INFO} != "no" 619_install-info= install-info 620.endif 621.if ${MK_ZONEINFO} != "no" 622_zoneinfo= zic tzsetup 623.endif 624 625ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ 626 date echo egrep find grep ${_install-info} \ 627 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 628 test true uname wc ${_zoneinfo} 629 630# 631# distributeworld 632# 633# Distributes everything compiled by a `buildworld'. 634# 635# installworld 636# 637# Installs everything compiled by a 'buildworld'. 638# 639distributeworld installworld: installcheck 640 mkdir -p ${INSTALLTMP} 641 progs=$$(for prog in ${ITOOLS}; do \ 642 if progpath=`which $$prog`; then \ 643 echo $$progpath; \ 644 else \ 645 echo "Required tool $$prog not found in PATH." >&2; \ 646 exit 1; \ 647 fi; \ 648 done); \ 649 libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ 650 while read line; do \ 651 set -- $$line; \ 652 if [ "$$2 $$3" != "not found" ]; then \ 653 echo $$2; \ 654 else \ 655 echo "Required library $$1 not found." >&2; \ 656 exit 1; \ 657 fi; \ 658 done); \ 659 cp $$libs $$progs ${INSTALLTMP} 660 cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale 661 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ 662 ${IMAKEENV} rm -rf ${INSTALLTMP} 663 664# 665# reinstall 666# 667# If you have a build server, you can NFS mount the source and obj directories 668# and do a 'make reinstall' on the *client* to install new binaries from the 669# most recent server build. 670# 671reinstall: 672 @echo "--------------------------------------------------------------" 673 @echo ">>> Making hierarchy" 674 @echo "--------------------------------------------------------------" 675 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 676 @echo 677 @echo "--------------------------------------------------------------" 678 @echo ">>> Installing everything" 679 @echo "--------------------------------------------------------------" 680 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 681.if defined(LIB32TMP) && ${MK_LIB32} != "no" 682 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 683.endif 684 685redistribute: 686 @echo "--------------------------------------------------------------" 687 @echo ">>> Distributing everything" 688 @echo "--------------------------------------------------------------" 689 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 690.if defined(LIB32TMP) && ${MK_LIB32} != "no" 691 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ 692 DISTRIBUTION=lib32 693.endif 694 695distrib-dirs distribution: 696 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} 697 698# 699# buildkernel and installkernel 700# 701# Which kernels to build and/or install is specified by setting 702# KERNCONF. If not defined a GENERIC kernel is built/installed. 703# Only the existing (depending TARGET) config files are used 704# for building kernels and only the first of these is designated 705# as the one being installed. 706# 707# Note that we have to use TARGET instead of TARGET_ARCH when 708# we're in kernel-land. Since only TARGET_ARCH is (expected) to 709# be set to cross-build, we have to make sure TARGET is set 710# properly. 711 712.if defined(KERNFAST) 713NO_KERNELCLEAN= t 714NO_KERNELCONFIG= t 715NO_KERNELDEPEND= t 716NO_KERNELOBJ= t 717# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah 718.if !defined(KERNCONF) && ${KERNFAST} != "1" 719KERNCONF=${KERNFAST} 720.endif 721.endif 722.if !defined(KERNCONF) && defined(KERNEL) 723KERNCONF= ${KERNEL} 724KERNWARN= 725.else 726.if ${TARGET_ARCH} == "powerpc64" 727KERNCONF?= GENERIC64 728.else 729KERNCONF?= GENERIC 730.endif 731.endif 732INSTKERNNAME?= kernel 733 734KERNSRCDIR?= ${.CURDIR}/sys 735KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 736KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 737KERNCONFDIR?= ${KRNLCONFDIR} 738 739BUILDKERNELS= 740INSTALLKERNEL= 741.for _kernel in ${KERNCONF} 742.if exists(${KERNCONFDIR}/${_kernel}) 743BUILDKERNELS+= ${_kernel} 744.if empty(INSTALLKERNEL) 745INSTALLKERNEL= ${_kernel} 746.endif 747.endif 748.endfor 749 750# 751# buildkernel 752# 753# Builds all kernels defined by BUILDKERNELS. 754# 755buildkernel: 756.if empty(BUILDKERNELS) 757 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 758 false 759.endif 760.if defined(KERNWARN) 761 @echo "--------------------------------------------------------------" 762 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 763 @echo "--------------------------------------------------------------" 764 @sleep 3 765.endif 766 @echo 767.for _kernel in ${BUILDKERNELS} 768 @echo "--------------------------------------------------------------" 769 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 770 @echo "--------------------------------------------------------------" 771 @echo "===> ${_kernel}" 772 mkdir -p ${KRNLOBJDIR} 773.if !defined(NO_KERNELCONFIG) 774 @echo 775 @echo "--------------------------------------------------------------" 776 @echo ">>> stage 1: configuring the kernel" 777 @echo "--------------------------------------------------------------" 778 cd ${KRNLCONFDIR}; \ 779 PATH=${TMPPATH} \ 780 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 781 ${KERNCONFDIR}/${_kernel} 782.endif 783.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 784 @echo 785 @echo "--------------------------------------------------------------" 786 @echo ">>> stage 2.1: cleaning up the object tree" 787 @echo "--------------------------------------------------------------" 788 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 789.endif 790.if !defined(NO_KERNELOBJ) 791 @echo 792 @echo "--------------------------------------------------------------" 793 @echo ">>> stage 2.2: rebuilding the object tree" 794 @echo "--------------------------------------------------------------" 795 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 796.endif 797 @echo 798 @echo "--------------------------------------------------------------" 799 @echo ">>> stage 2.3: build tools" 800 @echo "--------------------------------------------------------------" 801 cd ${KRNLOBJDIR}/${_kernel}; \ 802 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 803 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS \ 804 -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 805# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 806.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 807.for target in obj depend all 808 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 809 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 810 ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target} 811.endfor 812.endif 813.if !defined(NO_KERNELDEPEND) 814 @echo 815 @echo "--------------------------------------------------------------" 816 @echo ">>> stage 3.1: making dependencies" 817 @echo "--------------------------------------------------------------" 818 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 819.endif 820 @echo 821 @echo "--------------------------------------------------------------" 822 @echo ">>> stage 3.2: building everything" 823 @echo "--------------------------------------------------------------" 824 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 825 @echo "--------------------------------------------------------------" 826 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 827 @echo "--------------------------------------------------------------" 828.endfor 829 830# 831# installkernel, etc. 832# 833# Install the kernel defined by INSTALLKERNEL 834# 835installkernel installkernel.debug \ 836reinstallkernel reinstallkernel.debug: installcheck 837.if empty(INSTALLKERNEL) 838 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 839 false 840.endif 841 @echo "--------------------------------------------------------------" 842 @echo ">>> Installing kernel" 843 @echo "--------------------------------------------------------------" 844 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 845 ${CROSSENV} PATH=${TMPPATH} \ 846 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 847 848# 849# doxygen 850# 851# Build the API documentation with doxygen 852# 853doxygen: 854 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 855 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 856 exit 1; \ 857 fi 858 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 859 860# 861# update 862# 863# Update the source tree, by running cvsup and/or running cvs to update to the 864# latest copy. 865# 866update: 867.if defined(SUP_UPDATE) 868 @echo "--------------------------------------------------------------" 869 @echo ">>> Running ${SUP}" 870 @echo "--------------------------------------------------------------" 871.if defined(SUPFILE) 872 @${SUP} ${SUPFLAGS} ${SUPFILE} 873.endif 874.if defined(SUPFILE1) 875 @${SUP} ${SUPFLAGS} ${SUPFILE1} 876.endif 877.if defined(SUPFILE2) 878 @${SUP} ${SUPFLAGS} ${SUPFILE2} 879.endif 880.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 881 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 882.endif 883.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 884 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 885.endif 886.endif 887.if defined(CVS_UPDATE) 888 @cd ${.CURDIR} ; \ 889 if [ -d CVS ] ; then \ 890 echo "--------------------------------------------------------------" ; \ 891 echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \ 892 echo "--------------------------------------------------------------" ; \ 893 echo ${CVS} -R -q update ${CVSFLAGS} ; \ 894 ${CVS} -R -q update ${CVSFLAGS} ; \ 895 fi 896.endif 897.if defined(SVN_UPDATE) 898 @cd ${.CURDIR} ; \ 899 if [ -d .svn ] ; then \ 900 echo "--------------------------------------------------------------" ; \ 901 echo ">>> Updating ${.CURDIR} using Subversion" ; \ 902 echo "--------------------------------------------------------------" ; \ 903 echo ${SVN} update ${SVNFLAGS} ; \ 904 ${SVN} update ${SVNFLAGS} ; \ 905 fi 906.endif 907 908# 909# ------------------------------------------------------------------------ 910# 911# From here onwards are utility targets used by the 'make world' and 912# related targets. If your 'world' breaks, you may like to try to fix 913# the problem and manually run the following targets to attempt to 914# complete the build. Beware, this is *not* guaranteed to work, you 915# need to have a pretty good grip on the current state of the system 916# to attempt to manually finish it. If in doubt, 'make world' again. 917# 918 919# 920# legacy: Build compatibility shims for the next three targets 921# 922legacy: 923.if ${BOOTSTRAPPING} < 600034 && ${BOOTSTRAPPING} != 0 924 @echo "ERROR: Source upgrades from versions prior to 6.0 not supported."; \ 925 false 926.endif 927.for _tool in tools/build 928 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 929 cd ${.CURDIR}/${_tool}; \ 930 ${MAKE} DIRPRFX=${_tool}/ obj; \ 931 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 932 ${MAKE} DIRPRFX=${_tool}/ depend; \ 933 ${MAKE} DIRPRFX=${_tool}/ all; \ 934 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 935.endfor 936 937# 938# bootstrap-tools: Build tools needed for compatibility 939# 940.if ${MK_GAMES} != "no" 941_strfile= games/fortune/strfile 942.endif 943 944.if ${MK_CXX} != "no" 945_gperf= gnu/usr.bin/gperf 946.endif 947 948.if ${MK_GROFF} != "no" 949_groff= gnu/usr.bin/groff 950.endif 951 952.if ${BOOTSTRAPPING} >= 700044 && ${BOOTSTRAPPING} < 800022 953_ar= usr.bin/ar 954.endif 955 956.if ${BOOTSTRAPPING} < 800013 957_mklocale= usr.bin/mklocale 958.endif 959 960.if ${BOOTSTRAPPING} < 900002 961_sed= usr.bin/sed 962.endif 963 964.if ${BOOTSTRAPPING} < 900006 965_lex= usr.bin/lex 966_yacc= usr.bin/yacc 967.endif 968 969.if ${BOOTSTRAPPING} < 700018 970_gensnmptree= usr.sbin/bsnmpd/gensnmptree 971.endif 972 973.if ${MK_RESCUE} != "no" && \ 974 ${BOOTSTRAPPING} < 700026 975_crunchgen= usr.sbin/crunch/crunchgen 976.endif 977 978# XXX: There is no way to specify bootstrap tools depending on MK-flags 979# with different per-architecture default values. Always build tblgen. 980_clang_tblgen= \ 981 lib/clang/libllvmsupport \ 982 usr.bin/clang/tblgen 983 984.if ${MK_CDDL} != "no" 985_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ 986 lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge 987.endif 988 989.if ${MK_FDT} != "no" 990_dtc= gnu/usr.bin/dtc 991.endif 992 993bootstrap-tools: 994.for _tool in \ 995 ${_clang_tblgen} \ 996 ${_dtrace_tools} \ 997 ${_strfile} \ 998 ${_gperf} \ 999 ${_groff} \ 1000 ${_ar} \ 1001 ${_dtc} \ 1002 usr.bin/lorder \ 1003 usr.bin/makewhatis \ 1004 ${_mklocale} \ 1005 usr.bin/rpcgen \ 1006 ${_sed} \ 1007 ${_lex} \ 1008 ${_yacc} \ 1009 usr.bin/xinstall \ 1010 ${_gensnmptree} \ 1011 usr.sbin/config \ 1012 ${_crunchgen} 1013 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1014 cd ${.CURDIR}/${_tool}; \ 1015 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1016 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1017 ${MAKE} DIRPRFX=${_tool}/ all; \ 1018 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 1019.endfor 1020 1021# 1022# build-tools: Build special purpose build tools 1023# 1024.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 1025_aicasm= sys/modules/aic7xxx/aicasm 1026.endif 1027 1028.if !defined(NO_SHARE) 1029_share= share/syscons/scrnmaps 1030.endif 1031 1032.if ${MK_KERBEROS} != "no" 1033_kerberos5_tools= kerberos5/tools 1034.endif 1035 1036.if ${MK_RESCUE} != "no" 1037_rescue= rescue/rescue 1038.endif 1039 1040build-tools: 1041.for _tool in \ 1042 bin/csh \ 1043 bin/sh \ 1044 ${_rescue} \ 1045 lib/ncurses/ncurses \ 1046 lib/ncurses/ncursesw \ 1047 ${_share} \ 1048 ${_aicasm} \ 1049 usr.bin/awk \ 1050 lib/libmagic \ 1051 usr.sbin/sysinstall 1052 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 1053 cd ${.CURDIR}/${_tool}; \ 1054 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1055 ${MAKE} DIRPRFX=${_tool}/ build-tools 1056.endfor 1057.for _tool in \ 1058 gnu/usr.bin/cc/cc_tools \ 1059 ${_kerberos5_tools} 1060 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 1061 cd ${.CURDIR}/${_tool}; \ 1062 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1063 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1064 ${MAKE} DIRPRFX=${_tool}/ all 1065.endfor 1066 1067# 1068# cross-tools: Build cross-building tools 1069# 1070.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 800035 1071.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 1072_btxld= usr.sbin/btxld 1073.endif 1074.endif 1075.if ${TARGET_ARCH} != ${MACHINE_ARCH} 1076.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 1077_crunchide= usr.sbin/crunch/crunchide 1078.endif 1079.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 1080_kgzip= usr.sbin/kgzip 1081.endif 1082.endif 1083 1084.if ${CC:T:Mclang} == "clang" 1085_clang= usr.bin/clang 1086_clang_libs= lib/clang 1087.endif 1088 1089cross-tools: 1090.for _tool in \ 1091 ${_clang_libs} \ 1092 ${_clang} \ 1093 gnu/usr.bin/binutils \ 1094 gnu/usr.bin/cc \ 1095 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 1096 ${_btxld} \ 1097 ${_crunchide} \ 1098 ${_kgzip} 1099 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 1100 cd ${.CURDIR}/${_tool}; \ 1101 ${MAKE} DIRPRFX=${_tool}/ obj; \ 1102 ${MAKE} DIRPRFX=${_tool}/ depend; \ 1103 ${MAKE} DIRPRFX=${_tool}/ all; \ 1104 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 1105.endfor 1106 1107# 1108# hierarchy - ensure that all the needed directories are present 1109# 1110hierarchy: 1111 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 1112 1113# 1114# libraries - build all libraries, and install them under ${DESTDIR}. 1115# 1116# The list of libraries with dependents (${_prebuild_libs}) and their 1117# interdependencies (__L) are built automatically by the 1118# ${.CURDIR}/tools/make_libdeps.sh script. 1119# 1120libraries: 1121 cd ${.CURDIR}; \ 1122 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 1123 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1124 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1125 ${MAKE} -f Makefile.inc1 _generic_libs; 1126 1127# 1128# static libgcc.a prerequisite for shared libc 1129# 1130_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt 1131 1132# These dependencies are not automatically generated: 1133# 1134# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1135# all shared libraries for ELF. 1136# 1137_startup_libs= gnu/lib/csu 1138.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1139_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1140.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) 1141_startup_libs+= lib/csu/${MACHINE_ARCH} 1142.else 1143_startup_libs+= lib/csu/${MACHINE_CPUARCH} 1144.endif 1145_startup_libs+= gnu/lib/libgcc 1146_startup_libs+= lib/libcompiler_rt 1147_startup_libs+= lib/libc 1148 1149gnu/lib/libgcc__L: lib/libc__L 1150 1151_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libheimntlm} \ 1152 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ 1153 ${_kerberos5_lib_libroken} \ 1154 lib/libbz2 lib/libcom_err lib/libcrypt \ 1155 lib/libexpat lib/libfetch \ 1156 ${_lib_libgssapi} ${_lib_libipx} \ 1157 lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ 1158 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1159 lib/libopie lib/libpam ${_lib_libthr} \ 1160 lib/libradius lib/libsbuf lib/libtacplus \ 1161 lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ 1162 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1163 ${_secure_lib_libssl} 1164 1165.if ${MK_LIBTHR} != "no" 1166_lib_libthr= lib/libthr 1167.endif 1168 1169_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib 1170 1171lib/libopie__L lib/libtacplus__L: lib/libmd__L 1172 1173.if ${MK_CDDL} != "no" 1174_cddl_lib= cddl/lib 1175.endif 1176 1177.if ${MK_CRYPT} != "no" 1178.if ${MK_OPENSSL} != "no" 1179_secure_lib_libcrypto= secure/lib/libcrypto 1180_secure_lib_libssl= secure/lib/libssl 1181lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1182lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L 1183.if ${MK_OPENSSH} != "no" 1184_secure_lib_libssh= secure/lib/libssh 1185secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1186.if ${MK_KERBEROS_SUPPORT} != "no" 1187secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1188 kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ 1189 lib/libmd__L kerberos5/lib/libroken__L 1190.endif 1191.endif 1192.endif 1193_secure_lib= secure/lib 1194.endif 1195 1196.if ${MK_GSSAPI} != "no" 1197_lib_libgssapi= lib/libgssapi 1198.endif 1199 1200.if ${MK_IPX} != "no" 1201_lib_libipx= lib/libipx 1202.endif 1203 1204.if ${MK_KERBEROS} != "no" 1205_kerberos5_lib= kerberos5/lib 1206_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1207_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1208_kerberos5_lib_libhx509= kerberos5/lib/libhx509 1209_kerberos5_lib_libroken= kerberos5/lib/libroken 1210_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm 1211.endif 1212 1213.if ${MK_NIS} != "no" 1214_lib_libypclnt= lib/libypclnt 1215.endif 1216 1217.if ${MK_OPENSSL} == "no" 1218lib/libfetch__L lib/libradius__L: lib/libmd__L 1219.endif 1220 1221.for _lib in ${_prereq_libs} 1222${_lib}__PL: .PHONY 1223.if exists(${.CURDIR}/${_lib}) 1224 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1225 cd ${.CURDIR}/${_lib}; \ 1226 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1227 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1228 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1229 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1230.endif 1231.endfor 1232 1233.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1234${_lib}__L: .PHONY 1235.if exists(${.CURDIR}/${_lib}) 1236 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1237 cd ${.CURDIR}/${_lib}; \ 1238 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1239 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1240 ${MAKE} DIRPRFX=${_lib}/ all; \ 1241 ${MAKE} DIRPRFX=${_lib}/ install 1242.endif 1243.endfor 1244 1245# libpam is special: we need to build static PAM modules before 1246# static PAM library, and dynamic PAM library before dynamic PAM 1247# modules. 1248lib/libpam__L: .PHONY 1249 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1250 cd ${.CURDIR}/lib/libpam; \ 1251 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1252 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1253 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1254 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1255 1256_prereq_libs: ${_prereq_libs:S/$/__PL/} 1257_startup_libs: ${_startup_libs:S/$/__L/} 1258_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1259_generic_libs: ${_generic_libs:S/$/__L/} 1260 1261.for __target in all clean cleandepend cleandir depend includes obj 1262.for entry in ${SUBDIR} 1263${entry}.${__target}__D: .PHONY 1264 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1265 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1266 edir=${entry}.${MACHINE_ARCH}; \ 1267 cd ${.CURDIR}/$${edir}; \ 1268 else \ 1269 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1270 edir=${entry}; \ 1271 cd ${.CURDIR}/$${edir}; \ 1272 fi; \ 1273 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1274.endfor 1275par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1276.endfor 1277 1278.include <bsd.subdir.mk> 1279 1280.if make(check-old) || make(check-old-dirs) || \ 1281 make(check-old-files) || make(check-old-libs) || \ 1282 make(delete-old) || make(delete-old-dirs) || \ 1283 make(delete-old-files) || make(delete-old-libs) 1284 1285# 1286# check for / delete old files section 1287# 1288 1289.include "ObsoleteFiles.inc" 1290 1291OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1292else you can not start such an application. Consult UPDATING for more \ 1293information regarding how to cope with the removal/revision bump of a \ 1294specific library." 1295 1296.if !defined(BATCH_DELETE_OLD_FILES) 1297RM_I=-i 1298.else 1299RM_I=-v 1300.endif 1301 1302delete-old-files: 1303 @echo ">>> Removing old files (only deletes safe to delete libs)" 1304# Ask for every old file if the user really wants to remove it. 1305# It's annoying, but better safe than sorry. 1306 @for file in ${OLD_FILES} ${OLD_FILES:Musr/share/*.gz:R}; do \ 1307 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1308 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1309 rm ${RM_I} "${DESTDIR}/$${file}"; \ 1310 fi; \ 1311 done 1312# Remove catpages without corresponding manpages. 1313 @exec 3<&0; \ 1314 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1315 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1316 while read catpage; do \ 1317 read manpage; \ 1318 if [ ! -e "$${manpage}" ]; then \ 1319 rm ${RM_I} $${catpage} <&3 ; \ 1320 fi; \ 1321 done 1322 @echo ">>> Old files removed" 1323 1324check-old-files: 1325 @echo ">>> Checking for old files" 1326 @for file in ${OLD_FILES} ${OLD_FILES:Musr/share/*.gz:R}; do \ 1327 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1328 echo "${DESTDIR}/$${file}"; \ 1329 fi; \ 1330 done 1331# Check for catpages without corresponding manpages. 1332 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1333 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1334 while read catpage; do \ 1335 read manpage; \ 1336 if [ ! -e "$${manpage}" ]; then \ 1337 echo $${catpage} ; \ 1338 fi; \ 1339 done 1340 1341delete-old-libs: 1342 @echo ">>> Removing old libraries" 1343 @echo "${OLD_LIBS_MESSAGE}" | fmt 1344 @for file in ${OLD_LIBS}; do \ 1345 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1346 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1347 rm ${RM_I} "${DESTDIR}/$${file}"; \ 1348 fi; \ 1349 done 1350 @echo ">>> Old libraries removed" 1351 1352check-old-libs: 1353 @echo ">>> Checking for old libraries" 1354 @for file in ${OLD_LIBS}; do \ 1355 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1356 echo "${DESTDIR}/$${file}"; \ 1357 fi; \ 1358 done 1359 1360delete-old-dirs: 1361 @echo ">>> Removing old directories" 1362 @for dir in ${OLD_DIRS}; do \ 1363 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1364 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1365 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1366 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1367 fi; \ 1368 done 1369 @echo ">>> Old directories removed" 1370 1371check-old-dirs: 1372 @echo ">>> Checking for old directories" 1373 @for dir in ${OLD_DIRS}; do \ 1374 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1375 echo "${DESTDIR}/$${dir}"; \ 1376 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1377 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1378 fi; \ 1379 done 1380 1381delete-old: delete-old-files delete-old-dirs 1382 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1383 1384check-old: check-old-files check-old-libs check-old-dirs 1385 @echo "To remove old files and directories run '${MAKE} delete-old'." 1386 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1387 1388.endif 1389 1390# 1391# showconfig - show build configuration. 1392# 1393showconfig: 1394 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort 1395 1396.if !empty(KRNLOBJDIR) && !empty(KERNCONF) 1397DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ 1398 1399.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) 1400.if exists(${KERNCONFDIR}/${KERNCONF}) 1401FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ 1402 ${KERNCONFDIR}/${KERNCONF} 1403.endif 1404.endif 1405 1406.endif 1407 1408.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) 1409DTBOUTPUTPATH= ${.CURDIR} 1410.endif 1411 1412# 1413# Build 'standalone' Device Tree Blob 1414# 1415builddtb: 1416 @if [ "${FDT_DTS_FILE}" = "" ]; then \ 1417 echo "ERROR: FDT_DTS_FILE must be specified!"; \ 1418 exit 1; \ 1419 fi; \ 1420 if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \ 1421 echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ 1422 exist!"; \ 1423 exit 1; \ 1424 fi; \ 1425 if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ 1426 echo "WARNING: DTB will be placed in the current working \ 1427 directory"; \ 1428 fi 1429 @PATH=${TMPPATH} \ 1430 dtc -O dtb -o \ 1431 ${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \ 1432 -p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} 1433 1434############### 1435 1436.if defined(XDEV) && defined(XDEV_ARCH) 1437 1438.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} 1439XDEV_CPUTYPE?=${CPUTYPE} 1440.else 1441XDEV_CPUTYPE?=${TARGET_CPUTYPE} 1442.endif 1443 1444NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ 1445 -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \ 1446 -DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ 1447 TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ 1448 CPUTYPE=${XDEV_CPUTYPE} 1449 1450XDDIR=${XDEV_ARCH}-freebsd 1451XDTP=/usr/${XDDIR} 1452CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} 1453CDENV= ${CDBENV} \ 1454 _SHLIBDIRPREFIX=${XDTP} \ 1455 TOOLS_PREFIX=${XDTP} 1456CD2ENV=${CDENV} \ 1457 MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} 1458 1459CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp 1460CDMAKE=${CDENV} ${MAKE} ${NOFUN} 1461CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} 1462XDDESTDIR=${DESTDIR}${XDTP} 1463.if !defined(OSREL) 1464OSREL!= uname -r | sed -e 's/[-(].*//' 1465.endif 1466 1467.ORDER: xdev-build xdev-install 1468xdev: xdev-build xdev-install 1469 1470.ORDER: _xb-build-tools _xb-cross-tools 1471xdev-build: _xb-build-tools _xb-cross-tools 1472 1473_xb-build-tools: 1474 ${_+_}@cd ${.CURDIR}; \ 1475 ${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools 1476 1477_xb-cross-tools: 1478.for _tool in \ 1479 gnu/usr.bin/binutils \ 1480 gnu/usr.bin/cc 1481 ${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ 1482 cd ${.CURDIR}/${_tool}; \ 1483 ${CDMAKE} DIRPRFX=${_tool}/ obj; \ 1484 ${CDMAKE} DIRPRFX=${_tool}/ depend; \ 1485 ${CDMAKE} DIRPRFX=${_tool}/ all 1486.endfor 1487 1488_xi-mtree: 1489 ${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" 1490 mkdir -p ${XDDESTDIR} 1491 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ 1492 -p ${XDDESTDIR} >/dev/null 1493 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ 1494 -p ${XDDESTDIR}/usr >/dev/null 1495 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 1496 -p ${XDDESTDIR}/usr/include >/dev/null 1497 1498.ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1499xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links 1500 1501_xi-cross-tools: 1502 @echo "_xi-cross-tools" 1503.for _tool in \ 1504 gnu/usr.bin/binutils \ 1505 gnu/usr.bin/cc 1506 ${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ 1507 cd ${.CURDIR}/${_tool}; \ 1508 ${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} 1509.endfor 1510 1511_xi-includes: 1512 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ 1513 DESTDIR=${XDDESTDIR} 1514 1515_xi-libraries: 1516 ${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ 1517 DESTDIR=${XDDESTDIR} 1518 1519_xi-links: 1520 ${_+_}cd ${XDDESTDIR}/usr/bin; \ 1521 for i in *; do \ 1522 ln -sf ../../${XDTP}/usr/bin/$$i \ 1523 ../../../../usr/bin/${XDDIR}-$$i; \ 1524 ln -sf ../../${XDTP}/usr/bin/$$i \ 1525 ../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ 1526 done 1527.endif 1528