Makefile revision 112999
1# 2# $FreeBSD: head/Makefile 112999 2003-04-03 05:28:09Z imp $ 3# 4# The user-driven targets are: 5# 6# universe - *Really* build *everything* (buildworld and 7# all kernels on all architectures). 8# buildworld - Rebuild *everything*, including glue to help do 9# upgrades. 10# installworld - Install everything built by "buildworld". 11# world - buildworld + installworld. 12# buildkernel - Rebuild the kernel and the kernel-modules. 13# installkernel - Install the kernel and the kernel-modules. 14# reinstallkernel - Reinstall the kernel and the kernel-modules. 15# kernel - buildkernel + installkernel. 16# update - Convenient way to update your source tree (cvs). 17# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 18# most - Build user commands, no libraries or include files. 19# installmost - Install user commands, no libraries or include files. 20# 21# This makefile is simple by design. The FreeBSD make automatically reads 22# the /usr/share/mk/sys.mk unless the -m argument is specified on the 23# command line. By keeping this makefile simple, it doesn't matter too 24# much how different the installed mk files are from those in the source 25# tree. This makefile executes a child make process, forcing it to use 26# the mk files from the source tree which are supposed to DTRT. 27# 28# The user-driven targets (as listed above) are implemented in Makefile.inc1. 29# 30# If you want to build your system from source be sure that /usr/obj has 31# at least 400MB of diskspace available. 32# 33# For individuals wanting to build from the sources currently on their 34# system, the simple instructions are: 35# 36# 1. `cd /usr/src' (or to the directory containing your source tree). 37# 2. `make world' 38# 39# For individuals wanting to upgrade their sources (even if only a 40# delta of a few days): 41# 42# 1. `cd /usr/src' (or to the directory containing your source tree). 43# 2. `make buildworld' 44# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 45# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 46# 5. `reboot' (in single user mode: boot -s from the loader prompt). 47# 6. `mergemaster -p' 48# 7. `make installworld' 49# 8. `mergemaster' 50# 9. `reboot' 51# 52# See src/UPDATING `COMMON ITEMS' for more complete information. 53# 54# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can 55# cross build world for other architectures using the buildworld target, 56# and once the world is built you can cross build a kernel using the 57# buildkernel target. 58# 59# Define the user-driven targets. These are listed here in alphabetical 60# order, but that's not important. 61# 62TGTS= all all-man buildkernel buildworld checkdpadd clean \ 63 cleandepend cleandir depend distribute distributeworld everything \ 64 hierarchy install installcheck installkernel \ 65 reinstallkernel installmost installworld libraries lint maninstall \ 66 mk most obj objlink regress rerelease tags update 67 68BITGTS= files includes 69BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 70 71.ORDER: buildworld installworld 72.ORDER: buildworld distributeworld 73.ORDER: buildworld buildkernel 74.ORDER: buildkernel installkernel 75.ORDER: buildkernel reinstallkernel 76 77PATH= /sbin:/bin:/usr/sbin:/usr/bin 78MAKEOBJDIRPREFIX?= /usr/obj 79MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 80_MAKE= PATH=${PATH} \ 81 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 82 -m ${.CURDIR}/share/mk -f Makefile.inc1 83 84# 85# Handle the user-driven targets, using the source relative mk files. 86# 87${TGTS} ${BITGTS}: upgrade_checks 88 @cd ${.CURDIR}; \ 89 ${_MAKE} ${.TARGET} 90 91# Set a reasonable default 92.MAIN: all 93 94STARTTIME!= LC_ALL=C date 95# 96# world 97# 98# Attempt to rebuild and reinstall *everything*, with reasonable chance of 99# success, regardless of how old your existing system is. 100# 101world: upgrade_checks 102 @echo "--------------------------------------------------------------" 103 @echo ">>> elf make world started on ${STARTTIME}" 104 @echo "--------------------------------------------------------------" 105.if target(pre-world) 106 @echo 107 @echo "--------------------------------------------------------------" 108 @echo ">>> Making 'pre-world' target" 109 @echo "--------------------------------------------------------------" 110 @cd ${.CURDIR}; ${_MAKE} pre-world 111.endif 112 @cd ${.CURDIR}; ${_MAKE} buildworld 113 @cd ${.CURDIR}; ${_MAKE} -B installworld 114.if target(post-world) 115 @echo 116 @echo "--------------------------------------------------------------" 117 @echo ">>> Making 'post-world' target" 118 @echo "--------------------------------------------------------------" 119 @cd ${.CURDIR}; ${_MAKE} post-world 120.endif 121 @echo 122 @echo "--------------------------------------------------------------" 123 @printf ">>> elf make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 124 @echo "--------------------------------------------------------------" 125 126# 127# kernel 128# 129# Short hand for `make buildkernel installkernel' 130# 131kernel: buildkernel installkernel 132 133# 134# Perform a few tests to determine if the installed tools are adequate 135# for building the world. 136# 137upgrade_checks: 138 @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \ 139 PATH=${PATH} ${MAKE} 2>/dev/null); \ 140 then \ 141 (cd ${.CURDIR} && make make); \ 142 fi 143 144# 145# Upgrade make(1) to the current version using the installed 146# headers, libraries and tools. 147# 148MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 149 DESTDIR= \ 150 INSTALL="sh ${.CURDIR}/tools/install.sh" 151MMAKE= ${MMAKEENV} make \ 152 -D_UPGRADING \ 153 -DNOMAN -DNOSHARED \ 154 -DNO_CPU_CFLAGS -DNO_WERROR 155 156make: 157 @echo 158 @echo "--------------------------------------------------------------" 159 @echo " Building an up-to-date make(1)" 160 @echo "--------------------------------------------------------------" 161 @cd ${.CURDIR}/usr.bin/make; \ 162 ${MMAKE} obj && \ 163 ${MMAKE} depend && \ 164 ${MMAKE} all && \ 165 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 166 167# 168# universe 169# 170# Attempt to rebuild *everything* for all supported architectures, 171# with reasonable chance of success, regardless of how old your 172# existing system is. 173# 174i386_mach= pc98 175universe: 176 @echo "--------------------------------------------------------------" 177 @echo ">>> make universe started on ${STARTTIME}" 178 @echo "--------------------------------------------------------------" 179.for arch in i386 sparc64 alpha ia64 180.for mach in ${arch} ${${arch}_mach} 181 @echo ">> ${mach} started on `LC_ALL=C date`" 182 -cd ${.CURDIR} && ${MAKE} buildworld \ 183 TARGET_ARCH=${arch} TARGET=${mach} \ 184 __MAKE_CONF=/dev/null \ 185 > _.${mach}.buildworld 2>&1 186 @echo ">> ${mach} buildworld completed on `LC_ALL=C date`" 187.if exists(${.CURDIR}/sys/${mach}/conf/NOTES) 188 -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \ 189 > ${.CURDIR}/_.${mach}.makeLINT 2>&1 190.endif 191 cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach} 192 @echo ">> ${mach} completed on `LC_ALL=C date`" 193.endfor 194.endfor 195 @echo "--------------------------------------------------------------" 196 @printf ">>> make universe completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 197 @echo "--------------------------------------------------------------" 198 199KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \ 200 find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES 201 202buildkernels: 203.for kernel in ${KERNCONFS} 204 -cd ${.CURDIR} && ${MAKE} buildkernel \ 205 KERNCONF=${kernel} \ 206 __MAKE_CONF=/dev/null \ 207 > _.${TARGET}.${kernel} 2>&1 208.endfor 209