1# 2# $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $ 3# $DragonFly: src/Makefile,v 1.3 2003/11/19 01:05:31 dillon Exp $ 4# 5# The user-driven targets are: 6# 7# buildworld - Rebuild *everything*, including glue to help do 8# upgrades. 9# installworld - Install everything built by "buildworld". 10# world - buildworld + installworld. 11# buildkernel - Rebuild the kernel and the kernel-modules. 12# installkernel - Install the kernel and the kernel-modules. 13# reinstallkernel - Reinstall the kernel and the kernel-modules. 14# kernel - buildkernel + installkernel. 15# update - Convenient way to update your source tree (cvs). 16# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 17# most - Build user commands, no libraries or include files. 18# installmost - Install user commands, no libraries or include files. 19# aout-to-elf - Upgrade an system from a.out to elf format (see below). 20# aout-to-elf-build - Build everything required to upgrade a system from 21# a.out to elf format (see below). 22# aout-to-elf-install - Install everything built by aout-to-elf-build (see 23# below). 24# move-aout-libs - Move the a.out libraries into an aout sub-directory 25# of each elf library sub-directory. 26# 27# This makefile is simple by design. The FreeBSD make automatically reads 28# the /usr/share/mk/sys.mk unless the -m argument is specified on the 29# command line. By keeping this makefile simple, it doesn't matter too 30# much how different the installed mk files are from those in the source 31# tree. This makefile executes a child make process, forcing it to use 32# the mk files from the source tree which are supposed to DTRT. 33# 34# The user-driven targets (as listed above) are implemented in Makefile.inc1. 35# 36# If you want to build your system from source be sure that /usr/obj has 37# at least 400MB of diskspace available. 38# 39# For individuals wanting to build from the sources currently on their 40# system, the simple instructions are: 41# 42# 1. `cd /usr/src' (or to the directory containing your source tree). 43# 2. `make world' 44# 45# For individuals wanting to upgrade their sources (even if only a 46# delta of a few days): 47# 48# 1. `cd /usr/src' (or to the directory containing your source tree). 49# 2. `make buildworld' 50# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 51# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 52# 5. `reboot' (in single user mode: boot -s from the loader prompt). 53# 6. `mergemaster -p' 54# 7. `make installworld' 55# 8. `mergemaster' 56# 9. `reboot' 57# 58# See src/UPDATING `COMMON ITEMS' for more complete information. 59# 60# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will 61# update the legacy support for aout. This includes all libraries, ld.so 62# and boot objects. This part of build should be regarded as 63# deprecated and you should _not_ expect to be able to do this past the 64# release of 4.0. You have exactly one major release to move entirely 65# to elf. 66# 67# If TARGET_ARCH=arch (e.g. alpha) is specified you can 68# cross build world for other architectures using the buildworld target, 69# and once the world is built you can cross build a kernel using the 70# buildkernel target. 71# 72# ---------------------------------------------------------------------------- 73# 74# Upgrading an i386 system from a.out to elf format 75# 76# 77# The aout->elf transition build is performed by doing a `make upgrade' (or 78# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 79# by a `make aout-to-elf-install', depending on user preference. 80# You need to have at least 320 Mb of free space for the object tree. 81# 82# The upgrade process checks the installed release. If this is 3.0-CURRENT, 83# it is assumed that your kernel contains all the syscalls required by the 84# current sources. 85# 86# The upgrade procedure will stop and ask for confirmation to proceed 87# several times. On each occasion, you can type Ctrl-C to abort the 88# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 89# the confirmation steps. 90# 91# At the end of the upgrade procedure, /etc/objformat is created or 92# updated to contain OBJFORMAT=elf. From then on, you're elf by default. 93# 94# ---------------------------------------------------------------------------- 95# 96# 97# Define the user-driven targets. These are listed here in alphabetical 98# order, but that's not important. 99# 100TGTS= all all-man buildkernel buildworld checkdpadd clean \ 101 cleandepend cleandir depend distribute distributeworld everything \ 102 hierarchy install installcheck installkernel \ 103 reinstallkernel installmost installworld libraries lint maninstall \ 104 mk most obj objlink regress rerelease tags update 105 106BITGTS= files includes 107BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 108 109.ORDER: buildworld installworld 110.ORDER: buildworld distributeworld 111.ORDER: buildworld buildkernel 112.ORDER: buildkernel installkernel 113.ORDER: buildkernel reinstallkernel 114 115PATH= /sbin:/bin:/usr/sbin:/usr/bin 116MAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 117 118# 119# Handle the user-driven targets, using the source relative mk files. 120# 121${TGTS} ${BITGTS}: upgrade_checks 122 @cd ${.CURDIR}; \ 123 ${MAKE} ${.TARGET} 124 125# Set a reasonable default 126.MAIN: all 127 128STARTTIME!= LC_ALL=C date 129# 130# world 131# 132# Attempt to rebuild and reinstall *everything*, with reasonable chance of 133# success, regardless of how old your existing system is. 134# 135world: upgrade_checks 136 @echo "--------------------------------------------------------------" 137 @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}" 138 @echo "--------------------------------------------------------------" 139.if target(pre-world) 140 @echo 141 @echo "--------------------------------------------------------------" 142 @echo ">>> Making 'pre-world' target" 143 @echo "--------------------------------------------------------------" 144 @cd ${.CURDIR}; ${MAKE} pre-world 145.endif 146 @cd ${.CURDIR}; ${MAKE} buildworld 147 @cd ${.CURDIR}; ${MAKE} -B installworld 148.if target(post-world) 149 @echo 150 @echo "--------------------------------------------------------------" 151 @echo ">>> Making 'post-world' target" 152 @echo "--------------------------------------------------------------" 153 @cd ${.CURDIR}; ${MAKE} post-world 154.endif 155 @echo 156 @echo "--------------------------------------------------------------" 157 @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 158 @echo "--------------------------------------------------------------" 159 160# 161# kernel 162# 163# Short hand for `make buildkernel installkernel' 164# 165kernel: buildkernel installkernel 166 167# 168# Perform a few tests to determine if the installed tools are adequate 169# for building the world. These are for older systems (prior to 2.2.5). 170# 171# From 2.2.5 onwards, the installed tools will pass these upgrade tests, 172# so the normal make world is capable of doing what is required to update 173# the system to current. 174# 175upgrade_checks: 176 @cd ${.CURDIR}; \ 177 if ! make -m ${.CURDIR}/share/mk -Dnotdef test >/dev/null 2>&1; then \ 178 make make; \ 179 fi 180 @cd ${.CURDIR}; \ 181 if make -V .CURDIR:C/.// 2>&1 >/dev/null | \ 182 grep -q "Unknown modifier 'C'"; then \ 183 make make; \ 184 fi 185 186# 187# A simple test target used as part of the test to see if make supports 188# the -m argument. Also test that make will only evaluate a conditional 189# as far as is necessary to determine its value. 190# 191test: 192.if defined(notdef) 193.undef notdef 194.if defined(notdef) && ${notdef:U} 195.endif 196.endif 197 198# 199# Upgrade the installed make to the current version using the installed 200# headers, libraries and build tools. This is required on installed versions 201# prior to 2.2.5 in which the installed make doesn't support the -m argument. 202# 203make: 204 @echo 205 @echo "--------------------------------------------------------------" 206 @echo " Upgrading the installed make" 207 @echo "--------------------------------------------------------------" 208 @cd ${.CURDIR}/usr.bin/make; \ 209 make obj && make depend && make all && make install 210 211# 212# Define the upgrade targets. These are listed here in alphabetical 213# order, but that's not important. 214# 215UPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 216 move-aout-libs 217 218# 219# Handle the upgrade targets, using the source relative mk files. 220# 221 222upgrade: upgrade_etc 223 224# 225# Handle post-installworld updating of static files (e.g. like /etc/rc) 226# 227upgrade_etc: 228 @cd ${.CURDIR}/etc; make upgrade_etc 229 230${UPGRADE} : upgrade_checks 231 @cd ${.CURDIR}; \ 232 ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 233