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