Makefile revision 123311
12061Sjkh# 250479Speter# $FreeBSD: head/Makefile 123311 2003-12-09 02:08:19Z peter $ 32061Sjkh# 438666Sjb# The user-driven targets are: 532427Sjb# 6111131Sru# universe - *Really* build *everything* (buildworld and 7111131Sru# all kernels on all architectures). 838666Sjb# buildworld - Rebuild *everything*, including glue to help do 938666Sjb# upgrades. 1038666Sjb# installworld - Install everything built by "buildworld". 1138666Sjb# world - buildworld + installworld. 1264049Salex# buildkernel - Rebuild the kernel and the kernel-modules. 1364049Salex# installkernel - Install the kernel and the kernel-modules. 14116679Ssimokawa# installkernel.debug 1566071Smarkm# reinstallkernel - Reinstall the kernel and the kernel-modules. 16116679Ssimokawa# reinstallkernel.debug 1773504Sobrien# kernel - buildkernel + installkernel. 1838666Sjb# update - Convenient way to update your source tree (cvs). 1932427Sjb# 2038666Sjb# This makefile is simple by design. The FreeBSD make automatically reads 21108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the 2238666Sjb# command line. By keeping this makefile simple, it doesn't matter too 2338666Sjb# much how different the installed mk files are from those in the source 2438666Sjb# tree. This makefile executes a child make process, forcing it to use 2538666Sjb# the mk files from the source tree which are supposed to DTRT. 2617308Speter# 2791606Skeramida# The user-driven targets (as listed above) are implemented in Makefile.inc1. 2819175Sbde# 2996205Sjwd# If you want to build your system from source be sure that /usr/obj has 3096205Sjwd# at least 400MB of diskspace available. 3138042Sbde# 3296205Sjwd# For individuals wanting to build from the sources currently on their 3396205Sjwd# system, the simple instructions are: 3438042Sbde# 3596205Sjwd# 1. `cd /usr/src' (or to the directory containing your source tree). 3696205Sjwd# 2. `make world' 3717308Speter# 3896205Sjwd# For individuals wanting to upgrade their sources (even if only a 3996205Sjwd# delta of a few days): 4017308Speter# 4196205Sjwd# 1. `cd /usr/src' (or to the directory containing your source tree). 4296205Sjwd# 2. `make buildworld' 4396205Sjwd# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 4496205Sjwd# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 4596205Sjwd# 5. `reboot' (in single user mode: boot -s from the loader prompt). 4696205Sjwd# 6. `mergemaster -p' 4796205Sjwd# 7. `make installworld' 4896205Sjwd# 8. `mergemaster' 4996205Sjwd# 9. `reboot' 5096205Sjwd# 5196205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information. 5296205Sjwd# 5398775Sdillon# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can 5498723Sdillon# cross build world for other architectures using the buildworld target, 5598723Sdillon# and once the world is built you can cross build a kernel using the 5698723Sdillon# buildkernel target. 5798723Sdillon# 5838666Sjb# Define the user-driven targets. These are listed here in alphabetical 5938666Sjb# order, but that's not important. 6017308Speter# 61123311Speter# Targets that begin with underscore are internal targets intended for 62123311Speter# developer convenience only. They are intentionally not documented and 63123311Speter# completely subject to change without notice. 64123311Speter# 6595509SruTGTS= all all-man buildkernel buildworld checkdpadd clean \ 6695793Sru cleandepend cleandir depend distribute distributeworld everything \ 67116679Ssimokawa hierarchy install installcheck installkernel installkernel.debug\ 68120760Sru reinstallkernel reinstallkernel.debug installworld \ 69116679Ssimokawa libraries lint maninstall \ 70123311Speter obj objlink regress rerelease tags update \ 71123311Speter _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ 72123311Speter _build-tools _cross-tools _includes _libraries _depend 732061Sjkh 7497769SruBITGTS= files includes 7597252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 76119579SruTGTS+= ${BITGTS} 7797252Sru 7895730Sru.ORDER: buildworld installworld 7995793Sru.ORDER: buildworld distributeworld 80111617Sru.ORDER: buildworld buildkernel 8195730Sru.ORDER: buildkernel installkernel 82116679Ssimokawa.ORDER: buildkernel installkernel.debug 8395730Sru.ORDER: buildkernel reinstallkernel 84116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug 8595730Sru 86110035SruPATH= /sbin:/bin:/usr/sbin:/usr/bin 87107516SruMAKEOBJDIRPREFIX?= /usr/obj 88110035SruMAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 89117234SruBINMAKE= \ 90110035Sru `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 91117229Sru -m ${.CURDIR}/share/mk 92117234Sru_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 9354324Smarcel 9417308Speter# 95119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld 96119519Smarcel# should do this as those are the initial targets used for upgrades. 97119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed 98119519Smarcel# for all targets. 99119519Smarcel# 100119519Smarcel.if defined(ALWAYS_CHECK_MAKE) 101119579Sru${TGTS}: upgrade_checks 102119519Smarcel.else 103119519Smarcelbuildworld: upgrade_checks 104119519Smarcel.endif 105119519Smarcel 106119519Smarcel# 10738666Sjb# Handle the user-driven targets, using the source relative mk files. 10817308Speter# 109119519Smarcel 110119579Sru${TGTS}: 11138666Sjb @cd ${.CURDIR}; \ 112110035Sru ${_MAKE} ${.TARGET} 1132302Spaul 11439206Sjkh# Set a reasonable default 11539206Sjkh.MAIN: all 11639206Sjkh 11773349SruSTARTTIME!= LC_ALL=C date 11817308Speter# 11954324Smarcel# world 12054324Smarcel# 12154324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of 12254324Smarcel# success, regardless of how old your existing system is. 12354324Smarcel# 12454324Smarcelworld: upgrade_checks 12554324Smarcel @echo "--------------------------------------------------------------" 126118531Sru @echo ">>> make world started on ${STARTTIME}" 12754324Smarcel @echo "--------------------------------------------------------------" 12854324Smarcel.if target(pre-world) 12954324Smarcel @echo 13054324Smarcel @echo "--------------------------------------------------------------" 13154324Smarcel @echo ">>> Making 'pre-world' target" 13254324Smarcel @echo "--------------------------------------------------------------" 133110035Sru @cd ${.CURDIR}; ${_MAKE} pre-world 13454324Smarcel.endif 135110035Sru @cd ${.CURDIR}; ${_MAKE} buildworld 136110035Sru @cd ${.CURDIR}; ${_MAKE} -B installworld 13754324Smarcel.if target(post-world) 13854324Smarcel @echo 13954324Smarcel @echo "--------------------------------------------------------------" 14054324Smarcel @echo ">>> Making 'post-world' target" 14154324Smarcel @echo "--------------------------------------------------------------" 142110035Sru @cd ${.CURDIR}; ${_MAKE} post-world 14354324Smarcel.endif 14454324Smarcel @echo 14554324Smarcel @echo "--------------------------------------------------------------" 146118531Sru @echo ">>> make world completed on `LC_ALL=C date`" 147118531Sru @echo " (started ${STARTTIME})" 14854324Smarcel @echo "--------------------------------------------------------------" 14954324Smarcel 15054324Smarcel# 15195730Sru# kernel 15295730Sru# 15395730Sru# Short hand for `make buildkernel installkernel' 15495730Sru# 15595730Srukernel: buildkernel installkernel 15695730Sru 15795730Sru# 15838666Sjb# Perform a few tests to determine if the installed tools are adequate 159107374Sru# for building the world. 16017308Speter# 16155678Smarcelupgrade_checks: 162110035Sru @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \ 163117793Sru PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ 164110035Sru then \ 165110035Sru (cd ${.CURDIR} && make make); \ 166110035Sru fi 1672061Sjkh 16817308Speter# 169107516Sru# Upgrade make(1) to the current version using the installed 170107374Sru# headers, libraries and tools. 17155678Smarcel# 172107516SruMMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 173107516Sru DESTDIR= \ 174107516Sru INSTALL="sh ${.CURDIR}/tools/install.sh" 175107516SruMMAKE= ${MMAKEENV} make \ 176107516Sru -D_UPGRADING \ 177107516Sru -DNOMAN -DNOSHARED \ 178107516Sru -DNO_CPU_CFLAGS -DNO_WERROR 179107516Sru 180122204Skrismake: .PHONY 18155678Smarcel @echo 18255678Smarcel @echo "--------------------------------------------------------------" 183116696Sru @echo ">>> Building an up-to-date make(1)" 18455678Smarcel @echo "--------------------------------------------------------------" 18555678Smarcel @cd ${.CURDIR}/usr.bin/make; \ 186107516Sru ${MMAKE} obj && \ 187107516Sru ${MMAKE} depend && \ 188107516Sru ${MMAKE} all && \ 189107516Sru ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 19055678Smarcel 19155678Smarcel# 192111131Sru# universe 193111131Sru# 194111131Sru# Attempt to rebuild *everything* for all supported architectures, 195111131Sru# with reasonable chance of success, regardless of how old your 196111131Sru# existing system is. 197111131Sru# 198111131Srui386_mach= pc98 199103985Sphkuniverse: 200103985Sphk @echo "--------------------------------------------------------------" 201103985Sphk @echo ">>> make universe started on ${STARTTIME}" 202103985Sphk @echo "--------------------------------------------------------------" 203111089Sphk.for arch in i386 sparc64 alpha ia64 204111131Sru.for mach in ${arch} ${${arch}_mach} 205111131Sru @echo ">> ${mach} started on `LC_ALL=C date`" 206111131Sru -cd ${.CURDIR} && ${MAKE} buildworld \ 207111131Sru TARGET_ARCH=${arch} TARGET=${mach} \ 208111131Sru __MAKE_CONF=/dev/null \ 209111131Sru > _.${mach}.buildworld 2>&1 210111131Sru @echo ">> ${mach} buildworld completed on `LC_ALL=C date`" 211111131Sru.if exists(${.CURDIR}/sys/${mach}/conf/NOTES) 212111131Sru -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \ 213111133Sru > ${.CURDIR}/_.${mach}.makeLINT 2>&1 214103985Sphk.endif 215111131Sru cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach} 216111131Sru @echo ">> ${mach} completed on `LC_ALL=C date`" 217103985Sphk.endfor 218111131Sru.endfor 219103985Sphk @echo "--------------------------------------------------------------" 220118531Sru @echo ">>> make universe completed on `LC_ALL=C date`" 221118531Sru @echo " (started ${STARTTIME})" 222103985Sphk @echo "--------------------------------------------------------------" 223103985Sphk 224111131SruKERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \ 225111131Sru find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES 226103985Sphk 227103985Sphkbuildkernels: 228111131Sru.for kernel in ${KERNCONFS} 229111131Sru -cd ${.CURDIR} && ${MAKE} buildkernel \ 230111131Sru KERNCONF=${kernel} \ 231111131Sru __MAKE_CONF=/dev/null \ 232111131Sru > _.${TARGET}.${kernel} 2>&1 233103985Sphk.endfor 234