Makefile revision 100872
1170525Syongari# 2170525Syongari# $FreeBSD: head/Makefile 100402 2002-07-20 10:01:00Z ru $ 3170525Syongari# 4170525Syongari# The user-driven targets are: 5170525Syongari# 6170525Syongari# buildworld - Rebuild *everything*, including glue to help do 7170525Syongari# upgrades. 8170525Syongari# installworld - Install everything built by "buildworld". 9170525Syongari# world - buildworld + installworld. 10170525Syongari# buildkernel - Rebuild the kernel and the kernel-modules. 11170525Syongari# installkernel - Install the kernel and the kernel-modules. 12170525Syongari# reinstallkernel - Reinstall the kernel and the kernel-modules. 13170525Syongari# kernel - buildkernel + installkernel. 14170525Syongari# update - Convenient way to update your source tree (cvs). 15170525Syongari# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 16170525Syongari# most - Build user commands, no libraries or include files. 17170525Syongari# installmost - Install user commands, no libraries or include files. 18170525Syongari# aout-to-elf - Upgrade an system from a.out to elf format (see below). 19170525Syongari# aout-to-elf-build - Build everything required to upgrade a system from 20170525Syongari# a.out to elf format (see below). 21170525Syongari# aout-to-elf-install - Install everything built by aout-to-elf-build (see 22170525Syongari# below). 23170525Syongari# move-aout-libs - Move the a.out libraries into an aout sub-directory 24170525Syongari# of each elf library sub-directory. 25170525Syongari# 26170525Syongari# This makefile is simple by design. The FreeBSD make automatically reads 27170525Syongari# the /usr/share/mk/sys.mk unless the -m argument is specified on the 28170525Syongari# command line. By keeping this makefile simple, it doesn't matter too 29170525Syongari# much how different the installed mk files are from those in the source 30170525Syongari# tree. This makefile executes a child make process, forcing it to use 31170525Syongari# the mk files from the source tree which are supposed to DTRT. 32170525Syongari# 33170525Syongari# The user-driven targets (as listed above) are implemented in Makefile.inc1. 34170525Syongari# 35170525Syongari# If you want to build your system from source be sure that /usr/obj has 36170525Syongari# at least 400MB of diskspace available. 37170525Syongari# 38170525Syongari# For individuals wanting to build from the sources currently on their 39170525Syongari# system, the simple instructions are: 40170525Syongari# 41170525Syongari# 1. `cd /usr/src' (or to the directory containing your source tree). 42170525Syongari# 2. `make world' 43170525Syongari# 44170525Syongari# For individuals wanting to upgrade their sources (even if only a 45170525Syongari# delta of a few days): 46170525Syongari# 47170525Syongari# 1. `cd /usr/src' (or to the directory containing your source tree). 48170525Syongari# 2. `make buildworld' 49170525Syongari# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 50170525Syongari# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 51170525Syongari# 5. `reboot' (in single user mode: boot -s from the loader prompt). 52170525Syongari# 6. `mergemaster -p' 53170525Syongari# 7. `make installworld' 54170525Syongari# 8. `mergemaster' 55170525Syongari# 9. `reboot' 56170525Syongari# 57170525Syongari# See src/UPDATING `COMMON ITEMS' for more complete information. 58170525Syongari# 59170525Syongari# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will 60170525Syongari# update the legacy support for aout. This includes all libraries, ld.so 61170525Syongari# and boot objects. This part of build should be regarded as 62170525Syongari# deprecated and you should _not_ expect to be able to do this past the 63170525Syongari# release of 4.0. You have exactly one major release to move entirely 64170525Syongari# to elf. 65170525Syongari# 66170525Syongari# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can 67170525Syongari# cross build world for other architectures using the buildworld target, 68170525Syongari# and once the world is built you can cross build a kernel using the 69170525Syongari# buildkernel target. 70170525Syongari# 71170525Syongari# ---------------------------------------------------------------------------- 72170525Syongari# 73170525Syongari# Upgrading an i386 system from a.out to elf format 74170525Syongari# 75170525Syongari# 76170525Syongari# The aout->elf transition build is performed by doing a `make upgrade' (or 77170525Syongari# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 78170525Syongari# by a `make aout-to-elf-install', depending on user preference. 79170525Syongari# You need to have at least 320 Mb of free space for the object tree. 80170525Syongari# 81170525Syongari# The upgrade process checks the installed release. If this is 3.0-CURRENT, 82170525Syongari# it is assumed that your kernel contains all the syscalls required by the 83170525Syongari# current sources. 84170525Syongari# 85170525Syongari# The upgrade procedure will stop and ask for confirmation to proceed 86170525Syongari# several times. On each occasion, you can type Ctrl-C to abort the 87170525Syongari# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 88170525Syongari# the confirmation steps. 89170525Syongari# 90170525Syongari# At the end of the upgrade procedure, /etc/objformat is created or 91170525Syongari# updated to contain OBJFORMAT=elf. From then on, you're elf by default. 92227908Smarius# 93170525Syongari# ---------------------------------------------------------------------------- 94170525Syongari# 95170525Syongari# 96170525Syongari# Define the user-driven targets. These are listed here in alphabetical 97170525Syongari# order, but that's not important. 98170525Syongari# 99170525SyongariTGTS= all all-man buildkernel buildworld checkdpadd clean \ 100221407Smarius cleandepend cleandir depend distribute distributeworld everything \ 101170525Syongari hierarchy install installcheck installkernel \ 102170525Syongari reinstallkernel installmost installworld libraries lint maninstall \ 103170525Syongari mk most obj objlink regress rerelease tags update 104170525Syongari 105170525SyongariBITGTS= files includes 106170525SyongariBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 107170525Syongari 108170525Syongari.ORDER: buildworld installworld 109170525Syongari.ORDER: buildworld distributeworld 110221407Smarius.ORDER: buildkernel installkernel 111221407Smarius.ORDER: buildkernel reinstallkernel 112221407Smarius 113221407SmariusPATH= /sbin:/bin:/usr/sbin:/usr/bin 114170525SyongariMAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 115170525Syongari 116170525Syongari# 117221407Smarius# Handle the user-driven targets, using the source relative mk files. 118221407Smarius# 119221407Smarius${TGTS} ${BITGTS}: upgrade_checks 120221407Smarius @cd ${.CURDIR}; \ 121221407Smarius ${MAKE} ${.TARGET} 122221407Smarius 123170525Syongari# Set a reasonable default 124170525Syongari.MAIN: all 125170525Syongari 126170525SyongariSTARTTIME!= LC_ALL=C date 127170525Syongari# 128170525Syongari# world 129170525Syongari# 130170525Syongari# Attempt to rebuild and reinstall *everything*, with reasonable chance of 131170525Syongari# success, regardless of how old your existing system is. 132170525Syongari# 133170525Syongariworld: upgrade_checks 134221407Smarius @echo "--------------------------------------------------------------" 135221407Smarius @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}" 136170525Syongari @echo "--------------------------------------------------------------" 137170525Syongari.if target(pre-world) 138170525Syongari @echo 139170525Syongari @echo "--------------------------------------------------------------" 140170525Syongari @echo ">>> Making 'pre-world' target" 141170525Syongari @echo "--------------------------------------------------------------" 142170525Syongari @cd ${.CURDIR}; ${MAKE} pre-world 143170525Syongari.endif 144170525Syongari @cd ${.CURDIR}; ${MAKE} buildworld 145170525Syongari @cd ${.CURDIR}; ${MAKE} -B installworld 146170525Syongari.if target(post-world) 147170525Syongari @echo 148170525Syongari @echo "--------------------------------------------------------------" 149170525Syongari @echo ">>> Making 'post-world' target" 150170525Syongari @echo "--------------------------------------------------------------" 151170525Syongari @cd ${.CURDIR}; ${MAKE} post-world 152170525Syongari.endif 153170525Syongari @echo 154170525Syongari @echo "--------------------------------------------------------------" 155170525Syongari @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 156170525Syongari @echo "--------------------------------------------------------------" 157170525Syongari 158170525Syongari# 159170525Syongari# kernel 160170525Syongari# 161170525Syongari# Short hand for `make buildkernel installkernel' 162170525Syongari# 163170525Syongarikernel: buildkernel installkernel 164221407Smarius 165170525Syongari# 166170525Syongari# Perform a few tests to determine if the installed tools are adequate 167170525Syongari# for building the world. These are for older systems (prior to 2.2.5). 168170525Syongari# 169170525Syongari# From 2.2.5 onwards, the installed tools will pass these upgrade tests, 170170525Syongari# so the normal make world is capable of doing what is required to update 171170525Syongari# the system to current. 172170525Syongari# 173170525Syongariupgrade_checks: 174170525Syongari @cd ${.CURDIR}; \ 175170525Syongari if ! make -m ${.CURDIR}/share/mk -Dnotdef test >/dev/null 2>&1; then \ 176170525Syongari make make; \ 177170525Syongari fi 178170525Syongari @cd ${.CURDIR}; \ 179170525Syongari if make -V .CURDIR:C/.// 2>&1 >/dev/null | \ 180170525Syongari grep -q "Unknown modifier 'C'"; then \ 181170525Syongari make make; \ 182170525Syongari fi 183170525Syongari 184170525Syongari# 185170525Syongari# A simple test target used as part of the test to see if make supports 186170525Syongari# the -m argument. Also test that make will only evaluate a conditional 187170525Syongari# as far as is necessary to determine its value. 188170525Syongari# 189170525Syongaritest: 190170525Syongari.if defined(notdef) 191170525Syongari.undef notdef 192170525Syongari.if defined(notdef) && ${notdef:U} 193170525Syongari.endif 194170525Syongari.endif 195170525Syongari 196170525Syongari# 197170525Syongari# Upgrade the installed make to the current version using the installed 198170525Syongari# headers, libraries and build tools. This is required on installed versions 199170525Syongari# prior to 2.2.5 in which the installed make doesn't support the -m argument. 200170525Syongari# 201170525Syongarimake: 202170525Syongari @echo 203170525Syongari @echo "--------------------------------------------------------------" 204170525Syongari @echo " Upgrading the installed make" 205170525Syongari @echo "--------------------------------------------------------------" 206170525Syongari @cd ${.CURDIR}/usr.bin/make; \ 207170525Syongari make obj && make depend && make all && make install 208170525Syongari 209170525Syongari# 210170525Syongari# Define the upgrade targets. These are listed here in alphabetical 211170525Syongari# order, but that's not important. 212170525Syongari# 213221407SmariusUPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 214221407Smarius move-aout-libs 215170525Syongari 216170525Syongari# 217170525Syongari# Handle the upgrade targets, using the source relative mk files. 218170525Syongari# 219170525Syongari 220170525Syongariupgrade: aout-to-elf 221170525Syongari 222170525Syongari${UPGRADE} : upgrade_checks 223170525Syongari @cd ${.CURDIR}; \ 224170525Syongari ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 225170525Syongari