Makefile.inc1 revision 129148
1179098Syongari# 2179098Syongari# $FreeBSD: head/Makefile.inc1 129148 2004-05-12 07:02:17Z ru $ 3179098Syongari# 4179098Syongari# Make command line options: 5179098Syongari# -DNO_DYNAMICROOT do not link /bin and /sbin dynamically 6179098Syongari# -DNO_KERBEROS Do not build Heimdal (Kerberos 5) 7179098Syongari# -DNO_RESCUE do not build rescue binaries 8179098Syongari# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 9179098Syongari# -DNOCLEAN do not clean at all 10179098Syongari# -DNOCRYPT will prevent building of crypt versions 11179098Syongari# -DNOMAN do not build the manual pages 12179098Syongari# -DNOPROFILE do not build profiled libraries 13179098Syongari# -DNOGAMES do not go into games subdir 14179098Syongari# -DNOSHARE do not go into share subdir 15179098Syongari# -DNOINFO do not make or install info files 16179098Syongari# -DNOLIBC_R do not build libc_r. 17179098Syongari# -DNO_FORTRAN do not build g77 and related libraries. 18179098Syongari# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel 19179098Syongari# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel 20179098Syongari# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel 21179098Syongari# -DNO_PORTSUPDATE do not update ports in ${MAKE} update 22179098Syongari# -DNO_DOCUPDATE do not update doc in ${MAKE} update 23179098Syongari# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 24179098Syongari# TARGET_ARCH="arch" to crossbuild world to a different arch 25179098Syongari 26179098Syongari# 27179098Syongari# The intended user-driven targets are: 28179098Syongari# buildworld - rebuild *everything*, including glue to help do upgrades 29179098Syongari# installworld- install everything built by "buildworld" 30179098Syongari# update - convenient way to update your source tree (eg: sup/cvs) 31179098Syongari# 32179098Syongari# Standard targets (not defined here) are documented in the makefiles in 33179098Syongari# /usr/share/mk. These include: 34179098Syongari# obj depend all install clean cleandepend cleanobj 35179098Syongari 36179098Syongari# We must do share/info early so that installation of info `dir' 37179098Syongari# entries works correctly. Do it first since it is less likely to 38179098Syongari# grow dependencies on include and lib than vice versa. 39179098Syongari# 40179098Syongari# We must do lib and libexec before bin, because if installworld 41179098Syongari# installs a new /bin/sh, the 'make' command will *immediately* 42179098Syongari# use that new version. And the new (dynamically-linked) /bin/sh 43179098Syongari# will expect to find appropriate libraries in /lib and /libexec. 44179098Syongari# 45179098Syongari# We must do etc last for install/distribute to work. 46179098Syongari# 47179098SyongariSUBDIR= share/info include lib libexec bin 48179098Syongari.if !defined(NOGAMES) 49179098SyongariSUBDIR+=games 50179098Syongari.endif 51179098SyongariSUBDIR+=gnu 52179098Syongari.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL) 53179098SyongariSUBDIR+=kerberos5 54179098Syongari.endif 55179098Syongari.if !defined(NO_RESCUE) 56179098SyongariSUBDIR+=rescue 57179098Syongari.endif 58179098SyongariSUBDIR+=sbin 59179098Syongari.if !defined(NOCRYPT) 60179098SyongariSUBDIR+=secure 61179098Syongari.endif 62227908Smarius.if !defined(NOSHARE) 63179098SyongariSUBDIR+=share 64179098Syongari.endif 65179098SyongariSUBDIR+=sys usr.bin usr.sbin etc 66179098Syongari 67179098Syongari# These are last, since it is nice to at least get the base system 68179098Syongari# rebuilt before you do them. 69221407Smarius.for _DIR in ${LOCAL_DIRS} 70179098Syongari.if exists(${.CURDIR}/${_DIR}/Makefile) 71179098SyongariSUBDIR+= ${_DIR} 72179098Syongari.endif 73179098Syongari.endfor 74179098Syongari 75179098Syongari.if defined(SUBDIR_OVERRIDE) 76179098SyongariSUBDIR= ${SUBDIR_OVERRIDE} 77179098Syongari.endif 78215298Smarius 79179098Syongari.if defined(NOCLEANDIR) 80179098SyongariCLEANDIR= clean cleandepend 81221407Smarius.else 82221407SmariusCLEANDIR= cleandir 83266000Sian.endif 84221407Smarius 85179098SyongariCVS?= cvs 86179098SyongariSUP?= /usr/local/bin/cvsup 87179098SyongariSUPFLAGS?= -g -L 2 -P - 88221407Smarius.if defined(SUPHOST) 89221407SmariusSUPFLAGS+= -h ${SUPHOST} 90221407Smarius.endif 91221407Smarius 92221407SmariusMAKEOBJDIRPREFIX?= /usr/obj 93221407Smarius.if !defined(OSRELDATE) 94179098Syongari.if exists(/usr/include/osreldate.h) 95179098SyongariOSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ 96179098Syongari /usr/include/osreldate.h 97179098Syongari.else 98179098SyongariOSRELDATE= 0 99179098Syongari.endif 100179098Syongari.endif 101179098SyongariTARGET_ARCH?= ${MACHINE_ARCH} 102179098Syongari.if ${TARGET_ARCH} == ${MACHINE_ARCH} 103179098SyongariTARGET?= ${MACHINE} 104179098SyongariTARGET_CPUTYPE?=${CPUTYPE} 105221407Smarius.else 106213364SmariusTARGET?= ${TARGET_ARCH} 107179098SyongariTARGET_CPUTYPE?= 108179098Syongari.endif 109179098Syongari.if !empty(TARGET_CPUTYPE) 110179098Syongari_TARGET_CPUTYPE=${TARGET_CPUTYPE} 111179098Syongari.else 112179098Syongari_TARGET_CPUTYPE=dummy 113179098Syongari.endif 114179098Syongari_CPUTYPE!= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \ 115179098Syongari CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE 116179098Syongari.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} 117179098Syongari.error CPUTYPE global should be set with ?=. 118179098Syongari.endif 119179098Syongari.if make(buildworld) 120179098SyongariBUILD_ARCH!= sysctl -n hw.machine_arch 121179098Syongari.if ${MACHINE_ARCH} != ${BUILD_ARCH} 122179098Syongari.error To cross-build, set TARGET_ARCH. 123179098Syongari.endif 124179098Syongari.endif 125179098Syongari.if ${MACHINE} == ${TARGET} 126179098SyongariOBJTREE= ${MAKEOBJDIRPREFIX} 127179098Syongari.else 128215298SmariusOBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} 129179098Syongari.endif 130179098SyongariWORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH} 131179098Syongari# /usr/games added for fortune which depend on strfile 132179098SyongariBPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games 133179098SyongariXPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games 134179098SyongariSTRICTTMPPATH= ${BPATH}:${XPATH} 135179098SyongariTMPPATH= ${STRICTTMPPATH}:${PATH} 136179098Syongari 137179098SyongariINSTALLTMP!= /usr/bin/mktemp -d -u -t install 138179098Syongari 139179098Syongari# 140179098Syongari# Building a world goes through the following stages 141179098Syongari# 142179098Syongari# 1. legacy stage [BMAKE] 143179098Syongari# This stage is responsible for creating compatibility 144179098Syongari# shims that are needed by the bootstrap-tools, 145215298Smarius# build-tools and cross-tools stages. 146179098Syongari# 1. bootstrap-tools stage [BMAKE] 147179098Syongari# This stage is responsible for creating programs that 148179098Syongari# are needed for backward compatibility reasons. They 149179098Syongari# are not built as cross-tools. 150179098Syongari# 2. build-tools stage [TMAKE] 151179098Syongari# This stage is responsible for creating the object 152179098Syongari# tree and building any tools that are needed during 153179098Syongari# the build process. 154179098Syongari# 3. cross-tools stage [XMAKE] 155179098Syongari# This stage is responsible for creating any tools that 156179098Syongari# are needed for cross-builds. A cross-compiler is one 157217412Smarius# of them. 158179098Syongari# 4. world stage [WMAKE] 159217412Smarius# This stage actually builds the world. 160215298Smarius# 5. install stage (optional) [IMAKE] 161215298Smarius# This stage installs a previously built world. 162179098Syongari# 163179098Syongari 164179098SyongariBOOTSTRAPPING?= 0 165179098Syongari 166179098Syongari# Common environment for world related stages 167179098SyongariCROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ 168179098Syongari MACHINE_ARCH=${TARGET_ARCH} \ 169179098Syongari MACHINE=${TARGET} \ 170179098Syongari CPUTYPE=${TARGET_CPUTYPE} \ 171179098Syongari GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ 172184253Syongari GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ 173184253Syongari GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac 174179098Syongari 175179098Syongari# bootstrap-tools stage 176179098SyongariBMAKEENV= DESTDIR= \ 177179098Syongari INSTALL="sh ${.CURDIR}/tools/install.sh" \ 178179098Syongari PATH=${BPATH}:${PATH} \ 179179098Syongari WORLDTMP=${WORLDTMP} \ 180179098Syongari MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" 181179098SyongariBMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ 182179098Syongari ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 183179098Syongari BOOTSTRAPPING=${OSRELDATE} \ 184179098Syongari -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \ 185179098Syongari -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS 186179098Syongari 187179098Syongari# build-tools stage 188179098SyongariTMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ 189179098Syongari ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ 190179098Syongari BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS 191179098Syongari 192179098Syongari# cross-tools stage 193215298SmariusXMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB 194179098Syongari 195179098Syongari# world stage 196179098SyongariWMAKEENV= ${CROSSENV} \ 197179098Syongari DESTDIR=${WORLDTMP} \ 198179098Syongari _SHLIBDIRPREFIX=${WORLDTMP} \ 199179098Syongari INSTALL="sh ${.CURDIR}/tools/install.sh" \ 200179098Syongari PATH=${TMPPATH} 201179098SyongariWMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 202179098Syongari 203179098Syongari# install stage 204179098SyongariIMAKEENV= ${CROSSENV} \ 205179098Syongari PATH=${STRICTTMPPATH}:${INSTALLTMP} 206179098SyongariIMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 207179098Syongari 208179098Syongari# kernel stage 209215298SmariusKMAKEENV= ${WMAKEENV} 210179098Syongari 211179098Syongari# 212179098Syongari# buildworld 213179098Syongari# 214221407Smarius# Attempt to rebuild the entire system, with reasonable chance of 215179098Syongari# success, regardless of how old your existing system is. 216179098Syongari# 217179098Syongari_worldtmp: 218179098Syongari.if ${.CURDIR:C/[^,]//g} != "" 219179098Syongari# The m4 build of sendmail files doesn't like it if ',' is used 220179098Syongari# anywhere in the path of it's files. 221179098Syongari @echo 222179098Syongari @echo "*** Error: path to source tree contains a comma ','" 223179098Syongari @echo 224179098Syongari false 225179098Syongari.endif 226179098Syongari @echo 227179098Syongari @echo "--------------------------------------------------------------" 228179098Syongari @echo ">>> Rebuilding the temporary build tree" 229179098Syongari @echo "--------------------------------------------------------------" 230179098Syongari.if !defined(NOCLEAN) 231179098Syongari rm -rf ${WORLDTMP} 232179098Syongari.else 233179098Syongari rm -rf ${WORLDTMP}/legacy/usr/include 234179098Syongari # XXX - These two can depend on any header file. 235179098Syongari rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c 236179098Syongari rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c 237179098Syongari.endif 238179098Syongari.for _dir in \ 239179098Syongari usr/bin usr/games usr/include/c++/3.3 usr/include/sys usr/lib \ 240179098Syongari usr/libexec usr/sbin usr/share/dict \ 241179098Syongari usr/share/groff_font/devX100 \ 242179098Syongari usr/share/groff_font/devX100-12 \ 243179098Syongari usr/share/groff_font/devX75 \ 244179098Syongari usr/share/groff_font/devX75-12 \ 245179098Syongari usr/share/groff_font/devascii \ 246179098Syongari usr/share/groff_font/devcp1047 \ 247179098Syongari usr/share/groff_font/devdvi \ 248179098Syongari usr/share/groff_font/devhtml \ 249179098Syongari usr/share/groff_font/devkoi8-r \ 250179098Syongari usr/share/groff_font/devlatin1 \ 251179098Syongari usr/share/groff_font/devlbp \ 252179098Syongari usr/share/groff_font/devlj4 \ 253179098Syongari usr/share/groff_font/devps \ 254179098Syongari usr/share/groff_font/devutf8 \ 255215298Smarius usr/share/tmac/mdoc usr/share/tmac/mm 256179098Syongari mkdir -p ${WORLDTMP}/legacy/${_dir} 257179098Syongari.endfor 258179098Syongari.for _dir in \ 259179098Syongari lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \ 260179098Syongari usr/libexec usr/sbin usr/share/misc \ 261179098Syongari usr/share/snmp/defs usr/share/snmp/mibs 262179098Syongari mkdir -p ${WORLDTMP}/${_dir} 263179098Syongari.endfor 264179098Syongari mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 265179098Syongari -p ${WORLDTMP}/usr/include >/dev/null 266179098Syongari ln -sf ${.CURDIR}/sys ${WORLDTMP} 267179098Syongari_legacy: 268179098Syongari @echo 269179098Syongari @echo "--------------------------------------------------------------" 270179098Syongari @echo ">>> stage 1.1: legacy release compatibility shims" 271179098Syongari @echo "--------------------------------------------------------------" 272179098Syongari cd ${.CURDIR}; ${BMAKE} legacy 273179098Syongari_bootstrap-tools: 274179098Syongari @echo 275215298Smarius @echo "--------------------------------------------------------------" 276179098Syongari @echo ">>> stage 1.2: bootstrap tools" 277179098Syongari @echo "--------------------------------------------------------------" 278179098Syongari cd ${.CURDIR}; ${BMAKE} bootstrap-tools 279215298Smarius_cleanobj: 280215298Smarius.if !defined(NOCLEAN) 281215298Smarius @echo 282179098Syongari @echo "--------------------------------------------------------------" 283179098Syongari @echo ">>> stage 2.1: cleaning up the object tree" 284179098Syongari @echo "--------------------------------------------------------------" 285179098Syongari cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} 286179098Syongari.endif 287215459Smarius_obj: 288179098Syongari @echo 289179098Syongari @echo "--------------------------------------------------------------" 290179098Syongari @echo ">>> stage 2.2: rebuilding the object tree" 291179098Syongari @echo "--------------------------------------------------------------" 292179098Syongari cd ${.CURDIR}; ${WMAKE} par-obj 293179098Syongari_build-tools: 294179098Syongari @echo 295179098Syongari @echo "--------------------------------------------------------------" 296179098Syongari @echo ">>> stage 2.3: build tools" 297179098Syongari @echo "--------------------------------------------------------------" 298179098Syongari cd ${.CURDIR}; ${TMAKE} build-tools 299179098Syongari_cross-tools: 300179098Syongari @echo 301179098Syongari @echo "--------------------------------------------------------------" 302179098Syongari @echo ">>> stage 3: cross tools" 303179098Syongari @echo "--------------------------------------------------------------" 304179098Syongari cd ${.CURDIR}; ${XMAKE} cross-tools 305179098Syongari_includes: 306179098Syongari @echo 307215459Smarius @echo "--------------------------------------------------------------" 308179098Syongari @echo ">>> stage 4.1: building includes" 309179098Syongari @echo "--------------------------------------------------------------" 310179098Syongari cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes 311179098Syongari_libraries: 312179098Syongari @echo 313179098Syongari @echo "--------------------------------------------------------------" 314179098Syongari @echo ">>> stage 4.2: building libraries" 315179098Syongari @echo "--------------------------------------------------------------" 316179098Syongari cd ${.CURDIR}; \ 317179098Syongari ${WMAKE} -DNOFSCHG -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPROFILE \ 318179098Syongari libraries 319179098Syongari_depend: 320179098Syongari @echo 321179098Syongari @echo "--------------------------------------------------------------" 322179098Syongari @echo ">>> stage 4.3: make dependencies" 323179098Syongari @echo "--------------------------------------------------------------" 324179098Syongari cd ${.CURDIR}; ${WMAKE} par-depend 325179098Syongarieverything: 326179098Syongari @echo 327179098Syongari @echo "--------------------------------------------------------------" 328179098Syongari @echo ">>> stage 4.4: building everything" 329179098Syongari @echo "--------------------------------------------------------------" 330179098Syongari cd ${.CURDIR}; ${WMAKE} par-all 331179098Syongari 332179098Syongari 333179098SyongariWMAKE_TGTS= 334179098Syongari.if !defined(SUBDIR_OVERRIDE) 335179098SyongariWMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools 336179098Syongari.endif 337179098SyongariWMAKE_TGTS+= _cleanobj _obj _build-tools 338217412Smarius.if !defined(SUBDIR_OVERRIDE) 339179098SyongariWMAKE_TGTS+= _cross-tools 340179098Syongari.endif 341179098SyongariWMAKE_TGTS+= _includes _libraries _depend everything 342179098Syongari 343179098Syongaribuildworld: ${WMAKE_TGTS} 344179098Syongari.ORDER: ${WMAKE_TGTS} 345179098Syongari 346179098SyongariTOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything} 347179098Syongaritoolchain: ${TOOLCHAIN_TGTS} 348179098Syongarikernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} 349215298Smarius 350179098Syongari# 351179098Syongari# Use this to add checks to installworld/installkernel targets. 352179098Syongari# 353215298SmariusSPECIAL_INSTALLCHECKS= 354217412Smarius 355217412Smarius# 356217412Smarius# The following install-time check will see if the installation will 357215298Smarius# change the type used for time_t, and if it will, the target makes 358215298Smarius# sure that the user is expecting to make that change. 359217412Smarius# 360217412Smarius.if ${TARGET_ARCH} == "sparc64" 361179098SyongariSPECIAL_INSTALLCHECKS+=sparc64_installcheck 362179098Syongari 363221817SyongariCUR_TIMET!= grep __time_t /usr/include/machine/_types.h | awk '{print $$2}' 364221817SyongariSRC_TIMET!= grep __time_t ${.CURDIR}/sys/sparc64/include/_types.h | \ 365221817Syongari awk '{print $$2}' 366221817SyongariNEWSPARC_TIMETYPE?=${CUR_TIMET} 367221817SyongariTHISHOST!= hostname -s 368221817Syongari.if empty(THISHOST) 369221817SyongariTHISHOST="name not set yet" 370221817Syongari.endif 371221817Syongari 372221817Syongarisparc64_installcheck: 373221817Syongari.if ${CUR_TIMET} != ${SRC_TIMET} 374221817Syongari @echo 375179098Syongari.if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET} 376179098Syongari @echo "*** ERROR: This target would change the type used for time_t!" 377179098Syongari.else 378179098Syongari @echo "* Note: This installation changes the type used for time_t." 379.endif 380 @echo "* " 381 @echo "* This host (${THISHOST}) has time_t defined as ${CUR_TIMET}," 382 @echo "* and this installation would change that to type ${SRC_TIMET}." 383.if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET} 384 @echo "* " 385 @echo "* If that is *NOT* what you wanted, then you need to change the" 386 @echo "* typedef of __time_t in ${.CURDIR}/sys/sparc64/include/_types.h" 387 @echo "* from '${SRC_TIMET}' to '${CUR_TIMET}'. After that you *MUST*" 388 @echo "* do a complete cleanworld, buildworld, buildkernel before you" 389 @echo "* retry the 'make' command. Also read /usr/src/UPDATING.64BTT." 390 @echo "* " 391 @echo "* If that *is* what you want, then enter the commands:" 392 @echo " NEWSPARC_TIMETYPE=${SRC_TIMET}" 393 @echo " export NEWSPARC_TIMETYPE" 394 @echo "* and repeat your 'make' command." 395 @echo 396 false 397.endif 398 @echo 399.elif ${NEWSPARC_TIMETYPE} != ${SRC_TIMET} 400 @echo 401 @echo "*** ERROR: NEWSPARC_TIMETYPE is set to '${NEWSPARC_TIMETYPE}'" 402 @echo "*** but ${.CURDIR}/sys/sparc64/include/_types.h" 403 @echo "*** has __time_t defined as '${SRC_TIMET}'." 404 false 405.else 406 @# in sparc64_installcheck, all TIMETYPEs == '${CUR_TIMET}' 407.endif 408.endif 409 410# 411# installcheck 412# 413# Checks to be sure system is ready for installworld 414# 415CHECK_UIDS= 416CHECK_GIDS= 417.if !defined(NO_SENDMAIL) 418CHECK_UIDS+= smmsp 419CHECK_GIDS+= smmsp 420.endif 421.if !defined(NO_PF) 422CHECK_UIDS+= proxy 423CHECK_GIDS+= proxy authpf 424.endif 425installcheck: ${SPECIAL_INSTALLCHECKS} 426.for uid in ${CHECK_UIDS} 427 @if ! `id -u ${uid} >/dev/null 2>&1`; then \ 428 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ 429 false; \ 430 fi 431.endfor 432.for gid in ${CHECK_GIDS} 433 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ 434 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ 435 false; \ 436 fi 437.endfor 438 439# 440# distributeworld 441# 442# Distributes everything compiled by a `buildworld'. 443# 444# installworld 445# 446# Installs everything compiled by a 'buildworld'. 447# 448distributeworld installworld: installcheck 449 mkdir -p ${INSTALLTMP} 450 for prog in [ awk cap_mkdb cat chflags chmod chown \ 451 date echo egrep find grep \ 452 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ 453 test true uname wc zic; do \ 454 cp `which $$prog` ${INSTALLTMP}; \ 455 done 456 cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} 457 rm -rf ${INSTALLTMP} 458 459# 460# reinstall 461# 462# If you have a build server, you can NFS mount the source and obj directories 463# and do a 'make reinstall' on the *client* to install new binaries from the 464# most recent server build. 465# 466reinstall: ${SPECIAL_INSTALLCHECKS} 467 @echo "--------------------------------------------------------------" 468 @echo ">>> Making hierarchy" 469 @echo "--------------------------------------------------------------" 470 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy 471 @echo 472 @echo "--------------------------------------------------------------" 473 @echo ">>> Installing everything" 474 @echo "--------------------------------------------------------------" 475 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install 476 477redistribute: 478 @echo "--------------------------------------------------------------" 479 @echo ">>> Distributing everything" 480 @echo "--------------------------------------------------------------" 481 cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute 482 483# 484# buildkernel and installkernel 485# 486# Which kernels to build and/or install is specified by setting 487# KERNCONF. If not defined a GENERIC kernel is built/installed. 488# Only the existing (depending TARGET) config files are used 489# for building kernels and only the first of these is designated 490# as the one being installed. 491# 492# Note that we have to use TARGET instead of TARGET_ARCH when 493# we're in kernel-land. Since only TARGET_ARCH is (expected) to 494# be set to cross-build, we have to make sure TARGET is set 495# properly. 496 497.if !defined(KERNCONF) && defined(KERNEL) 498KERNCONF= ${KERNEL} 499KERNWARN= yes 500.else 501KERNCONF?= GENERIC 502.endif 503INSTKERNNAME?= kernel 504 505KERNSRCDIR?= ${.CURDIR}/sys 506KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf 507KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} 508KERNCONFDIR?= ${KRNLCONFDIR} 509 510BUILDKERNELS= 511INSTALLKERNEL= 512.for _kernel in ${KERNCONF} 513.if exists(${KERNCONFDIR}/${_kernel}) 514BUILDKERNELS+= ${_kernel} 515.if empty(INSTALLKERNEL) 516INSTALLKERNEL= ${_kernel} 517.endif 518.endif 519.endfor 520 521# 522# buildkernel 523# 524# Builds all kernels defined by BUILDKERNELS. 525# 526buildkernel: 527.if empty(BUILDKERNELS) 528 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; 529 false 530.endif 531.if defined(KERNWARN) 532 @echo "--------------------------------------------------------------" 533 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" 534 @echo "--------------------------------------------------------------" 535 @sleep 3 536.endif 537 @echo 538.for _kernel in ${BUILDKERNELS} 539 @echo "--------------------------------------------------------------" 540 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" 541 @echo "--------------------------------------------------------------" 542 @echo "===> ${_kernel}" 543 mkdir -p ${KRNLOBJDIR} 544.if !defined(NO_KERNELCONFIG) 545 @echo 546 @echo "--------------------------------------------------------------" 547 @echo ">>> stage 1: configuring the kernel" 548 @echo "--------------------------------------------------------------" 549 cd ${KRNLCONFDIR}; \ 550 PATH=${TMPPATH} \ 551 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ 552 ${KERNCONFDIR}/${_kernel} 553.endif 554.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) 555 @echo 556 @echo "--------------------------------------------------------------" 557 @echo ">>> stage 2.1: cleaning up the object tree" 558 @echo "--------------------------------------------------------------" 559 cd ${KRNLOBJDIR}/${_kernel}; \ 560 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR} 561.endif 562 @echo 563 @echo "--------------------------------------------------------------" 564 @echo ">>> stage 2.2: rebuilding the object tree" 565 @echo "--------------------------------------------------------------" 566 cd ${KRNLOBJDIR}/${_kernel}; \ 567 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj 568 @echo 569 @echo "--------------------------------------------------------------" 570 @echo ">>> stage 2.3: build tools" 571 @echo "--------------------------------------------------------------" 572 cd ${KRNLOBJDIR}/${_kernel}; \ 573 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ 574 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile 575# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. 576.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) 577.for target in obj depend all 578 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \ 579 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ 580 ${MAKE} -DNO_CPU_CFLAGS ${target} 581.endfor 582.endif 583.if !defined(NO_KERNELDEPEND) 584 @echo 585 @echo "--------------------------------------------------------------" 586 @echo ">>> stage 3.1: making dependencies" 587 @echo "--------------------------------------------------------------" 588 cd ${KRNLOBJDIR}/${_kernel}; \ 589 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ 590.endif 591 @echo 592 @echo "--------------------------------------------------------------" 593 @echo ">>> stage 3.2: building everything" 594 @echo "--------------------------------------------------------------" 595 cd ${KRNLOBJDIR}/${_kernel}; \ 596 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ 597 @echo "--------------------------------------------------------------" 598 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" 599 @echo "--------------------------------------------------------------" 600.endfor 601 602# 603# installkernel, etc. 604# 605# Install the kernel defined by INSTALLKERNEL 606# 607installkernel installkernel.debug \ 608reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS} 609.if empty(INSTALLKERNEL) 610 @echo "ERROR: No kernel \"${KERNCONF}\" to install." 611 false 612.endif 613 @echo "--------------------------------------------------------------" 614 @echo ">>> Making hierarchy" 615 @echo "--------------------------------------------------------------" 616 cd ${.CURDIR}; \ 617 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy 618 @echo 619 @echo "--------------------------------------------------------------" 620 @echo ">>> Installing kernel" 621 @echo "--------------------------------------------------------------" 622 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ 623 ${CROSSENV} PATH=${TMPPATH} \ 624 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} 625 626# 627# update 628# 629# Update the source tree, by running sup and/or running cvs to update to the 630# latest copy. 631# 632update: 633.if defined(SUP_UPDATE) 634 @echo "--------------------------------------------------------------" 635 @echo ">>> Running ${SUP}" 636 @echo "--------------------------------------------------------------" 637.if defined(SUPFILE) 638 @${SUP} ${SUPFLAGS} ${SUPFILE} 639.endif 640.if defined(SUPFILE1) 641 @${SUP} ${SUPFLAGS} ${SUPFILE1} 642.endif 643.if defined(SUPFILE2) 644 @${SUP} ${SUPFLAGS} ${SUPFILE2} 645.endif 646.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) 647 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE} 648.endif 649.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) 650 @${SUP} ${SUPFLAGS} ${DOCSUPFILE} 651.endif 652.endif 653.if defined(CVS_UPDATE) 654 @echo "--------------------------------------------------------------" 655 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT} 656 @echo "--------------------------------------------------------------" 657 cd ${.CURDIR}; ${CVS} -R -q update -A -P -d 658.endif 659 660# 661# ------------------------------------------------------------------------ 662# 663# From here onwards are utility targets used by the 'make world' and 664# related targets. If your 'world' breaks, you may like to try to fix 665# the problem and manually run the following targets to attempt to 666# complete the build. Beware, this is *not* guaranteed to work, you 667# need to have a pretty good grip on the current state of the system 668# to attempt to manually finish it. If in doubt, 'make world' again. 669# 670 671# 672# legacy: Build compatibility shims for the next three targets 673# 674legacy: 675.for _tool in tools/build 676 @${ECHODIR} "===> ${_tool}"; \ 677 cd ${.CURDIR}/${_tool}; \ 678 ${MAKE} DIRPRFX=${_tool}/ obj; \ 679 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ 680 ${MAKE} DIRPRFX=${_tool}/ depend; \ 681 ${MAKE} DIRPRFX=${_tool}/ all; \ 682 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 683.endfor 684 685# 686# bootstrap-tools: Build tools needed for compatibility 687# 688.if !defined(NOGAMES) 689_strfile= games/fortune/strfile 690.endif 691 692.if !defined(NO_CXX) 693_gperf= gnu/usr.bin/gperf 694.if ${BOOTSTRAPPING} < 500113 695_groff= gnu/usr.bin/groff 696.else 697_groff= gnu/usr.bin/groff/tmac 698.endif 699.endif 700 701.if ${BOOTSTRAPPING} < 502102 702_lex= usr.bin/lex 703.endif 704 705.if ${BOOTSTRAPPING} < 450005 || \ 706 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034 707_uudecode= usr.bin/uudecode 708.endif 709 710.if ${BOOTSTRAPPING} < 430002 || \ 711 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019 712_xargs= usr.bin/xargs 713.endif 714 715.if ${BOOTSTRAPPING} < 430002 || \ 716 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018 717_yacc= usr.bin/yacc 718.endif 719 720.if !defined(NO_RESCUE) && \ 721 ${BOOTSTRAPPING} < 501100 722_crunchgen= usr.sbin/crunch/crunchgen 723.endif 724 725.if ${BOOTSTRAPPING} < 501114 726_gensnmptree= usr.sbin/bsnmpd/gensnmptree 727.endif 728 729.if ${BOOTSTRAPPING} < 500019 730_kbdcontrol= usr.sbin/kbdcontrol 731.endif 732 733bootstrap-tools: 734.for _tool in \ 735 ${_strfile} \ 736 ${_gperf} \ 737 ${_groff} \ 738 gnu/usr.bin/texinfo \ 739 usr.bin/colldef \ 740 ${_lex} \ 741 usr.bin/makewhatis \ 742 usr.bin/rpcgen \ 743 ${_uudecode} \ 744 ${_xargs} \ 745 usr.bin/xinstall \ 746 ${_yacc} \ 747 usr.sbin/config \ 748 ${_crunchgen} \ 749 ${_gensnmptree} \ 750 ${_kbdcontrol} 751 @${ECHODIR} "===> ${_tool}"; \ 752 cd ${.CURDIR}/${_tool}; \ 753 ${MAKE} DIRPRFX=${_tool}/ obj; \ 754 ${MAKE} DIRPRFX=${_tool}/ depend; \ 755 ${MAKE} DIRPRFX=${_tool}/ all; \ 756 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install 757.endfor 758 759# 760# build-tools: Build special purpose build tools 761# 762.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) 763_aicasm= sys/modules/aic7xxx/aicasm 764.endif 765 766.if !defined(NOSHARE) 767_share= share/syscons/scrnmaps 768.endif 769 770.if !defined(NO_FORTRAN) 771_fortran= gnu/usr.bin/cc/f771 772.endif 773 774.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL) 775_kerberos5_tools= kerberos5/tools 776.endif 777 778.if !defined(NO_RESCUE) 779_rescue= rescue/rescue 780.endif 781 782build-tools: 783.for _tool in \ 784 bin/csh \ 785 bin/sh \ 786 ${_rescue} \ 787 gnu/usr.bin/cc/cc_tools \ 788 ${_fortran} \ 789 lib/libncurses \ 790 ${_share} \ 791 ${_aicasm} \ 792 usr.bin/awk \ 793 usr.bin/file \ 794 usr.sbin/sysinstall 795 @${ECHODIR} "===> ${_tool}"; \ 796 cd ${.CURDIR}/${_tool}; \ 797 ${MAKE} DIRPRFX=${_tool}/ obj; \ 798 ${MAKE} DIRPRFX=${_tool}/ build-tools 799.endfor 800.for _tool in \ 801 ${_kerberos5_tools} 802 @${ECHODIR} "===> ${_tool}"; \ 803 cd ${.CURDIR}/${_tool}; \ 804 ${MAKE} DIRPRFX=${_tool}/ obj; \ 805 ${MAKE} DIRPRFX=${_tool}/ depend; \ 806 ${MAKE} DIRPRFX=${_tool}/ all 807.endfor 808 809# 810# cross-tools: Build cross-building tools 811# 812.if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \ 813 ${BOOTSTRAPPING} < 500037 814_elf2aout= usr.bin/elf2aout 815.endif 816 817.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} 818_btxld= usr.sbin/btxld 819.endif 820 821.if (!defined(NO_RESCUE) || \ 822 defined(RELEASEDIR)) && \ 823 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101) 824_crunchide= usr.sbin/crunch/crunchide 825.endif 826 827.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH} 828_elf2exe= usr.sbin/elf2exe 829.endif 830 831.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \ 832 defined(RELEASEDIR) 833_kgzip= usr.sbin/kgzip 834.endif 835 836cross-tools: 837.for _tool in \ 838 gnu/usr.bin/binutils \ 839 gnu/usr.bin/cc \ 840 ${_elf2aout} \ 841 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ 842 ${_btxld} \ 843 ${_crunchide} \ 844 ${_elf2exe} \ 845 ${_kgzip} 846 @${ECHODIR} "===> ${_tool}"; \ 847 cd ${.CURDIR}/${_tool}; \ 848 ${MAKE} DIRPRFX=${_tool}/ obj; \ 849 ${MAKE} DIRPRFX=${_tool}/ depend; \ 850 ${MAKE} DIRPRFX=${_tool}/ all; \ 851 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install 852.endfor 853 854# 855# hierarchy - ensure that all the needed directories are present 856# 857hierarchy: 858 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 859 860# 861# libraries - build all libraries, and install them under ${DESTDIR}. 862# 863# The list of libraries with dependents (${_prebuild_libs}) and their 864# interdependencies (__L) are built automatically by the 865# ${.CURDIR}/tools/make_libdeps.sh script. 866# 867libraries: 868 cd ${.CURDIR}; \ 869 ${MAKE} -f Makefile.inc1 _startup_libs; \ 870 ${MAKE} -f Makefile.inc1 _prebuild_libs; \ 871 ${MAKE} -f Makefile.inc1 _generic_libs; 872 873# These dependencies are not automatically generated: 874# 875# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all 876# shared libraries for ELF. 877# 878_startup_libs= gnu/lib/csu gnu/lib/libgcc 879.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) 880_startup_libs+= lib/csu/${MACHINE_ARCH}-elf 881.else 882_startup_libs+= lib/csu/${MACHINE_ARCH} 883.endif 884 885_prebuild_libs= 886 887_generic_libs= gnu/lib 888 889.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL) 890_prebuild_libs+= kerberos5/lib/libasn1 891_prebuild_libs+= kerberos5/lib/libgssapi 892_prebuild_libs+= kerberos5/lib/libkrb5 893_prebuild_libs+= kerberos5/lib/libroken 894_generic_libs+= kerberos5/lib 895.endif 896 897_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \ 898 lib/libkvm lib/libmd \ 899 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \ 900 lib/libradius \ 901 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \ 902 lib/libz lib/msun 903 904lib/libopie__L lib/libtacplus__L: lib/libmd__L 905 906_generic_libs+= lib 907 908.if !defined(NOCRYPT) 909.if !defined(NO_OPENSSL) 910_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl 911lib/libradius__L: secure/lib/libssl__L 912.if !defined(NO_OPENSSH) 913_prebuild_libs+= secure/lib/libssh 914secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L 915.if !defined(NO_KERBEROS) 916secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \ 917 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \ 918 kerberos5/lib/libroken__L 919.endif 920.endif 921.endif 922_generic_libs+= secure/lib 923.endif 924 925.if defined(NOCRYPT) || defined(NO_OPENSSL) 926lib/libradius__L: lib/libmd__L 927.endif 928 929_generic_libs+= usr.bin/lex/lib 930 931.if ${MACHINE_ARCH} == "i386" 932_generic_libs+= usr.sbin/pcvt/keycap 933.endif 934 935.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} 936${_lib}__L: .PHONY 937.if exists(${.CURDIR}/${_lib}) 938 @${ECHODIR} "===> ${_lib}"; \ 939 cd ${.CURDIR}/${_lib}; \ 940 ${MAKE} DIRPRFX=${_lib}/ depend; \ 941 ${MAKE} DIRPRFX=${_lib}/ all; \ 942 ${MAKE} DIRPRFX=${_lib}/ install 943.endif 944.endfor 945 946# libpam is special: we need to build static PAM modules before 947# static PAM library, and dynamic PAM library before dynamic PAM 948# modules. 949lib/libpam__L: .PHONY 950 @${ECHODIR} "===> lib/libpam"; \ 951 cd ${.CURDIR}/lib/libpam; \ 952 ${MAKE} DIRPRFX=lib/libpam/ depend; \ 953 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ 954 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install 955 956_startup_libs: ${_startup_libs:S/$/__L/} 957_prebuild_libs: ${_prebuild_libs:S/$/__L/} 958_generic_libs: ${_generic_libs:S/$/__L/} 959 960.for __target in all clean cleandepend cleandir depend includes obj 961.for entry in ${SUBDIR} 962${entry}.${__target}__D: .PHONY 963 @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ 964 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \ 965 edir=${entry}.${MACHINE_ARCH}; \ 966 cd ${.CURDIR}/$${edir}; \ 967 else \ 968 ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 969 edir=${entry}; \ 970 cd ${.CURDIR}/$${edir}; \ 971 fi; \ 972 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 973.endfor 974par-${__target}: ${SUBDIR:S/$/.${__target}__D/} 975.endfor 976 977.include <bsd.subdir.mk> 978