Makefile revision 100401
12061Sjkh# 250479Speter# $FreeBSD: head/Makefile 100401 2002-07-20 10:00:10Z ru $ 32061Sjkh# 438666Sjb# The user-driven targets are: 532427Sjb# 638666Sjb# buildworld - Rebuild *everything*, including glue to help do 738666Sjb# upgrades. 838666Sjb# installworld - Install everything built by "buildworld". 938666Sjb# world - buildworld + installworld. 1064049Salex# buildkernel - Rebuild the kernel and the kernel-modules. 1164049Salex# installkernel - Install the kernel and the kernel-modules. 1266071Smarkm# reinstallkernel - Reinstall the kernel and the kernel-modules. 1373504Sobrien# kernel - buildkernel + installkernel. 1438666Sjb# update - Convenient way to update your source tree (cvs). 1544918Sjkh# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 1638666Sjb# most - Build user commands, no libraries or include files. 1738666Sjb# installmost - Install user commands, no libraries or include files. 1838666Sjb# aout-to-elf - Upgrade an system from a.out to elf format (see below). 1938666Sjb# aout-to-elf-build - Build everything required to upgrade a system from 2038666Sjb# a.out to elf format (see below). 2138666Sjb# aout-to-elf-install - Install everything built by aout-to-elf-build (see 2238666Sjb# below). 2338978Sjb# move-aout-libs - Move the a.out libraries into an aout sub-directory 2438978Sjb# of each elf library sub-directory. 2532427Sjb# 2638666Sjb# This makefile is simple by design. The FreeBSD make automatically reads 2738666Sjb# the /usr/share/mk/sys.mk unless the -m argument is specified on the 2838666Sjb# command line. By keeping this makefile simple, it doesn't matter too 2938666Sjb# much how different the installed mk files are from those in the source 3038666Sjb# tree. This makefile executes a child make process, forcing it to use 3138666Sjb# the mk files from the source tree which are supposed to DTRT. 3217308Speter# 3391606Skeramida# The user-driven targets (as listed above) are implemented in Makefile.inc1. 3419175Sbde# 3596205Sjwd# If you want to build your system from source be sure that /usr/obj has 3696205Sjwd# at least 400MB of diskspace available. 3738042Sbde# 3896205Sjwd# For individuals wanting to build from the sources currently on their 3996205Sjwd# system, the simple instructions are: 4038042Sbde# 4196205Sjwd# 1. `cd /usr/src' (or to the directory containing your source tree). 4296205Sjwd# 2. `make world' 4317308Speter# 4496205Sjwd# For individuals wanting to upgrade their sources (even if only a 4596205Sjwd# delta of a few days): 4617308Speter# 4796205Sjwd# 1. `cd /usr/src' (or to the directory containing your source tree). 4896205Sjwd# 2. `make buildworld' 4996205Sjwd# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 5096205Sjwd# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC). 5196205Sjwd# 5. `reboot' (in single user mode: boot -s from the loader prompt). 5296205Sjwd# 6. `mergemaster -p' 5396205Sjwd# 7. `make installworld' 5496205Sjwd# 8. `mergemaster' 5596205Sjwd# 9. `reboot' 5696205Sjwd# 5796205Sjwd# See src/UPDATING `COMMON ITEMS' for more complete information. 5896205Sjwd# 5945108Sobrien# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will 6042128Speter# update the legacy support for aout. This includes all libraries, ld.so 6142128Speter# and boot objects. This part of build should be regarded as 6238666Sjb# deprecated and you should _not_ expect to be able to do this past the 6351361Sjb# release of 4.0. You have exactly one major release to move entirely 6438666Sjb# to elf. 6517308Speter# 6698775Sdillon# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can 6798723Sdillon# cross build world for other architectures using the buildworld target, 6898723Sdillon# and once the world is built you can cross build a kernel using the 6998723Sdillon# buildkernel target. 7098723Sdillon# 7138666Sjb# ---------------------------------------------------------------------------- 7217308Speter# 7338666Sjb# Upgrading an i386 system from a.out to elf format 7417308Speter# 7527910Sasami# 7643226Sjkh# The aout->elf transition build is performed by doing a `make upgrade' (or 7743226Sjkh# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 7843226Sjkh# by a `make aout-to-elf-install', depending on user preference. 7938666Sjb# You need to have at least 320 Mb of free space for the object tree. 8027910Sasami# 8138666Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT, 8238666Sjb# it is assumed that your kernel contains all the syscalls required by the 8338666Sjb# current sources. 8427910Sasami# 8538666Sjb# The upgrade procedure will stop and ask for confirmation to proceed 8638666Sjb# several times. On each occasion, you can type Ctrl-C to abort the 8743226Sjkh# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 8843226Sjkh# the confirmation steps. 8927910Sasami# 9038666Sjb# At the end of the upgrade procedure, /etc/objformat is created or 9138666Sjb# updated to contain OBJFORMAT=elf. From then on, you're elf by default. 9227910Sasami# 9338666Sjb# ---------------------------------------------------------------------------- 9427910Sasami# 9517308Speter# 9638666Sjb# Define the user-driven targets. These are listed here in alphabetical 9738666Sjb# order, but that's not important. 9817308Speter# 9995509SruTGTS= all all-man buildkernel buildworld checkdpadd clean \ 10095793Sru cleandepend cleandir depend distribute distributeworld everything \ 10197252Sru hierarchy install installcheck installkernel \ 10296164Sru reinstallkernel installmost installworld libraries lint maninstall \ 10395146Sgshapiro mk most obj objlink regress rerelease tags update 1042061Sjkh 10597769SruBITGTS= files includes 10697252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 10797252Sru 10895730Sru.ORDER: buildworld installworld 10995793Sru.ORDER: buildworld distributeworld 11095730Sru.ORDER: buildkernel installkernel 11195730Sru.ORDER: buildkernel reinstallkernel 11295730Sru 11355026SmarcelPATH= /sbin:/bin:/usr/sbin:/usr/bin 11455026SmarcelMAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 11554324Smarcel 11617308Speter# 11738666Sjb# Handle the user-driven targets, using the source relative mk files. 11817308Speter# 11997252Sru${TGTS} ${BITGTS}: upgrade_checks 12038666Sjb @cd ${.CURDIR}; \ 12154324Smarcel ${MAKE} ${.TARGET} 1222302Spaul 12339206Sjkh# Set a reasonable default 12439206Sjkh.MAIN: all 12539206Sjkh 12673349SruSTARTTIME!= LC_ALL=C date 12717308Speter# 12854324Smarcel# world 12954324Smarcel# 13054324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of 13154324Smarcel# success, regardless of how old your existing system is. 13254324Smarcel# 13354324Smarcelworld: upgrade_checks 13454324Smarcel @echo "--------------------------------------------------------------" 13569659Sobrien @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}" 13654324Smarcel @echo "--------------------------------------------------------------" 13754324Smarcel.if target(pre-world) 13854324Smarcel @echo 13954324Smarcel @echo "--------------------------------------------------------------" 14054324Smarcel @echo ">>> Making 'pre-world' target" 14154324Smarcel @echo "--------------------------------------------------------------" 14254324Smarcel @cd ${.CURDIR}; ${MAKE} pre-world 14354324Smarcel.endif 14454324Smarcel @cd ${.CURDIR}; ${MAKE} buildworld 14554324Smarcel @cd ${.CURDIR}; ${MAKE} -B installworld 14654324Smarcel.if target(post-world) 14754324Smarcel @echo 14854324Smarcel @echo "--------------------------------------------------------------" 14954324Smarcel @echo ">>> Making 'post-world' target" 15054324Smarcel @echo "--------------------------------------------------------------" 15154324Smarcel @cd ${.CURDIR}; ${MAKE} post-world 15254324Smarcel.endif 15354324Smarcel @echo 15454324Smarcel @echo "--------------------------------------------------------------" 15597536Sobrien @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 15654324Smarcel @echo "--------------------------------------------------------------" 15754324Smarcel 15854324Smarcel# 15995730Sru# kernel 16095730Sru# 16195730Sru# Short hand for `make buildkernel installkernel' 16295730Sru# 16395730Srukernel: buildkernel installkernel 16495730Sru 16595730Sru# 16638666Sjb# Perform a few tests to determine if the installed tools are adequate 16738666Sjb# for building the world. These are for older systems (prior to 2.2.5). 16817308Speter# 16938666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests, 17038666Sjb# so the normal make world is capable of doing what is required to update 17138666Sjb# the system to current. 17217308Speter# 17355678Smarcelupgrade_checks: 17455678Smarcel @cd ${.CURDIR}; \ 175100401Sru if ! make -m ${.CURDIR}/share/mk -Dnotdef test >/dev/null 2>&1; then \ 17655678Smarcel make make; \ 17755678Smarcel fi 17890395Sru @cd ${.CURDIR}; \ 17990395Sru if make -V .CURDIR:C/.// 2>&1 >/dev/null | \ 18090395Sru grep -q "Unknown modifier 'C'"; then \ 18190395Sru make make; \ 18290395Sru fi 1832061Sjkh 18417308Speter# 18538666Sjb# A simple test target used as part of the test to see if make supports 186100401Sru# the -m argument. Also test that make will only evaluate a conditional 187100401Sru# as far as is necessary to determine its value. 18817308Speter# 18955678Smarceltest: 190100401Sru.if defined(notdef) 191100401Sru.undef notdef 192100401Sru.if defined(notdef) && ${notdef:U} 193100401Sru.endif 194100401Sru.endif 1953626Swollman 19617308Speter# 19755678Smarcel# Upgrade the installed make to the current version using the installed 19855678Smarcel# headers, libraries and build tools. This is required on installed versions 19955678Smarcel# prior to 2.2.5 in which the installed make doesn't support the -m argument. 20055678Smarcel# 20155678Smarcelmake: 20255678Smarcel @echo 20355678Smarcel @echo "--------------------------------------------------------------" 20455678Smarcel @echo " Upgrading the installed make" 20555678Smarcel @echo "--------------------------------------------------------------" 20655678Smarcel @cd ${.CURDIR}/usr.bin/make; \ 20755678Smarcel make obj && make depend && make all && make install 20855678Smarcel 20955678Smarcel# 21038666Sjb# Define the upgrade targets. These are listed here in alphabetical 21138666Sjb# order, but that's not important. 21217308Speter# 21355678SmarcelUPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 21438978Sjb move-aout-libs 2153626Swollman 21617308Speter# 21738666Sjb# Handle the upgrade targets, using the source relative mk files. 21817308Speter# 21943226Sjkh 22043226Sjkhupgrade: aout-to-elf 22143226Sjkh 22238666Sjb${UPGRADE} : upgrade_checks 22338666Sjb @cd ${.CURDIR}; \ 22444103Smsmith ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 225