Makefile.inc1 revision 142766
1# 2# $FreeBSD: head/Makefile.inc1 142766 2005-02-28 09:23:38Z obrien $ 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} 131OBJTREE= ${MAKEOBJDIRPREFIX} 132.else 133OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} 134.endif 135WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH} 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 ${MACHINE_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_ARCH=i386 \ 227 INSTALL="sh ${.CURDIR}/tools/install.sh" \ 228 PATH=${TMPPATH} \ 229 CC="cc ${LIB32CC}" \ 230 CXX="c++ ${LIB32CXX}" \ 231 OBJC="cc ${LIB32OBJC}" \ 232 LD="ld -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ 233 AS="as --32" \ 234 LIBDIR=/usr/lib32 \ 235 SHLIBDIR=/usr/lib32 236 237LIB32MAKE= ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ 238 -DNO_BIND -DNO_MAN -DNO_NLS -DNO_INFO -DNO_HTML \ 239 CC="cc ${LIB32CC}" \ 240 CXX="c++ ${LIB32CXX}" \ 241 OBJC="cc ${LIB32OBJC}" \ 242 LD="ld -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ 243 AS="as --32" \ 244 LIBDIR=/usr/lib32 \ 245 SHLIBDIR=/usr/lib32 246.endif 247 248# install stage 249.if empty(.MAKEFLAGS:M-n) 250IMAKEENV= ${CROSSENV} \ 251 PATH=${STRICTTMPPATH}:${INSTALLTMP} 252.else 253IMAKEENV= ${CROSSENV} \ 254 PATH=${TMPPATH}:${INSTALLTMP} 255.endif 256IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 257 258# kernel stage 259KMAKEENV= ${WMAKEENV} 260 261# 262# buildworld 263# 264# Attempt to rebuild the entire system, with reasonable chance of 265# success, regardless of how old your existing system is. 266# 267_worldtmp: 268.if ${.CURDIR:C/[^,]//g} != "" 269# The m4 build of sendmail files doesn't like it if ',' is used 270# anywhere in the path of it's files. 271 @echo 272 @echo "*** Error: path to source tree contains a comma ','" 273 @echo 274 false 275.endif 276 @echo 277 @echo "--------------------------------------------------------------" 278 @echo ">>> Rebuilding the temporary build tree" 279 @echo "--------------------------------------------------------------" 280.if !defined(NO_CLEAN) 281 rm -rf ${WORLDTMP} 282.else 283 rm -rf ${WORLDTMP}/legacy/usr/include 284 # XXX - These two can depend on any header file. 285 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 286 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 287.endif 288.for _dir in \ 289 usr/bin usr/games usr/include/c++/3.4 usr/include/sys usr/lib \ 290 usr/libexec usr/sbin usr/share/dict \ 291 usr/share/groff_font/devX100 \ 292 usr/share/groff_font/devX100-12 \ 293 usr/share/groff_font/devX75 \ 294 usr/share/groff_font/devX75-12 \ 295 usr/share/groff_font/devascii \ 296 usr/share/groff_font/devcp1047 \ 297 usr/share/groff_font/devdvi \ 298 usr/share/groff_font/devhtml \ 299 usr/share/groff_font/devkoi8-r \ 300 usr/share/groff_font/devlatin1 \ 301 usr/share/groff_font/devlbp \ 302 usr/share/groff_font/devlj4 \ 303 usr/share/groff_font/devps \ 304 usr/share/groff_font/devutf8 \ 305 usr/share/tmac/mdoc usr/share/tmac/mm 306 mkdir -p ${WORLDTMP}/legacy/${_dir} 307.endfor 308.for _dir in \ 309 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \ 310 usr/libexec usr/sbin usr/share/misc \ 311 usr/share/snmp/defs usr/share/snmp/mibs 312 mkdir -p ${WORLDTMP}/${_dir} 313.endfor 314 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 315 -p ${WORLDTMP}/usr/include >/dev/null 316 ln -sf ${.CURDIR}/sys ${WORLDTMP} 317.if defined(WITH_BIND_LIBS) && !defined(NO_BIND) 318 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ 319 -p ${WORLDTMP}/usr/include >/dev/null 320.endif 321_legacy: 322 @echo 323 @echo "--------------------------------------------------------------" 324 @echo ">>> stage 1.1: legacy release compatibility shims" 325 @echo "--------------------------------------------------------------" 326 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy 327_bootstrap-tools: 328 @echo 329 @echo "--------------------------------------------------------------" 330 @echo ">>> stage 1.2: bootstrap tools" 331 @echo "--------------------------------------------------------------" 332 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools 333_cleanobj: 334.if !defined(NO_CLEAN) 335 @echo 336 @echo "--------------------------------------------------------------" 337 @echo ">>> stage 2.1: cleaning up the object tree" 338 @echo "--------------------------------------------------------------" 339 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 340.endif 341_obj: 342 @echo 343 @echo "--------------------------------------------------------------" 344 @echo ">>> stage 2.2: rebuilding the object tree" 345 @echo "--------------------------------------------------------------" 346 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj 347_build-tools: 348 @echo 349 @echo "--------------------------------------------------------------" 350 @echo ">>> stage 2.3: build tools" 351 @echo "--------------------------------------------------------------" 352 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools 353_cross-tools: 354 @echo 355 @echo "--------------------------------------------------------------" 356 @echo ">>> stage 3: cross tools" 357 @echo "--------------------------------------------------------------" 358 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools 359_includes: 360 @echo 361 @echo "--------------------------------------------------------------" 362 @echo ">>> stage 4.1: building includes" 363 @echo "--------------------------------------------------------------" 364 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 365_libraries: 366 @echo 367 @echo "--------------------------------------------------------------" 368 @echo ">>> stage 4.2: building libraries" 369 @echo "--------------------------------------------------------------" 370 ${_+_}cd ${.CURDIR}; \ 371 ${WMAKE} -DNO_FSCHG -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN \ 372 -DNO_NLS -DNO_PROFILE libraries 373_depend: 374 @echo 375 @echo "--------------------------------------------------------------" 376 @echo ">>> stage 4.3: make dependencies" 377 @echo "--------------------------------------------------------------" 378 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend 379everything: 380 @echo 381 @echo "--------------------------------------------------------------" 382 @echo ">>> stage 4.4: building everything" 383 @echo "--------------------------------------------------------------" 384 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all 385.if ${MACHINE_ARCH} == "amd64" 386build32: 387 @echo 388 @echo "--------------------------------------------------------------" 389 @echo ">>> stage 5.1: building 32 bit shim libraries" 390 @echo "--------------------------------------------------------------" 391.for _dir in \ 392 lib lib32 usr/bin usr/include usr/lib32 usr/libdata/ldscripts \ 393 usr/libexec usr/sbin usr/share/misc \ 394 usr/share/snmp/defs usr/share/snmp/mibs 395 mkdir -p ${LIB32TMP}/${_dir} 396.endfor 397 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 398 -p ${LIB32TMP}/usr/include >/dev/null 399 ln -sf ${.CURDIR}/sys ${WORLDTMP} 400.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) 401.for _t in obj depend all 402 cd ${.CURDIR}/kerberos5/tools; \ 403 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} ${_t} 404.endfor 405.endif 406.for _t in obj includes 407 cd ${.CURDIR}/include; \ 408 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} 409 cd ${.CURDIR}/lib; \ 410 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} 411 cd ${.CURDIR}/gnu/lib; \ 412 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} 413.if !defined(NO_CRYPT) 414 cd ${.CURDIR}/secure/lib; \ 415 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} 416.endif 417.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) 418 cd ${.CURDIR}/kerberos5/lib; \ 419 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} 420.endif 421.endfor 422.for _dir in usr.sbin/pcvt/keycap usr.bin/lex/lib 423 cd ${.CURDIR}/${_dir}; \ 424 ${LIB32MAKE} DESTDIR=${LIB32TMP} obj 425.endfor 426.for _dir in lib/libncurses lib/libmagic 427 cd ${.CURDIR}/${_dir}; \ 428 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} build-tools 429.endfor 430 cd ${.CURDIR}; \ 431 ${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries 432.for _t in obj depend all 433 cd ${.CURDIR}/libexec/rtld-elf; \ 434 PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} 435.endfor 436 437install32: 438 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree 439 cd ${.CURDIR}/lib; ${LIB32MAKE} install 440 cd ${.CURDIR}/gnu/lib; ${LIB32MAKE} install 441.if !defined(NO_CRYPT) 442 cd ${.CURDIR}/secure/lib; ${LIB32MAKE} install 443.endif 444 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32MAKE} install 445.endif 446 447 448WMAKE_TGTS= 449.if !defined(SUBDIR_OVERRIDE) 450WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 451.endif 452WMAKE_TGTS+= _cleanobj _obj _build-tools 453.if !defined(SUBDIR_OVERRIDE) 454WMAKE_TGTS+= _cross-tools 455.endif 456WMAKE_TGTS+= _includes _libraries _depend everything 457.if ${MACHINE_ARCH} == "amd64" && defined(WITH_LIB32) 458WMAKE_TGTS+= build32 459.endif 460 461buildworld: ${WMAKE_TGTS} 462.ORDER: ${WMAKE_TGTS} 463 464buildenv: 465 @echo Entering world for ${TARGET_ARCH}:${TARGET} 466 @cd ${.CURDIR} && env ${WMAKEENV} sh || true 467 468TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything} 469toolchain: ${TOOLCHAIN_TGTS} 470kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 471 472# 473# Use this to add checks to installworld/installkernel targets. 474# 475SPECIAL_INSTALLCHECKS= 476 477# 478# installcheck 479# 480# Checks to be sure system is ready for installworld 481# 482CHECK_UIDS= 483CHECK_GIDS= 484.if !defined(NO_SENDMAIL) 485CHECK_UIDS+= smmsp 486CHECK_GIDS+= smmsp 487.endif 488.if !defined(NO_PF) 489CHECK_UIDS+= proxy 490CHECK_GIDS+= proxy authpf 491.endif 492installcheck: ${SPECIAL_INSTALLCHECKS} 493.for uid in ${CHECK_UIDS} 494 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 495 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 496 false; \ 497 fi 498.endfor 499.for gid in ${CHECK_GIDS} 500 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 501 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 502 false; \ 503 fi 504.endfor 505 506# 507# distributeworld 508# 509# Distributes everything compiled by a `buildworld'. 510# 511# installworld 512# 513# Installs everything compiled by a 'buildworld'. 514# 515distributeworld installworld: installcheck 516 mkdir -p ${INSTALLTMP} 517 for prog in [ awk cap_mkdb cat chflags chmod chown \ 518 date echo egrep find grep \ 519 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 520 test true uname wc zic; do \ 521 cp `which $$prog` ${INSTALLTMP}; \ 522 done 523 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} 524 rm -rf ${INSTALLTMP} 525 526# 527# reinstall 528# 529# If you have a build server, you can NFS mount the source and obj directories 530# and do a 'make reinstall' on the *client* to install new binaries from the 531# most recent server build. 532# 533reinstall: ${SPECIAL_INSTALLCHECKS} 534 @echo "--------------------------------------------------------------" 535 @echo ">>> Making hierarchy" 536 @echo "--------------------------------------------------------------" 537 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 538 @echo 539 @echo "--------------------------------------------------------------" 540 @echo ">>> Installing everything" 541 @echo "--------------------------------------------------------------" 542 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 543.if ${MACHINE_ARCH} == "amd64" && defined(WITH_LIB32) 544 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 545.endif 546 547redistribute: 548 @echo "--------------------------------------------------------------" 549 @echo ">>> Distributing everything" 550 @echo "--------------------------------------------------------------" 551 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 552 553distribution: 554 cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} distribution 555 556# 557# buildkernel and installkernel 558# 559# Which kernels to build and/or install is specified by setting 560# KERNCONF. If not defined a GENERIC kernel is built/installed. 561# Only the existing (depending TARGET) config files are used 562# for building kernels and only the first of these is designated 563# as the one being installed. 564# 565# Note that we have to use TARGET instead of TARGET_ARCH when 566# we're in kernel-land. Since only TARGET_ARCH is (expected) to 567# be set to cross-build, we have to make sure TARGET is set 568# properly. 569 570.if !defined(KERNCONF) && defined(KERNEL) 571KERNCONF= ${KERNEL} 572KERNWARN= 573.else 574KERNCONF?= GENERIC 575.endif 576INSTKERNNAME?= kernel 577 578KERNSRCDIR?= ${.CURDIR}/sys 579KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 580KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 581KERNCONFDIR?= ${KRNLCONFDIR} 582 583BUILDKERNELS= 584INSTALLKERNEL= 585.for _kernel in ${KERNCONF} 586.if exists(${KERNCONFDIR}/${_kernel}) 587BUILDKERNELS+= ${_kernel} 588.if empty(INSTALLKERNEL) 589INSTALLKERNEL= ${_kernel} 590.endif 591.endif 592.endfor 593 594# 595# buildkernel 596# 597# Builds all kernels defined by BUILDKERNELS. 598# 599buildkernel: 600.if empty(BUILDKERNELS) 601 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ 602 false 603.endif 604.if defined(KERNWARN) 605 @echo "--------------------------------------------------------------" 606 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 607 @echo "--------------------------------------------------------------" 608 @sleep 3 609.endif 610 @echo 611.for _kernel in ${BUILDKERNELS} 612 @echo "--------------------------------------------------------------" 613 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 614 @echo "--------------------------------------------------------------" 615 @echo "===> ${_kernel}" 616 mkdir -p ${KRNLOBJDIR} 617.if !defined(NO_KERNELCONFIG) 618 @echo 619 @echo "--------------------------------------------------------------" 620 @echo ">>> stage 1: configuring the kernel" 621 @echo "--------------------------------------------------------------" 622 cd ${KRNLCONFDIR}; \ 623 PATH=${TMPPATH} \ 624 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 625 ${KERNCONFDIR}/${_kernel} 626.endif 627.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) 628 @echo 629 @echo "--------------------------------------------------------------" 630 @echo ">>> stage 2.1: cleaning up the object tree" 631 @echo "--------------------------------------------------------------" 632 cd ${KRNLOBJDIR}/${_kernel}; \ 633 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR} 634.endif 635 @echo 636 @echo "--------------------------------------------------------------" 637 @echo ">>> stage 2.2: rebuilding the object tree" 638 @echo "--------------------------------------------------------------" 639 cd ${KRNLOBJDIR}/${_kernel}; \ 640 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj 641 @echo 642 @echo "--------------------------------------------------------------" 643 @echo ">>> stage 2.3: build tools" 644 @echo "--------------------------------------------------------------" 645 cd ${KRNLOBJDIR}/${_kernel}; \ 646 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 647 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 648# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 649.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 650.for target in obj depend all 651 cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ 652 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 653 ${MAKE} -DNO_CPU_CFLAGS ${target} 654.endfor 655.endif 656.if !defined(NO_KERNELDEPEND) 657 @echo 658 @echo "--------------------------------------------------------------" 659 @echo ">>> stage 3.1: making dependencies" 660 @echo "--------------------------------------------------------------" 661 cd ${KRNLOBJDIR}/${_kernel}; \ 662 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ 663.endif 664 @echo 665 @echo "--------------------------------------------------------------" 666 @echo ">>> stage 3.2: building everything" 667 @echo "--------------------------------------------------------------" 668 cd ${KRNLOBJDIR}/${_kernel}; \ 669 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ 670 @echo "--------------------------------------------------------------" 671 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 672 @echo "--------------------------------------------------------------" 673.endfor 674 675# 676# installkernel, etc. 677# 678# Install the kernel defined by INSTALLKERNEL 679# 680installkernel installkernel.debug \ 681reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS} 682.if empty(INSTALLKERNEL) 683 @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ 684 false 685.endif 686 @echo "--------------------------------------------------------------" 687 @echo ">>> Making hierarchy" 688 @echo "--------------------------------------------------------------" 689 cd ${.CURDIR}; \ 690 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy 691 @echo 692 @echo "--------------------------------------------------------------" 693 @echo ">>> Installing kernel" 694 @echo "--------------------------------------------------------------" 695 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 696 ${CROSSENV} PATH=${TMPPATH} \ 697 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 698 699# 700# update 701# 702# Update the source tree, by running cvsup and/or running cvs to update to the 703# latest copy. 704# 705update: 706.if defined(SUP_UPDATE) 707 @echo "--------------------------------------------------------------" 708 @echo ">>> Running ${SUP}" 709 @echo "--------------------------------------------------------------" 710.if defined(SUPFILE) 711 @${SUP} ${SUPFLAGS} ${SUPFILE} 712.endif 713.if defined(SUPFILE1) 714 @${SUP} ${SUPFLAGS} ${SUPFILE1} 715.endif 716.if defined(SUPFILE2) 717 @${SUP} ${SUPFLAGS} ${SUPFILE2} 718.endif 719.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 720 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 721.endif 722.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 723 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 724.endif 725.endif 726.if defined(CVS_UPDATE) 727 @echo "--------------------------------------------------------------" 728 @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} 729 @echo "--------------------------------------------------------------" 730 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS} 731.endif 732 733# 734# ------------------------------------------------------------------------ 735# 736# From here onwards are utility targets used by the 'make world' and 737# related targets. If your 'world' breaks, you may like to try to fix 738# the problem and manually run the following targets to attempt to 739# complete the build. Beware, this is *not* guaranteed to work, you 740# need to have a pretty good grip on the current state of the system 741# to attempt to manually finish it. If in doubt, 'make world' again. 742# 743 744# 745# legacy: Build compatibility shims for the next three targets 746# 747legacy: 748.if ${BOOTSTRAPPING} < 503000 749 @echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \ 750 false 751.endif 752.for _tool in tools/build 753 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ 754 cd ${.CURDIR}/${_tool}; \ 755 ${MAKE} DIRPRFX=${_tool}/ obj; \ 756 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 757 ${MAKE} DIRPRFX=${_tool}/ depend; \ 758 ${MAKE} DIRPRFX=${_tool}/ all; \ 759 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 760.endfor 761 762# 763# bootstrap-tools: Build tools needed for compatibility 764# 765.if !defined(NO_GAMES) 766_strfile= games/fortune/strfile 767.endif 768 769.if !defined(NO_CXX) 770_gperf= gnu/usr.bin/gperf 771.if ${BOOTSTRAPPING} < 500113 772_groff= gnu/usr.bin/groff 773.else 774_groff= gnu/usr.bin/groff/tmac 775.endif 776.endif 777 778.if ${BOOTSTRAPPING} < 600015 779_cap_mkdb= usr.bin/cap_mkdb 780.endif 781 782.if ${BOOTSTRAPPING} < 600018 783_colldef= usr.bin/colldef 784.endif 785 786.if ${BOOTSTRAPPING} < 600017 787_gencat= usr.bin/gencat 788.endif 789 790.if ${BOOTSTRAPPING} < 600016 791_mklocale= usr.bin/mklocale 792.endif 793 794.if !defined(NO_RESCUE) && \ 795 ${BOOTSTRAPPING} < 600008 796_crunchgen= usr.sbin/crunch/crunchgen 797.endif 798 799bootstrap-tools: 800.for _tool in \ 801 ${_strfile} \ 802 ${_gperf} \ 803 ${_groff} \ 804 gnu/usr.bin/texinfo \ 805 ${_cap_mkdb} \ 806 ${_colldef} \ 807 ${_gencat} \ 808 usr.bin/lorder \ 809 usr.bin/makewhatis \ 810 ${_mklocale} \ 811 usr.bin/rpcgen \ 812 usr.bin/xinstall \ 813 usr.sbin/config \ 814 ${_crunchgen} 815 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 816 cd ${.CURDIR}/${_tool}; \ 817 ${MAKE} DIRPRFX=${_tool}/ obj; \ 818 ${MAKE} DIRPRFX=${_tool}/ depend; \ 819 ${MAKE} DIRPRFX=${_tool}/ all; \ 820 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 821.endfor 822 823# 824# build-tools: Build special purpose build tools 825# 826.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 827_aicasm= sys/modules/aic7xxx/aicasm 828.endif 829 830.if !defined(NO_SHARE) 831_share= share/syscons/scrnmaps 832.endif 833 834.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) 835_kerberos5_tools= kerberos5/tools 836.endif 837 838.if !defined(NO_RESCUE) 839_rescue= rescue/rescue 840.endif 841 842build-tools: 843.for _tool in \ 844 bin/csh \ 845 bin/sh \ 846 ${_rescue} \ 847 lib/libncurses \ 848 ${_share} \ 849 ${_aicasm} \ 850 usr.bin/awk \ 851 lib/libmagic \ 852 usr.sbin/sysinstall 853 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ 854 cd ${.CURDIR}/${_tool}; \ 855 ${MAKE} DIRPRFX=${_tool}/ obj; \ 856 ${MAKE} DIRPRFX=${_tool}/ build-tools 857.endfor 858.for _tool in \ 859 gnu/usr.bin/cc/cc_tools \ 860 ${_kerberos5_tools} 861 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ 862 cd ${.CURDIR}/${_tool}; \ 863 ${MAKE} DIRPRFX=${_tool}/ obj; \ 864 ${MAKE} DIRPRFX=${_tool}/ depend; \ 865 ${MAKE} DIRPRFX=${_tool}/ all 866.endfor 867 868# 869# cross-tools: Build cross-building tools 870# 871.if (${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386") && \ 872 ${TARGET_ARCH} != ${MACHINE_ARCH} 873_btxld= usr.sbin/btxld 874.endif 875 876.if (!defined(NO_RESCUE) || defined(RELEASEDIR)) && \ 877 ${TARGET_ARCH} != ${MACHINE_ARCH} 878_crunchide= usr.sbin/crunch/crunchide 879.endif 880 881.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH} 882_elf2exe= usr.sbin/elf2exe 883.endif 884 885.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \ 886 defined(RELEASEDIR) 887_kgzip= usr.sbin/kgzip 888.endif 889 890cross-tools: 891.for _tool in \ 892 gnu/usr.bin/binutils \ 893 gnu/usr.bin/cc \ 894 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 895 ${_btxld} \ 896 ${_crunchide} \ 897 ${_elf2exe} \ 898 ${_kgzip} 899 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ 900 cd ${.CURDIR}/${_tool}; \ 901 ${MAKE} DIRPRFX=${_tool}/ obj; \ 902 ${MAKE} DIRPRFX=${_tool}/ depend; \ 903 ${MAKE} DIRPRFX=${_tool}/ all; \ 904 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 905.endfor 906 907# 908# hierarchy - ensure that all the needed directories are present 909# 910hierarchy: 911 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 912 913# 914# libraries - build all libraries, and install them under ${DESTDIR}. 915# 916# The list of libraries with dependents (${_prebuild_libs}) and their 917# interdependencies (__L) are built automatically by the 918# ${.CURDIR}/tools/make_libdeps.sh script. 919# 920libraries: 921 cd ${.CURDIR}; \ 922 ${MAKE} -f Makefile.inc1 _startup_libs; \ 923 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 924 ${MAKE} -f Makefile.inc1 _generic_libs; 925 926# These dependencies are not automatically generated: 927# 928# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all 929# shared libraries for ELF. 930# 931_startup_libs= gnu/lib/csu gnu/lib/libgcc 932.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 933_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 934.else 935_startup_libs+= lib/csu/${MACHINE_ARCH} 936.endif 937 938_prebuild_libs= 939 940_generic_libs= gnu/lib 941 942.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) 943_prebuild_libs+= kerberos5/lib/libasn1 944_prebuild_libs+= kerberos5/lib/libgssapi 945_prebuild_libs+= kerberos5/lib/libkrb5 946_prebuild_libs+= kerberos5/lib/libroken 947_generic_libs+= kerberos5/lib 948.endif 949 950_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \ 951 lib/libkvm lib/libmd \ 952 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \ 953 lib/libradius \ 954 lib/libsbuf lib/libtacplus lib/libutil \ 955 lib/libz lib/msun 956 957lib/libopie__L lib/libtacplus__L: lib/libmd__L 958 959.if !defined(NO_BIND) 960.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64" 961_prebuild_libs+= lib/libc_r 962.else 963_prebuild_libs+= lib/libpthread 964.endif 965.endif 966 967_generic_libs+= lib 968 969.if !defined(NO_CRYPT) 970.if !defined(NO_OPENSSL) 971_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl 972lib/libradius__L: secure/lib/libssl__L 973secure/lib/libssl__L: secure/lib/libcrypto__L 974.if !defined(NO_OPENSSH) 975_prebuild_libs+= secure/lib/libssh 976secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 977.if !defined(NO_KERBEROS) 978secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \ 979 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \ 980 kerberos5/lib/libroken__L 981.endif 982.endif 983.endif 984_generic_libs+= secure/lib 985.endif 986 987.if defined(NO_CRYPT) || defined(NO_OPENSSL) 988lib/libradius__L: lib/libmd__L 989.endif 990 991.if !defined(NO_NIS) 992_prebuild_libs+= lib/libypclnt 993.endif 994 995_generic_libs+= usr.bin/lex/lib 996 997.if ${MACHINE_ARCH} == "i386" 998_generic_libs+= usr.sbin/pcvt/keycap 999.endif 1000 1001.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 1002${_lib}__L: .PHONY 1003.if exists(${.CURDIR}/${_lib}) 1004 ${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \ 1005 cd ${.CURDIR}/${_lib}; \ 1006 ${MAKE} DIRPRFX=${_lib}/ depend; \ 1007 ${MAKE} DIRPRFX=${_lib}/ all; \ 1008 ${MAKE} DIRPRFX=${_lib}/ install 1009.endif 1010.endfor 1011 1012# libpam is special: we need to build static PAM modules before 1013# static PAM library, and dynamic PAM library before dynamic PAM 1014# modules. 1015lib/libpam__L: .PHONY 1016 ${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \ 1017 cd ${.CURDIR}/lib/libpam; \ 1018 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 1019 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 1020 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 1021 1022_startup_libs: ${_startup_libs:S/$/__L/} 1023_prebuild_libs: ${_prebuild_libs:S/$/__L/} 1024_generic_libs: ${_generic_libs:S/$/__L/} 1025 1026.for __target in all clean cleandepend cleandir depend includes obj 1027.for entry in ${SUBDIR} 1028${entry}.${__target}__D: .PHONY 1029 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 1030 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ 1031 edir=${entry}.${MACHINE_ARCH}; \ 1032 cd ${.CURDIR}/$${edir}; \ 1033 else \ 1034 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ 1035 edir=${entry}; \ 1036 cd ${.CURDIR}/$${edir}; \ 1037 fi; \ 1038 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 1039.endfor 1040par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 1041.endfor 1042 1043.include <bsd.subdir.mk> 1044