Makefile revision 120760
12061Sjkh# 250479Speter# $FreeBSD: head/Makefile 120760 2003-10-04 18:53:38Z ru $ 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# 6195509SruTGTS= all all-man buildkernel buildworld checkdpadd clean \ 6295793Sru cleandepend cleandir depend distribute distributeworld everything \ 63116679Ssimokawa hierarchy install installcheck installkernel installkernel.debug\ 64120760Sru reinstallkernel reinstallkernel.debug installworld \ 65116679Ssimokawa libraries lint maninstall \ 66120760Sru obj objlink regress rerelease tags update 672061Sjkh 6897769SruBITGTS= files includes 6997252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 70119579SruTGTS+= ${BITGTS} 7197252Sru 7295730Sru.ORDER: buildworld installworld 7395793Sru.ORDER: buildworld distributeworld 74111617Sru.ORDER: buildworld buildkernel 7595730Sru.ORDER: buildkernel installkernel 76116679Ssimokawa.ORDER: buildkernel installkernel.debug 7795730Sru.ORDER: buildkernel reinstallkernel 78116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug 7995730Sru 80110035SruPATH= /sbin:/bin:/usr/sbin:/usr/bin 81107516SruMAKEOBJDIRPREFIX?= /usr/obj 82110035SruMAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 83117234SruBINMAKE= \ 84110035Sru `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 85117229Sru -m ${.CURDIR}/share/mk 86117234Sru_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 8754324Smarcel 8817308Speter# 89119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld 90119519Smarcel# should do this as those are the initial targets used for upgrades. 91119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed 92119519Smarcel# for all targets. 93119519Smarcel# 94119519Smarcel.if defined(ALWAYS_CHECK_MAKE) 95119579Sru${TGTS}: upgrade_checks 96119519Smarcel.else 97119519Smarcelbuildworld: upgrade_checks 98119519Smarcel.endif 99119519Smarcel 100119519Smarcel# 10138666Sjb# Handle the user-driven targets, using the source relative mk files. 10217308Speter# 103119519Smarcel 104119579Sru${TGTS}: 10538666Sjb @cd ${.CURDIR}; \ 106110035Sru ${_MAKE} ${.TARGET} 1072302Spaul 10839206Sjkh# Set a reasonable default 10939206Sjkh.MAIN: all 11039206Sjkh 11173349SruSTARTTIME!= LC_ALL=C date 11217308Speter# 11354324Smarcel# world 11454324Smarcel# 11554324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of 11654324Smarcel# success, regardless of how old your existing system is. 11754324Smarcel# 11854324Smarcelworld: upgrade_checks 11954324Smarcel @echo "--------------------------------------------------------------" 120118531Sru @echo ">>> make world started on ${STARTTIME}" 12154324Smarcel @echo "--------------------------------------------------------------" 12254324Smarcel.if target(pre-world) 12354324Smarcel @echo 12454324Smarcel @echo "--------------------------------------------------------------" 12554324Smarcel @echo ">>> Making 'pre-world' target" 12654324Smarcel @echo "--------------------------------------------------------------" 127110035Sru @cd ${.CURDIR}; ${_MAKE} pre-world 12854324Smarcel.endif 129110035Sru @cd ${.CURDIR}; ${_MAKE} buildworld 130110035Sru @cd ${.CURDIR}; ${_MAKE} -B installworld 13154324Smarcel.if target(post-world) 13254324Smarcel @echo 13354324Smarcel @echo "--------------------------------------------------------------" 13454324Smarcel @echo ">>> Making 'post-world' target" 13554324Smarcel @echo "--------------------------------------------------------------" 136110035Sru @cd ${.CURDIR}; ${_MAKE} post-world 13754324Smarcel.endif 13854324Smarcel @echo 13954324Smarcel @echo "--------------------------------------------------------------" 140118531Sru @echo ">>> make world completed on `LC_ALL=C date`" 141118531Sru @echo " (started ${STARTTIME})" 14254324Smarcel @echo "--------------------------------------------------------------" 14354324Smarcel 14454324Smarcel# 14595730Sru# kernel 14695730Sru# 14795730Sru# Short hand for `make buildkernel installkernel' 14895730Sru# 14995730Srukernel: buildkernel installkernel 15095730Sru 15195730Sru# 15238666Sjb# Perform a few tests to determine if the installed tools are adequate 153107374Sru# for building the world. 15417308Speter# 15555678Smarcelupgrade_checks: 156110035Sru @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \ 157117793Sru PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ 158110035Sru then \ 159110035Sru (cd ${.CURDIR} && make make); \ 160110035Sru fi 1612061Sjkh 16217308Speter# 163107516Sru# Upgrade make(1) to the current version using the installed 164107374Sru# headers, libraries and tools. 16555678Smarcel# 166107516SruMMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 167107516Sru DESTDIR= \ 168107516Sru INSTALL="sh ${.CURDIR}/tools/install.sh" 169107516SruMMAKE= ${MMAKEENV} make \ 170107516Sru -D_UPGRADING \ 171107516Sru -DNOMAN -DNOSHARED \ 172107516Sru -DNO_CPU_CFLAGS -DNO_WERROR 173107516Sru 17455678Smarcelmake: 17555678Smarcel @echo 17655678Smarcel @echo "--------------------------------------------------------------" 177116696Sru @echo ">>> Building an up-to-date make(1)" 17855678Smarcel @echo "--------------------------------------------------------------" 17955678Smarcel @cd ${.CURDIR}/usr.bin/make; \ 180107516Sru ${MMAKE} obj && \ 181107516Sru ${MMAKE} depend && \ 182107516Sru ${MMAKE} all && \ 183107516Sru ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 18455678Smarcel 18555678Smarcel# 186111131Sru# universe 187111131Sru# 188111131Sru# Attempt to rebuild *everything* for all supported architectures, 189111131Sru# with reasonable chance of success, regardless of how old your 190111131Sru# existing system is. 191111131Sru# 192111131Srui386_mach= pc98 193103985Sphkuniverse: 194103985Sphk @echo "--------------------------------------------------------------" 195103985Sphk @echo ">>> make universe started on ${STARTTIME}" 196103985Sphk @echo "--------------------------------------------------------------" 197111089Sphk.for arch in i386 sparc64 alpha ia64 198111131Sru.for mach in ${arch} ${${arch}_mach} 199111131Sru @echo ">> ${mach} started on `LC_ALL=C date`" 200111131Sru -cd ${.CURDIR} && ${MAKE} buildworld \ 201111131Sru TARGET_ARCH=${arch} TARGET=${mach} \ 202111131Sru __MAKE_CONF=/dev/null \ 203111131Sru > _.${mach}.buildworld 2>&1 204111131Sru @echo ">> ${mach} buildworld completed on `LC_ALL=C date`" 205111131Sru.if exists(${.CURDIR}/sys/${mach}/conf/NOTES) 206111131Sru -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \ 207111133Sru > ${.CURDIR}/_.${mach}.makeLINT 2>&1 208103985Sphk.endif 209111131Sru cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach} 210111131Sru @echo ">> ${mach} completed on `LC_ALL=C date`" 211103985Sphk.endfor 212111131Sru.endfor 213103985Sphk @echo "--------------------------------------------------------------" 214118531Sru @echo ">>> make universe completed on `LC_ALL=C date`" 215118531Sru @echo " (started ${STARTTIME})" 216103985Sphk @echo "--------------------------------------------------------------" 217103985Sphk 218111131SruKERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \ 219111131Sru find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES 220103985Sphk 221103985Sphkbuildkernels: 222111131Sru.for kernel in ${KERNCONFS} 223111131Sru -cd ${.CURDIR} && ${MAKE} buildkernel \ 224111131Sru KERNCONF=${kernel} \ 225111131Sru __MAKE_CONF=/dev/null \ 226111131Sru > _.${TARGET}.${kernel} 2>&1 227103985Sphk.endfor 228