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