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