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