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