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