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