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