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 162INSTALLTMP!= /usr/bin/mktemp -d -u -t install 163 164# 165# Building a world goes through the following stages 166# 167# 1. legacy stage [BMAKE] 168# This stage is responsible for creating compatibility 169# shims that are needed by the bootstrap-tools, 170# build-tools and cross-tools stages. 171# 1. bootstrap-tools stage [BMAKE] 172# This stage is responsible for creating programs that 173# are needed for backward compatibility reasons. They 174# are not built as cross-tools. 175# 2. build-tools stage [TMAKE] 176# This stage is responsible for creating the object 177# tree and building any tools that are needed during 178# the build process. 179# 3. cross-tools stage [XMAKE] 180# This stage is responsible for creating any tools that 181# are needed for cross-builds. A cross-compiler is one 182# of them. 183# 4. world stage [WMAKE] 184# This stage actually builds the world. 185# 5. install stage (optional) [IMAKE] 186# This stage installs a previously built world. 187# 188 189BOOTSTRAPPING?= 0 190 191# Common environment for world related stages 192CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 193 MACHINE_ARCH=${TARGET_ARCH} \ 194 MACHINE=${TARGET} \ 195 CPUTYPE=${TARGET_CPUTYPE} \ 196 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 197 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 198 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 199 200# bootstrap-tools stage 201BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ 202 PATH=${BPATH}:${PATH} \ 203 WORLDTMP=${WORLDTMP} \ 204 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 205BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 206 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 207 DESTDIR= \ 208 BOOTSTRAPPING=${OSRELDATE} \ 209 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ 210 -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ 211 -DNO_CPU_CFLAGS -DNO_WARNS 212 213# build-tools stage 214TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 215 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 216 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 217 DESTDIR= \ 218 BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS 219 220# cross-tools stage 221XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ 222 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ 223 -DWITHOUT_FORTRAN -DWITHOUT_GDB 224 225# world stage 226WMAKEENV= ${CROSSENV} \ 227 _SHLIBDIRPREFIX=${WORLDTMP} \ 228 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 229 PATH=${TMPPATH} 230WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} 231 232.if ${TARGET_ARCH} == "amd64" 233# 32 bit world 234LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 235 236.if empty(TARGET_CPUTYPE) 237LIB32CPUTYPE= k8 238.else 239LIB32CPUTYPE= ${TARGET_CPUTYPE} 240.endif 241LIB32FLAGS= -m32 -march=${LIB32CPUTYPE} -mfancy-math-387 -DCOMPAT_32BIT \ 242 -iprefix ${LIB32TMP}/usr/ \ 243 -L${LIB32TMP}/usr/lib32 \ 244 -B${LIB32TMP}/usr/lib32 245 246# Yes, the flags are redundant. 247LIB32WMAKEENV= 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} ${LIB32FLAGS}" \ 254 CXX="${CXX} ${LIB32FLAGS}" \ 255 OBJC="${OBJC} ${LIB32FLAGS}" \ 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 261LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ 262 -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \ 263 -DWITHOUT_HTML DESTDIR=${LIB32TMP} 264LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -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/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 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} 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; ${LIB32WMAKE} ${_t} 435 cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t} 436.if ${MK_CDDL} != "no" 437 cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t} 438.endif 439 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t} 440.if ${MK_CRYPT} != "no" 441 cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t} 442.endif 443.if ${MK_KERBEROS} != "no" 444 cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t} 445.endif 446.endfor 447.for _dir in usr.bin/lex/lib 448 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj 449.endfor 450.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic 451 cd ${.CURDIR}/${_dir}; \ 452 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools 453.endfor 454 cd ${.CURDIR}; \ 455 ${LIB32WMAKE} -f Makefile.inc1 libraries 456.for _t in obj depend all 457 cd ${.CURDIR}/libexec/rtld-elf; \ 458 PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t} 459.endfor 460 461distribute32 install32: 462.if make(distribute32) 463 mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree 464.else 465 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree 466.endif 467 cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 468 cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 469.if ${MK_CRYPT} != "no" 470 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} 471.endif 472 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} 473.endif 474 475 476WMAKE_TGTS= 477.if !defined(SUBDIR_OVERRIDE) 478WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 479.endif 480WMAKE_TGTS+= _cleanobj _obj _build-tools 481.if !defined(SUBDIR_OVERRIDE) 482WMAKE_TGTS+= _cross-tools 483.endif 484WMAKE_TGTS+= _includes _libraries _depend everything 485.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" 486WMAKE_TGTS+= build32 487.endif 488 489buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 490.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue 491 492buildworld_prologue: 493 @echo "--------------------------------------------------------------" 494 @echo ">>> World build started on `LC_ALL=C date`" 495 @echo "--------------------------------------------------------------" 496 497buildworld_epilogue: 498 @echo 499 @echo "--------------------------------------------------------------" 500 @echo ">>> World build completed on `LC_ALL=C date`" 501 @echo "--------------------------------------------------------------" 502 503# 504# We need to have this as a target because the indirection between Makefile 505# and Makefile.inc1 causes the correct PATH to be used, rather than a 506# modification of the current environment's PATH. In addition, we need 507# to quote multiword values. 508# 509buildenvvars: 510 @echo ${WMAKEENV:Q} 511 512buildenv: 513 @echo Entering world for ${TARGET_ARCH}:${TARGET} 514 @cd ${.CURDIR} && env ${WMAKEENV} sh || true 515 516TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} 517toolchain: ${TOOLCHAIN_TGTS} 518kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 519 520# 521# installcheck 522# 523# Checks to be sure system is ready for installworld/installkernel. 524# 525installcheck: 526 527# 528# Require DESTDIR to be set if installing for a different architecture. 529# 530.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} 531.if !make(distributeworld) 532installcheck: installcheck_DESTDIR 533installcheck_DESTDIR: 534.if !defined(DESTDIR) || empty(DESTDIR) 535 @echo "ERROR: Please set DESTDIR!"; \ 536 false 537.endif 538.endif 539.endif 540 541# 542# Check for missing UIDs/GIDs. 543# 544CHECK_UIDS= 545CHECK_GIDS= audit 546.if ${MK_SENDMAIL} != "no" 547CHECK_UIDS+= smmsp 548CHECK_GIDS+= smmsp 549.endif 550.if ${MK_PF} != "no" 551CHECK_UIDS+= proxy 552CHECK_GIDS+= proxy authpf 553.endif 554installcheck: installcheck_UGID 555installcheck_UGID: 556.for uid in ${CHECK_UIDS} 557 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 558 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 559 false; \ 560 fi 561.endfor 562.for gid in ${CHECK_GIDS} 563 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 564 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 565 false; \ 566 fi 567.endfor 568 569# 570# distributeworld 571# 572# Distributes everything compiled by a `buildworld'. 573# 574# installworld 575# 576# Installs everything compiled by a 'buildworld'. 577# 578distributeworld installworld: installcheck 579 mkdir -p ${INSTALLTMP} 580 for prog in [ awk cap_mkdb cat chflags chmod chown \ 581 date echo egrep find grep install-info \ 582 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 583 test true uname wc zic; do \ 584 cp `which $$prog` ${INSTALLTMP}; \ 585 done 586 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} 587 rm -rf ${INSTALLTMP} 588 589# 590# reinstall 591# 592# If you have a build server, you can NFS mount the source and obj directories 593# and do a 'make reinstall' on the *client* to install new binaries from the 594# most recent server build. 595# 596reinstall: 597 @echo "--------------------------------------------------------------" 598 @echo ">>> Making hierarchy" 599 @echo "--------------------------------------------------------------" 600 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 601 @echo 602 @echo "--------------------------------------------------------------" 603 @echo ">>> Installing everything" 604 @echo "--------------------------------------------------------------" 605 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 606.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" 607 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 608.endif 609 610redistribute: 611 @echo "--------------------------------------------------------------" 612 @echo ">>> Distributing everything" 613 @echo "--------------------------------------------------------------" 614 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 615.if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no" 616 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32 617.endif 618 619distrib-dirs distribution: 620 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} 621 622# 623# buildkernel and installkernel 624# 625# Which kernels to build and/or install is specified by setting 626# KERNCONF. If not defined a GENERIC kernel is built/installed. 627# Only the existing (depending TARGET) config files are used 628# for building kernels and only the first of these is designated 629# as the one being installed. 630# 631# Note that we have to use TARGET instead of TARGET_ARCH when 632# we're in kernel-land. Since only TARGET_ARCH is (expected) to 633# be set to cross-build, we have to make sure TARGET is set 634# properly. 635 636.if !defined(KERNCONF) && defined(KERNEL) 637KERNCONF= ${KERNEL} 638KERNWARN= 639.else 640KERNCONF?= GENERIC 641.endif 642INSTKERNNAME?= kernel 643 644KERNSRCDIR?= ${.CURDIR}/sys 645KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 646KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 647KERNCONFDIR?= ${KRNLCONFDIR} 648 649BUILDKERNELS= 650INSTALLKERNEL= 651.for _kernel in ${KERNCONF} 652.if exists(${KERNCONFDIR}/${_kernel}) 653BUILDKERNELS+= ${_kernel} 654.if empty(INSTALLKERNEL) 655INSTALLKERNEL= ${_kernel} 656.endif 657.endif 658.endfor 659 660# 661# buildkernel 662# 663# Builds all kernels defined by BUILDKERNELS. 664# 665buildkernel: 666.if empty(BUILDKERNELS) 667 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 668 false 669.endif 670.if defined(KERNWARN) 671 @echo "--------------------------------------------------------------" 672 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 673 @echo "--------------------------------------------------------------" 674 @sleep 3 675.endif 676 @echo 677.for _kernel in ${BUILDKERNELS} 678 @echo "--------------------------------------------------------------" 679 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 680 @echo "--------------------------------------------------------------" 681 @echo "===> ${_kernel}" 682 mkdir -p ${KRNLOBJDIR} 683.if !defined(NO_KERNELCONFIG) 684 @echo 685 @echo "--------------------------------------------------------------" 686 @echo ">>> stage 1: configuring the kernel" 687 @echo "--------------------------------------------------------------" 688 cd ${KRNLCONFDIR}; \ 689 PATH=${TMPPATH} \ 690 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 691 ${KERNCONFDIR}/${_kernel} 692.endif 693.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 694 @echo 695 @echo "--------------------------------------------------------------" 696 @echo ">>> stage 2.1: cleaning up the object tree" 697 @echo "--------------------------------------------------------------" 698 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} 699.endif 700 @echo 701 @echo "--------------------------------------------------------------" 702 @echo ">>> stage 2.2: rebuilding the object tree" 703 @echo "--------------------------------------------------------------" 704 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj 705 @echo 706 @echo "--------------------------------------------------------------" 707 @echo ">>> stage 2.3: build tools" 708 @echo "--------------------------------------------------------------" 709 cd ${KRNLOBJDIR}/${_kernel}; \ 710 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 711 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 712# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 713.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 714.for target in obj depend all 715 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 716 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 717 ${MAKE} -DNO_CPU_CFLAGS ${target} 718.endfor 719.endif 720.if !defined(NO_KERNELDEPEND) 721 @echo 722 @echo "--------------------------------------------------------------" 723 @echo ">>> stage 3.1: making dependencies" 724 @echo "--------------------------------------------------------------" 725 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ 726.endif 727 @echo 728 @echo "--------------------------------------------------------------" 729 @echo ">>> stage 3.2: building everything" 730 @echo "--------------------------------------------------------------" 731 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ 732 @echo "--------------------------------------------------------------" 733 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 734 @echo "--------------------------------------------------------------" 735.endfor 736 737# 738# installkernel, etc. 739# 740# Install the kernel defined by INSTALLKERNEL 741# 742installkernel installkernel.debug \ 743reinstallkernel reinstallkernel.debug: installcheck 744.if empty(INSTALLKERNEL) 745 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 746 false 747.endif 748 @echo "--------------------------------------------------------------" 749 @echo ">>> Installing kernel" 750 @echo "--------------------------------------------------------------" 751 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 752 ${CROSSENV} PATH=${TMPPATH} \ 753 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 754 755# 756# doxygen 757# 758# Build the API documentation with doxygen 759# 760doxygen: 761 @if [ ! -x `/usr/bin/which doxygen` ]; then \ 762 echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ 763 exit 1; \ 764 fi 765 cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all 766 767# 768# update 769# 770# Update the source tree, by running cvsup and/or running cvs to update to the 771# latest copy. 772# 773update: 774.if defined(SUP_UPDATE) 775 @echo "--------------------------------------------------------------" 776 @echo ">>> Running ${SUP}" 777 @echo "--------------------------------------------------------------" 778.if defined(SUPFILE) 779 @${SUP} ${SUPFLAGS} ${SUPFILE} 780.endif 781.if defined(SUPFILE1) 782 @${SUP} ${SUPFLAGS} ${SUPFILE1} 783.endif 784.if defined(SUPFILE2) 785 @${SUP} ${SUPFLAGS} ${SUPFILE2} 786.endif 787.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 788 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 789.endif 790.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 791 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 792.endif 793.endif 794.if defined(CVS_UPDATE) 795 @echo "--------------------------------------------------------------" 796 @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} 797 @echo "--------------------------------------------------------------" 798 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS} 799.endif 800 801# 802# ------------------------------------------------------------------------ 803# 804# From here onwards are utility targets used by the 'make world' and 805# related targets. If your 'world' breaks, you may like to try to fix 806# the problem and manually run the following targets to attempt to 807# complete the build. Beware, this is *not* guaranteed to work, you 808# need to have a pretty good grip on the current state of the system 809# to attempt to manually finish it. If in doubt, 'make world' again. 810# 811 812# 813# legacy: Build compatibility shims for the next three targets 814# 815legacy: 816.if ${BOOTSTRAPPING} < 503000 817 @echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \ 818 false 819.endif 820.for _tool in tools/build 821 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 822 cd ${.CURDIR}/${_tool}; \ 823 ${MAKE} DIRPRFX=${_tool}/ obj; \ 824 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 825 ${MAKE} DIRPRFX=${_tool}/ depend; \ 826 ${MAKE} DIRPRFX=${_tool}/ all; \ 827 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 828.endfor 829 830# 831# bootstrap-tools: Build tools needed for compatibility 832# 833.if ${MK_GAMES} != "no" 834_strfile= games/fortune/strfile 835.endif 836 837.if ${MK_CXX} != "no" 838_gperf= gnu/usr.bin/gperf 839.if ${BOOTSTRAPPING} < 700004 840_groff= gnu/usr.bin/groff 841.else 842_groff= gnu/usr.bin/groff/tmac 843.endif 844.endif 845 846.if ${BOOTSTRAPPING} < 600029 847_texinfo= gnu/usr.bin/texinfo 848.endif 849 850.if ${BOOTSTRAPPING} < 600015 851_cap_mkdb= usr.bin/cap_mkdb 852.endif 853 854.if ${BOOTSTRAPPING} < 600018 855_colldef= usr.bin/colldef 856.endif 857 858.if ${BOOTSTRAPPING} < 600017 859_gencat= usr.bin/gencat 860.endif 861 862.if ${BOOTSTRAPPING} < 600016 863_mklocale= usr.bin/mklocale 864.endif 865 866.if ${BOOTSTRAPPING} < 700018 867_gensnmptree= usr.sbin/bsnmpd/gensnmptree 868.endif 869 870.if ${MK_RESCUE} != "no" && \ 871 ${BOOTSTRAPPING} < 700026 872_crunchgen= usr.sbin/crunch/crunchgen 873.endif 874 875.if ${BOOTSTRAPPING} < 600020 876_pwd_mkdb= usr.sbin/pwd_mkdb 877.endif 878 879bootstrap-tools: 880.for _tool in \ 881 ${_strfile} \ 882 ${_gperf} \ 883 ${_groff} \ 884 ${_texinfo} \ 885 ${_cap_mkdb} \ 886 ${_colldef} \ 887 ${_gencat} \ 888 usr.bin/lorder \ 889 usr.bin/makewhatis \ 890 ${_mklocale} \ 891 usr.bin/rpcgen \ 892 usr.bin/xinstall \ 893 ${_gensnmptree} \ 894 usr.sbin/config \ 895 ${_crunchgen} \ 896 ${_pwd_mkdb} 897 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 898 cd ${.CURDIR}/${_tool}; \ 899 ${MAKE} DIRPRFX=${_tool}/ obj; \ 900 ${MAKE} DIRPRFX=${_tool}/ depend; \ 901 ${MAKE} DIRPRFX=${_tool}/ all; \ 902 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 903.endfor 904 905# 906# build-tools: Build special purpose build tools 907# 908.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 909_aicasm= sys/modules/aic7xxx/aicasm 910.endif 911 912.if !defined(NO_SHARE) 913_share= share/syscons/scrnmaps 914.endif 915 916.if ${MK_KERBEROS} != "no" 917_kerberos5_tools= kerberos5/tools 918.endif 919 920.if ${MK_RESCUE} != "no" 921_rescue= rescue/rescue 922.endif 923 924build-tools: 925.for _tool in \ 926 bin/csh \ 927 bin/sh \ 928 ${_rescue} \ 929 lib/ncurses/ncurses \ 930 lib/ncurses/ncursesw \ 931 ${_share} \ 932 ${_aicasm} \ 933 usr.bin/awk \ 934 lib/libmagic \ 935 usr.sbin/sysinstall 936 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 937 cd ${.CURDIR}/${_tool}; \ 938 ${MAKE} DIRPRFX=${_tool}/ obj; \ 939 ${MAKE} DIRPRFX=${_tool}/ build-tools 940.endfor 941.for _tool in \ 942 gnu/usr.bin/cc/cc_tools \ 943 ${_kerberos5_tools} 944 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 945 cd ${.CURDIR}/${_tool}; \ 946 ${MAKE} DIRPRFX=${_tool}/ obj; \ 947 ${MAKE} DIRPRFX=${_tool}/ depend; \ 948 ${MAKE} DIRPRFX=${_tool}/ all 949.endfor 950 951# 952# cross-tools: Build cross-building tools 953# 954.if ${TARGET_ARCH} != ${MACHINE_ARCH} 955.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" 956_btxld= usr.sbin/btxld 957.endif 958.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) 959_crunchide= usr.sbin/crunch/crunchide 960.endif 961.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) 962_kgzip= usr.sbin/kgzip 963.endif 964.endif 965 966cross-tools: 967.for _tool in \ 968 gnu/usr.bin/binutils \ 969 gnu/usr.bin/cc \ 970 usr.bin/sed \ 971 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 972 ${_btxld} \ 973 ${_crunchide} \ 974 ${_kgzip} 975 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 976 cd ${.CURDIR}/${_tool}; \ 977 ${MAKE} DIRPRFX=${_tool}/ obj; \ 978 ${MAKE} DIRPRFX=${_tool}/ depend; \ 979 ${MAKE} DIRPRFX=${_tool}/ all; \ 980 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 981.endfor 982 983# 984# hierarchy - ensure that all the needed directories are present 985# 986hierarchy: 987 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 988 989# 990# libraries - build all libraries, and install them under ${DESTDIR}. 991# 992# The list of libraries with dependents (${_prebuild_libs}) and their 993# interdependencies (__L) are built automatically by the 994# ${.CURDIR}/tools/make_libdeps.sh script. 995# 996libraries: 997 cd ${.CURDIR}; \ 998 ${MAKE} -f Makefile.inc1 _prereq_libs; \ 999 ${MAKE} -f Makefile.inc1 _startup_libs; \ 1000 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 1001 ${MAKE} -f Makefile.inc1 _generic_libs; 1002 1003# 1004# static libgcc.a prerequisite for shared libc 1005# 1006_prereq_libs= gnu/lib/libgcc 1007 1008# These dependencies are not automatically generated: 1009# 1010# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before 1011# all shared libraries for ELF. 1012# 1013_startup_libs= gnu/lib/csu 1014.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 1015_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 1016.else 1017_startup_libs+= lib/csu/${MACHINE_ARCH} 1018.endif 1019_startup_libs+= gnu/lib/libgcc 1020_startup_libs+= lib/libc 1021 1022gnu/lib/libgcc__L: lib/libc__L 1023 1024_prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \ 1025 ${_kerberos5_lib_libroken} \ 1026 lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \ 1027 ${_lib_libgssapi} ${_lib_libipx} \ 1028 lib/libkiconv lib/libkvm lib/libmd \ 1029 lib/ncurses/ncurses lib/ncurses/ncursesw \ 1030 lib/libopie lib/libpam lib/${DEFAULT_THREAD_LIB} \ 1031 lib/libradius lib/libsbuf lib/libtacplus lib/libutil \ 1032 ${_lib_libypclnt} lib/libz lib/msun \ 1033 ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ 1034 ${_secure_lib_libssl} 1035 1036_generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib 1037 1038lib/libopie__L lib/libtacplus__L: lib/libmd__L 1039 1040.if ${MK_CDDL} != "no" 1041_cddl_lib= cddl/lib 1042.endif 1043 1044.if ${MK_CRYPT} != "no" 1045.if ${MK_OPENSSL} != "no" 1046_secure_lib_libcrypto= secure/lib/libcrypto 1047_secure_lib_libssl= secure/lib/libssl 1048lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L 1049.if ${MK_OPENSSH} != "no" 1050_secure_lib_libssh= secure/lib/libssh 1051secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 1052.if ${MK_KERBEROS} != "no" 1053secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ 1054 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \ 1055 kerberos5/lib/libroken__L 1056.endif 1057.endif 1058.endif 1059_secure_lib= secure/lib 1060.endif 1061 1062.if ${MK_IPX} != "no" 1063_lib_libipx= lib/libipx 1064.endif 1065 1066.if ${MK_KERBEROS} != "no" 1067_kerberos5_lib= kerberos5/lib 1068_kerberos5_lib_libasn1= kerberos5/lib/libasn1 1069_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 1070_kerberos5_lib_libroken= kerberos5/lib/libroken 1071_lib_libgssapi= lib/libgssapi 1072.endif 1073 1074.if ${MK_NIS} != "no" 1075_lib_libypclnt= lib/libypclnt 1076.endif 1077 1078.if ${MK_OPENSSL} == "no" 1079lib/libradius__L: lib/libmd__L 1080.endif 1081 1082.for _lib in ${_prereq_libs} 1083${_lib}__PL: .PHONY 1084.if exists(${.CURDIR}/${_lib}) 1085 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1086 cd ${.CURDIR}/${_lib}; \ 1087 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1088 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1089 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \ 1090 ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install 1091.endif 1092.endfor 1093 1094.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1095${_lib}__L: .PHONY 1096.if exists(${.CURDIR}/${_lib}) 1097 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ 1098 cd ${.CURDIR}/${_lib}; \ 1099 ${MAKE} DIRPRFX=${_lib}/ obj; \ 1100 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1101 ${MAKE} DIRPRFX=${_lib}/ all; \ 1102 ${MAKE} DIRPRFX=${_lib}/ install 1103.endif 1104.endfor 1105 1106# libpam is special: we need to build static PAM modules before 1107# static PAM library, and dynamic PAM library before dynamic PAM 1108# modules. 1109lib/libpam__L: .PHONY 1110 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ 1111 cd ${.CURDIR}/lib/libpam; \ 1112 ${MAKE} DIRPRFX=lib/libpam/ obj; \ 1113 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1114 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1115 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1116 1117_prereq_libs: ${_prereq_libs:S/$/__PL/} 1118_startup_libs: ${_startup_libs:S/$/__L/} 1119_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1120_generic_libs: ${_generic_libs:S/$/__L/} 1121 1122.for __target in all clean cleandepend cleandir depend includes obj 1123.for entry in ${SUBDIR} 1124${entry}.${__target}__D: .PHONY 1125 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1126 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1127 edir=${entry}.${MACHINE_ARCH}; \ 1128 cd ${.CURDIR}/$${edir}; \ 1129 else \ 1130 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1131 edir=${entry}; \ 1132 cd ${.CURDIR}/$${edir}; \ 1133 fi; \ 1134 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1135.endfor 1136par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1137.endfor 1138 1139.include <bsd.subdir.mk> 1140 1141.if make(check-old) || make(check-old-dirs) || \ 1142 make(check-old-files) || make(check-old-libs) || \ 1143 make(delete-old) || make(delete-old-dirs) || \ 1144 make(delete-old-files) || make(delete-old-libs) 1145 1146# 1147# check for / delete old files section 1148# 1149 1150.include "ObsoleteFiles.inc" 1151 1152OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ 1153else you can not start such an application. Consult UPDATING for more \ 1154information regarding how to cope with the removal/revision bump of a \ 1155specific library." 1156 1157.if !defined(BATCH_DELETE_OLD_FILES) 1158RM_I=-i 1159.else 1160RM_I=-v 1161.endif 1162 1163delete-old-files: 1164 @echo ">>> Removing old files (only deletes safe to delete libs)" 1165# Ask for every old file if the user really wants to remove it. 1166# It's annoying, but better safe than sorry. 1167 @for file in ${OLD_FILES}; do \ 1168 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1169 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1170 rm ${RM_I} "${DESTDIR}/$${file}"; \ 1171 fi; \ 1172 done 1173# Remove catpages without corresponding manpages. 1174 @3<&0; \ 1175 find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1176 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1177 while read catpage; do \ 1178 read manpage; \ 1179 if [ ! -e "$${manpage}" ]; then \ 1180 rm ${RM_I} $${catpage} <&3 ; \ 1181 fi; \ 1182 done 1183 @echo ">>> Old files removed" 1184 1185check-old-files: 1186 @echo ">>> Checking for old files" 1187 @for file in ${OLD_FILES}; do \ 1188 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1189 echo "${DESTDIR}/$${file}"; \ 1190 fi; \ 1191 done 1192# Check for catpages without corresponding manpages. 1193 @find ${DESTDIR}/usr/share/man/cat* ! -type d | \ 1194 sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ 1195 while read catpage; do \ 1196 read manpage; \ 1197 if [ ! -e "$${manpage}" ]; then \ 1198 echo $${catpage} ; \ 1199 fi; \ 1200 done 1201 1202delete-old-libs: 1203 @echo ">>> Removing old libraries" 1204 @echo "${OLD_LIBS_MESSAGE}" | fmt 1205 @for file in ${OLD_LIBS}; do \ 1206 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1207 chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ 1208 rm ${RM_I} "${DESTDIR}/$${file}"; \ 1209 fi; \ 1210 done 1211 @echo ">>> Old libraries removed" 1212 1213check-old-libs: 1214 @echo ">>> Checking for old libraries" 1215 @for file in ${OLD_LIBS}; do \ 1216 if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ 1217 echo "${DESTDIR}/$${file}"; \ 1218 fi; \ 1219 done 1220 1221delete-old-dirs: 1222 @echo ">>> Removing old directories" 1223 @for dir in ${OLD_DIRS}; do \ 1224 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1225 rmdir -v "${DESTDIR}/$${dir}" || true; \ 1226 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1227 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1228 fi; \ 1229 done 1230 @echo ">>> Old directories removed" 1231 1232check-old-dirs: 1233 @echo ">>> Checking for old directories" 1234 @for dir in ${OLD_DIRS}; do \ 1235 if [ -d "${DESTDIR}/$${dir}" ]; then \ 1236 echo "${DESTDIR}/$${dir}"; \ 1237 elif [ -L "${DESTDIR}/$${dir}" ]; then \ 1238 echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ 1239 fi; \ 1240 done 1241 1242delete-old: delete-old-files delete-old-dirs 1243 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1244 1245check-old: check-old-files check-old-libs check-old-dirs 1246 @echo "To remove old files and directories run '${MAKE} delete-old'." 1247 @echo "To remove old libraries run '${MAKE} delete-old-libs'." 1248 1249.endif 1250 1251# 1252# showconfig - show build configuration. 1253# 1254showconfig: 1255 @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort 1256