Makefile revision 111133
1184588Sdfr# 2184588Sdfr# $FreeBSD: head/Makefile 111133 2003-02-19 16:57:12Z ru $ 3184588Sdfr# 4184588Sdfr# The user-driven targets are: 5184588Sdfr# 6184588Sdfr# universe - *Really* build *everything* (buildworld and 7184588Sdfr# all kernels on all architectures). 8184588Sdfr# buildworld - Rebuild *everything*, including glue to help do 9184588Sdfr# upgrades. 10184588Sdfr# installworld - Install everything built by "buildworld". 11184588Sdfr# world - buildworld + installworld. 12184588Sdfr# buildkernel - Rebuild the kernel and the kernel-modules. 13184588Sdfr# installkernel - Install the kernel and the kernel-modules. 14184588Sdfr# reinstallkernel - Reinstall the kernel and the kernel-modules. 15184588Sdfr# kernel - buildkernel + installkernel. 16184588Sdfr# update - Convenient way to update your source tree (cvs). 17184588Sdfr# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 18184588Sdfr# most - Build user commands, no libraries or include files. 19184588Sdfr# installmost - Install user commands, no libraries or include files. 20184588Sdfr# aout-to-elf - Upgrade a system from a.out to elf format (see below). 21184588Sdfr# aout-to-elf-build - Build everything required to upgrade a system from 22184588Sdfr# a.out to elf format (see below). 23184588Sdfr# aout-to-elf-install - Install everything built by aout-to-elf-build (see 24184588Sdfr# below). 25184588Sdfr# move-aout-libs - Move the a.out libraries into an aout sub-directory 26184588Sdfr# of each elf library sub-directory. 27184588Sdfr# 28184588Sdfr# This makefile is simple by design. The FreeBSD make automatically reads 29184588Sdfr# the /usr/share/mk/sys.mk unless the -m argument is specified on the 30184588Sdfr# command line. By keeping this makefile simple, it doesn't matter too 31184588Sdfr# much how different the installed mk files are from those in the source 32184588Sdfr# tree. This makefile executes a child make process, forcing it to use 33184588Sdfr# the mk files from the source tree which are supposed to DTRT. 34184588Sdfr# 35184588Sdfr# The user-driven targets (as listed above) are implemented in Makefile.inc1. 36184588Sdfr# 37184588Sdfr# If you want to build your system from source be sure that /usr/obj has 38184588Sdfr# at least 400MB of diskspace available. 39184588Sdfr# 40184588Sdfr# For individuals wanting to build from the sources currently on their 41184588Sdfr# system, the simple instructions are: 42184588Sdfr# 43184588Sdfr# 1. `cd /usr/src' (or to the directory containing your source tree). 44184588Sdfr# 2. `make world' 45184588Sdfr# 46184588Sdfr# For individuals wanting to upgrade their sources (even if only a 47184588Sdfr# delta of a few days): 48184588Sdfr# 49184588Sdfr# 1. `cd /usr/src' (or to the directory containing your source tree). 50184588Sdfr# 2. `make buildworld' 51184588Sdfr# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 52184588Sdfr# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 53184588Sdfr# 5. `reboot' (in single user mode: boot -s from the loader prompt). 54184588Sdfr# 6. `mergemaster -p' 55184588Sdfr# 7. `make installworld' 56184588Sdfr# 8. `mergemaster' 57184588Sdfr# 9. `reboot' 58184588Sdfr# 59184588Sdfr# See src/UPDATING `COMMON ITEMS' for more complete information. 60184588Sdfr# 61184588Sdfr# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can 62184588Sdfr# cross build world for other architectures using the buildworld target, 63184588Sdfr# and once the world is built you can cross build a kernel using the 64184588Sdfr# buildkernel target. 65184588Sdfr# 66184588Sdfr# ---------------------------------------------------------------------------- 67184588Sdfr# 68184588Sdfr# Upgrading an i386 system from a.out to elf format 69184588Sdfr# 70184588Sdfr# 71184588Sdfr# The aout->elf transition build is performed by doing a `make upgrade' (or 72184588Sdfr# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 73184588Sdfr# by a `make aout-to-elf-install', depending on user preference. 74184588Sdfr# You need to have at least 320 MB of free space for the object tree. 75184588Sdfr# 76184588Sdfr# The upgrade process checks the installed release. If this is 3.0-CURRENT, 77184588Sdfr# it is assumed that your kernel contains all the syscalls required by the 78184588Sdfr# current sources. 79184588Sdfr# 80184588Sdfr# The upgrade procedure will stop and ask for confirmation to proceed 81184588Sdfr# several times. On each occasion, you can type Ctrl-C to abort the 82184588Sdfr# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 83184588Sdfr# the confirmation steps. 84184588Sdfr# 85184588Sdfr# ---------------------------------------------------------------------------- 86184588Sdfr# 87184588Sdfr# 88184588Sdfr# Define the user-driven targets. These are listed here in alphabetical 89184588Sdfr# order, but that's not important. 90184588Sdfr# 91184588SdfrTGTS= all all-man buildkernel buildworld checkdpadd clean \ 92184588Sdfr cleandepend cleandir depend distribute distributeworld everything \ 93184588Sdfr hierarchy install installcheck installkernel \ 94184588Sdfr reinstallkernel installmost installworld libraries lint maninstall \ 95184588Sdfr mk most obj objlink regress rerelease tags update 96184588Sdfr 97184588SdfrBITGTS= files includes 98BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 99 100.ORDER: buildworld installworld 101.ORDER: buildworld distributeworld 102.ORDER: buildkernel installkernel 103.ORDER: buildkernel reinstallkernel 104 105PATH= /sbin:/bin:/usr/sbin:/usr/bin 106MAKEOBJDIRPREFIX?= /usr/obj 107MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE} 108_MAKE= PATH=${PATH} \ 109 `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \ 110 -m ${.CURDIR}/share/mk -f Makefile.inc1 111 112# 113# Handle the user-driven targets, using the source relative mk files. 114# 115${TGTS} ${BITGTS}: upgrade_checks 116 @cd ${.CURDIR}; \ 117 ${_MAKE} ${.TARGET} 118 119# Set a reasonable default 120.MAIN: all 121 122STARTTIME!= LC_ALL=C date 123# 124# world 125# 126# Attempt to rebuild and reinstall *everything*, with reasonable chance of 127# success, regardless of how old your existing system is. 128# 129world: upgrade_checks 130 @echo "--------------------------------------------------------------" 131 @echo ">>> elf make world started on ${STARTTIME}" 132 @echo "--------------------------------------------------------------" 133.if target(pre-world) 134 @echo 135 @echo "--------------------------------------------------------------" 136 @echo ">>> Making 'pre-world' target" 137 @echo "--------------------------------------------------------------" 138 @cd ${.CURDIR}; ${_MAKE} pre-world 139.endif 140 @cd ${.CURDIR}; ${_MAKE} buildworld 141 @cd ${.CURDIR}; ${_MAKE} -B installworld 142.if target(post-world) 143 @echo 144 @echo "--------------------------------------------------------------" 145 @echo ">>> Making 'post-world' target" 146 @echo "--------------------------------------------------------------" 147 @cd ${.CURDIR}; ${_MAKE} post-world 148.endif 149 @echo 150 @echo "--------------------------------------------------------------" 151 @printf ">>> elf make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 152 @echo "--------------------------------------------------------------" 153 154# 155# kernel 156# 157# Short hand for `make buildkernel installkernel' 158# 159kernel: buildkernel installkernel 160 161# 162# Perform a few tests to determine if the installed tools are adequate 163# for building the world. 164# 165upgrade_checks: 166 @if ! (cd ${.CURDIR}/tools/regression/usr.bin/make && \ 167 PATH=${PATH} ${MAKE} 2>/dev/null); \ 168 then \ 169 (cd ${.CURDIR} && make make); \ 170 fi 171 172# 173# Upgrade make(1) to the current version using the installed 174# headers, libraries and tools. 175# 176MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \ 177 DESTDIR= \ 178 INSTALL="sh ${.CURDIR}/tools/install.sh" 179MMAKE= ${MMAKEENV} make \ 180 -D_UPGRADING \ 181 -DNOMAN -DNOSHARED \ 182 -DNO_CPU_CFLAGS -DNO_WERROR 183 184make: 185 @echo 186 @echo "--------------------------------------------------------------" 187 @echo " Building an up-to-date make(1)" 188 @echo "--------------------------------------------------------------" 189 @cd ${.CURDIR}/usr.bin/make; \ 190 ${MMAKE} obj && \ 191 ${MMAKE} depend && \ 192 ${MMAKE} all && \ 193 ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= 194 195# 196# Define the upgrade targets. These are listed here in alphabetical 197# order, but that's not important. 198# 199UPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 200 move-aout-libs 201 202# 203# Handle the upgrade targets, using the source relative mk files. 204# 205 206upgrade: aout-to-elf 207 208${UPGRADE} : upgrade_checks 209 @cd ${.CURDIR}; \ 210 ${_MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 211 212# 213# universe 214# 215# Attempt to rebuild *everything* for all supported architectures, 216# with reasonable chance of success, regardless of how old your 217# existing system is. 218# 219i386_mach= pc98 220universe: 221 @echo "--------------------------------------------------------------" 222 @echo ">>> make universe started on ${STARTTIME}" 223 @echo "--------------------------------------------------------------" 224.for arch in i386 sparc64 alpha ia64 225.for mach in ${arch} ${${arch}_mach} 226 @echo ">> ${mach} started on `LC_ALL=C date`" 227 -cd ${.CURDIR} && ${MAKE} buildworld \ 228 TARGET_ARCH=${arch} TARGET=${mach} \ 229 __MAKE_CONF=/dev/null \ 230 > _.${mach}.buildworld 2>&1 231 @echo ">> ${mach} buildworld completed on `LC_ALL=C date`" 232.if exists(${.CURDIR}/sys/${mach}/conf/NOTES) 233 -cd ${.CURDIR}/sys/${mach}/conf && ${MAKE} LINT \ 234 > ${.CURDIR}/_.${mach}.makeLINT 2>&1 235.endif 236 cd ${.CURDIR} && ${MAKE} buildkernels TARGET_ARCH=${arch} TARGET=${mach} 237 @echo ">> ${mach} completed on `LC_ALL=C date`" 238.endfor 239.endfor 240 @echo "--------------------------------------------------------------" 241 @printf ">>> make universe completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 242 @echo "--------------------------------------------------------------" 243 244KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/conf && \ 245 find [A-Z]*[A-Z] -type f -maxdepth 0 ! -name NOTES 246 247buildkernels: 248.for kernel in ${KERNCONFS} 249 -cd ${.CURDIR} && ${MAKE} buildkernel \ 250 KERNCONF=${kernel} \ 251 __MAKE_CONF=/dev/null \ 252 > _.${TARGET}.${kernel} 2>&1 253.endfor 254