Makefile revision 119519
12061Sjkh# 250479Speter# $FreeBSD: head/Makefile 119519 2003-08-28 04:03:13Z marcel $ 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). 1938666Sjb# most - Build user commands, no libraries or include files. 2038666Sjb# installmost - Install user commands, no libraries or include files. 2132427Sjb# 2238666Sjb# This makefile is simple by design. The FreeBSD make automatically reads 23108451Sschweikh# the /usr/share/mk/sys.mk unless the -m argument is specified on the 2438666Sjb# command line. By keeping this makefile simple, it doesn't matter too 2538666Sjb# much how different the installed mk files are from those in the source 2638666Sjb# tree. This makefile executes a child make process, forcing it to use 2738666Sjb# the mk files from the source tree which are supposed to DTRT. 2817308Speter# 2991606Skeramida# The user-driven targets (as listed above) are implemented in Makefile.inc1. 3019175Sbde# 3196205Sjwd# If you want to build your system from source be sure that /usr/obj has 3296205Sjwd# at least 400MB of diskspace available. 3338042Sbde# 3496205Sjwd# For individuals wanting to build from the sources currently on their 3596205Sjwd# system, the simple instructions are: 3638042Sbde# 3796205Sjwd# 1. `cd /usr/src' (or to the directory containing your source tree). 3896205Sjwd# 2. `make world' 3917308Speter# 4096205Sjwd# For individuals wanting to upgrade their sources (even if only a 4196205Sjwd# delta of a few days): 4217308Speter# 4396205Sjwd# 1. `cd /usr/src' (or to the directory containing your source tree). 4496205Sjwd# 2. `make buildworld' 4596205Sjwd# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 4696205Sjwd# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 4796205Sjwd# 5. `reboot' (in single user mode: boot -s from the loader prompt). 4896205Sjwd# 6. `mergemaster -p' 4996205Sjwd# 7. `make installworld' 5096205Sjwd# 8. `mergemaster' 5196205Sjwd# 9. `reboot' 5296205Sjwd# 5396205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information. 5496205Sjwd# 5598775Sdillon# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can 5698723Sdillon# cross build world for other architectures using the buildworld target, 5798723Sdillon# and once the world is built you can cross build a kernel using the 5898723Sdillon# buildkernel target. 5998723Sdillon# 6038666Sjb# Define the user-driven targets. These are listed here in alphabetical 6138666Sjb# order, but that's not important. 6217308Speter# 6395509SruTGTS= all all-man buildkernel buildworld checkdpadd clean \ 6495793Sru cleandepend cleandir depend distribute distributeworld everything \ 65116679Ssimokawa hierarchy install installcheck installkernel installkernel.debug\ 66116679Ssimokawa reinstallkernel reinstallkernel.debug installmost installworld \ 67116679Ssimokawa libraries lint maninstall \ 68117806Sru most obj objlink regress rerelease tags update 692061Sjkh 7097769SruBITGTS= files includes 7197252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 7297252Sru 7395730Sru.ORDER: buildworld installworld 7495793Sru.ORDER: buildworld distributeworld 75111617Sru.ORDER: buildworld buildkernel 7695730Sru.ORDER: buildkernel installkernel 77116679Ssimokawa.ORDER: buildkernel installkernel.debug 7895730Sru.ORDER: buildkernel reinstallkernel 79116679Ssimokawa.ORDER: buildkernel reinstallkernel.debug 8095730Sru 81110035SruPATH= /sbin:/bin:/usr/sbin:/usr/bin 82107516SruMAKEOBJDIRPREFIX?= /usr/obj 83110035SruMAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 84117234SruBINMAKE= \ 85110035Sru `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 86117229Sru -m ${.CURDIR}/share/mk 87117234Sru_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 8854324Smarcel 8917308Speter# 90119519Smarcel# Make sure we have an up-to-date make(1). Only world and buildworld 91119519Smarcel# should do this as those are the initial targets used for upgrades. 92119519Smarcel# The user can define ALWAYS_CHECK_MAKE to have this check performed 93119519Smarcel# for all targets. 94119519Smarcel# 95119519Smarcel.if defined(ALWAYS_CHECK_MAKE) 96119519Smarcel${TGTS} ${BITGTS}: upgrade_checks 97119519Smarcel.else 98119519Smarcelbuildworld: upgrade_checks 99119519Smarcel.endif 100119519Smarcel 101119519Smarcel# 10238666Sjb# Handle the user-driven targets, using the source relative mk files. 10317308Speter# 104119519Smarcel 105119519Smarcel${TGTS} ${BITGTS}: 10638666Sjb @cd ${.CURDIR}; \ 107110035Sru ${_MAKE} ${.TARGET} 1082302Spaul 10939206Sjkh# Set a reasonable default 11039206Sjkh.MAIN: all 11139206Sjkh 11273349SruSTARTTIME!= LC_ALL=C date 11317308Speter# 11454324Smarcel# world 11554324Smarcel# 11654324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of 11754324Smarcel# success, regardless of how old your existing system is. 11854324Smarcel# 11954324Smarcelworld: upgrade_checks 12054324Smarcel @echo "--------------------------------------------------------------" 121118531Sru @echo ">>> make world started on ${STARTTIME}" 12254324Smarcel @echo "--------------------------------------------------------------" 12354324Smarcel.if target(pre-world) 12454324Smarcel @echo 12554324Smarcel @echo "--------------------------------------------------------------" 12654324Smarcel @echo ">>> Making 'pre-world' target" 12754324Smarcel @echo "--------------------------------------------------------------" 128110035Sru @cd ${.CURDIR}; ${_MAKE} pre-world 12954324Smarcel.endif 130110035Sru @cd ${.CURDIR}; ${_MAKE} buildworld 131110035Sru @cd ${.CURDIR}; ${_MAKE} -B installworld 13254324Smarcel.if target(post-world) 13354324Smarcel @echo 13454324Smarcel @echo "--------------------------------------------------------------" 13554324Smarcel @echo ">>> Making 'post-world' target" 13654324Smarcel @echo "--------------------------------------------------------------" 137110035Sru @cd ${.CURDIR}; ${_MAKE} post-world 13854324Smarcel.endif 13954324Smarcel @echo 14054324Smarcel @echo "--------------------------------------------------------------" 141118531Sru @echo ">>> make world completed on `LC_ALL=C date`" 142118531Sru @echo " (started ${STARTTIME})" 14354324Smarcel @echo "--------------------------------------------------------------" 14454324Smarcel 14554324Smarcel# 14695730Sru# kernel 14795730Sru# 14895730Sru# Short hand for `make buildkernel installkernel' 14995730Sru# 15095730Srukernel: buildkernel installkernel 15195730Sru 15295730Sru# 15338666Sjb# Perform a few tests to determine if the installed tools are adequate 154107374Sru# for building the world. 15517308Speter# 15655678Smarcelupgrade_checks: 157110035Sru @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \ 158117793Sru PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \ 159110035Sru then \ 160110035Sru (cd ${.CURDIR} && make make); \ 161110035Sru fi 1622061Sjkh 16317308Speter# 164107516Sru# Upgrade make(1) to the current version using the installed 165107374Sru# headers, libraries and tools. 16655678Smarcel# 167107516SruMMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 168107516Sru DESTDIR= \ 169107516Sru INSTALL="sh ${.CURDIR}/tools/install.sh" 170107516SruMMAKE= ${MMAKEENV} make \ 171107516Sru -D_UPGRADING \ 172107516Sru -DNOMAN -DNOSHARED \ 173107516Sru -DNO_CPU_CFLAGS -DNO_WERROR 174107516Sru 17555678Smarcelmake: 17655678Smarcel @echo 17755678Smarcel @echo "--------------------------------------------------------------" 178116696Sru @echo ">>> Building an up-to-date make(1)" 17955678Smarcel @echo "--------------------------------------------------------------" 18055678Smarcel @cd ${.CURDIR}/usr.bin/make; \ 181107516Sru ${MMAKE} obj && \ 182107516Sru ${MMAKE} depend && \ 183107516Sru ${MMAKE} all && \ 184107516Sru ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 18555678Smarcel 18655678Smarcel# 187111131Sru# universe 188111131Sru# 189111131Sru# Attempt to rebuild *everything* for all supported architectures, 190111131Sru# with reasonable chance of success, regardless of how old your 191111131Sru# existing system is. 192111131Sru# 193111131Srui386_mach= pc98 194103985Sphkuniverse: 195103985Sphk @echo "--------------------------------------------------------------" 196103985Sphk @echo ">>> make universe started on ${STARTTIME}" 197103985Sphk @echo "--------------------------------------------------------------" 198111089Sphk.for arch in i386 sparc64 alpha ia64 199111131Sru.for mach in ${arch} ${${arch}_mach} 200111131Sru @echo ">> ${mach} started on `LC_ALL=C date`" 201111131Sru -cd ${.CURDIR} && ${MAKE} buildworld \ 202111131Sru TARGET_ARCH=${arch} TARGET=${mach} \ 203111131Sru __MAKE_CONF=/dev/null \ 204111131Sru > _.${mach}.buildworld 2>&1 205111131Sru @echo ">> ${mach} buildworld completed on `LC_ALL=C date`" 206111131Sru.if exists(${.CURDIR}/sys/${mach}/conf/NOTES) 207111131Sru -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \ 208111133Sru > ${.CURDIR}/_.${mach}.makeLINT 2>&1 209103985Sphk.endif 210111131Sru cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach} 211111131Sru @echo ">> ${mach} completed on `LC_ALL=C date`" 212103985Sphk.endfor 213111131Sru.endfor 214103985Sphk @echo "--------------------------------------------------------------" 215118531Sru @echo ">>> make universe completed on `LC_ALL=C date`" 216118531Sru @echo " (started ${STARTTIME})" 217103985Sphk @echo "--------------------------------------------------------------" 218103985Sphk 219111131SruKERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \ 220111131Sru find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES 221103985Sphk 222103985Sphkbuildkernels: 223111131Sru.for kernel in ${KERNCONFS} 224111131Sru -cd ${.CURDIR} && ${MAKE} buildkernel \ 225111131Sru KERNCONF=${kernel} \ 226111131Sru __MAKE_CONF=/dev/null \ 227111131Sru > _.${TARGET}.${kernel} 2>&1 228103985Sphk.endfor 229