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