Makefile revision 103436
12061Sjkh# 250479Speter# $FreeBSD: head/Makefile 103436 2002-09-17 01:49:00Z peter $ 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# 5998775Sdillon# If TARGET_ARCH=arch (e.g. ia64, sparc64, ...) is specified you can 6098723Sdillon# cross build world for other architectures using the buildworld target, 6198723Sdillon# and once the world is built you can cross build a kernel using the 6298723Sdillon# buildkernel target. 6398723Sdillon# 6438666Sjb# ---------------------------------------------------------------------------- 6517308Speter# 6638666Sjb# Upgrading an i386 system from a.out to elf format 6717308Speter# 6827910Sasami# 6943226Sjkh# The aout->elf transition build is performed by doing a `make upgrade' (or 7043226Sjkh# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 7143226Sjkh# by a `make aout-to-elf-install', depending on user preference. 7238666Sjb# You need to have at least 320 Mb of free space for the object tree. 7327910Sasami# 7438666Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT, 7538666Sjb# it is assumed that your kernel contains all the syscalls required by the 7638666Sjb# current sources. 7727910Sasami# 7838666Sjb# The upgrade procedure will stop and ask for confirmation to proceed 7938666Sjb# several times. On each occasion, you can type Ctrl-C to abort the 8043226Sjkh# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 8143226Sjkh# the confirmation steps. 8227910Sasami# 8338666Sjb# ---------------------------------------------------------------------------- 8427910Sasami# 8517308Speter# 8638666Sjb# Define the user-driven targets. These are listed here in alphabetical 8738666Sjb# order, but that's not important. 8817308Speter# 8995509SruTGTS= all all-man buildkernel buildworld checkdpadd clean \ 9095793Sru cleandepend cleandir depend distribute distributeworld everything \ 9197252Sru hierarchy install installcheck installkernel \ 9296164Sru reinstallkernel installmost installworld libraries lint maninstall \ 9395146Sgshapiro mk most obj objlink regress rerelease tags update 942061Sjkh 9597769SruBITGTS= files includes 9697252SruBITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/} 9797252Sru 9895730Sru.ORDER: buildworld installworld 9995793Sru.ORDER: buildworld distributeworld 10095730Sru.ORDER: buildkernel installkernel 10195730Sru.ORDER: buildkernel reinstallkernel 10295730Sru 10355026SmarcelPATH= /sbin:/bin:/usr/sbin:/usr/bin 10455026SmarcelMAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 10554324Smarcel 10617308Speter# 10738666Sjb# Handle the user-driven targets, using the source relative mk files. 10817308Speter# 10997252Sru${TGTS} ${BITGTS}: upgrade_checks 11038666Sjb @cd ${.CURDIR}; \ 11154324Smarcel ${MAKE} ${.TARGET} 1122302Spaul 11339206Sjkh# Set a reasonable default 11439206Sjkh.MAIN: all 11539206Sjkh 11673349SruSTARTTIME!= LC_ALL=C date 11717308Speter# 11854324Smarcel# world 11954324Smarcel# 12054324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of 12154324Smarcel# success, regardless of how old your existing system is. 12254324Smarcel# 12354324Smarcelworld: upgrade_checks 12454324Smarcel @echo "--------------------------------------------------------------" 125103436Speter @echo ">>> elf make world started on ${STARTTIME}" 12654324Smarcel @echo "--------------------------------------------------------------" 12754324Smarcel.if target(pre-world) 12854324Smarcel @echo 12954324Smarcel @echo "--------------------------------------------------------------" 13054324Smarcel @echo ">>> Making 'pre-world' target" 13154324Smarcel @echo "--------------------------------------------------------------" 13254324Smarcel @cd ${.CURDIR}; ${MAKE} pre-world 13354324Smarcel.endif 13454324Smarcel @cd ${.CURDIR}; ${MAKE} buildworld 13554324Smarcel @cd ${.CURDIR}; ${MAKE} -B installworld 13654324Smarcel.if target(post-world) 13754324Smarcel @echo 13854324Smarcel @echo "--------------------------------------------------------------" 13954324Smarcel @echo ">>> Making 'post-world' target" 14054324Smarcel @echo "--------------------------------------------------------------" 14154324Smarcel @cd ${.CURDIR}; ${MAKE} post-world 14254324Smarcel.endif 14354324Smarcel @echo 14454324Smarcel @echo "--------------------------------------------------------------" 145103436Speter @printf ">>> elf make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 14654324Smarcel @echo "--------------------------------------------------------------" 14754324Smarcel 14854324Smarcel# 14995730Sru# kernel 15095730Sru# 15195730Sru# Short hand for `make buildkernel installkernel' 15295730Sru# 15395730Srukernel: buildkernel installkernel 15495730Sru 15595730Sru# 15638666Sjb# Perform a few tests to determine if the installed tools are adequate 15738666Sjb# for building the world. These are for older systems (prior to 2.2.5). 15817308Speter# 15938666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests, 16038666Sjb# so the normal make world is capable of doing what is required to update 16138666Sjb# the system to current. 16217308Speter# 16355678Smarcelupgrade_checks: 16455678Smarcel @cd ${.CURDIR}; \ 165100402Sru if ! make -m ${.CURDIR}/share/mk -Dnotdef test >/dev/null 2>&1; then \ 166100402Sru make make; \ 167100402Sru fi 16890395Sru @cd ${.CURDIR}; \ 169100402Sru if make -V .CURDIR:C/.// 2>&1 >/dev/null | \ 170100402Sru grep -q "Unknown modifier 'C'"; then \ 171100402Sru make make; \ 172100402Sru fi 1732061Sjkh 17417308Speter# 17538666Sjb# A simple test target used as part of the test to see if make supports 176100401Sru# the -m argument. Also test that make will only evaluate a conditional 177100401Sru# as far as is necessary to determine its value. 17817308Speter# 17955678Smarceltest: 180100401Sru.if defined(notdef) 181100401Sru.undef notdef 182100401Sru.if defined(notdef) && ${notdef:U} 183100401Sru.endif 184100401Sru.endif 1853626Swollman 18617308Speter# 18755678Smarcel# Upgrade the installed make to the current version using the installed 18855678Smarcel# headers, libraries and build tools. This is required on installed versions 18955678Smarcel# prior to 2.2.5 in which the installed make doesn't support the -m argument. 19055678Smarcel# 19155678Smarcelmake: 19255678Smarcel @echo 19355678Smarcel @echo "--------------------------------------------------------------" 19455678Smarcel @echo " Upgrading the installed make" 19555678Smarcel @echo "--------------------------------------------------------------" 19655678Smarcel @cd ${.CURDIR}/usr.bin/make; \ 197102692Speter make obj && make -D_UPGRADING depend && \ 198102692Speter make -D_UPGRADING all && make install 19955678Smarcel 20055678Smarcel# 20138666Sjb# Define the upgrade targets. These are listed here in alphabetical 20238666Sjb# order, but that's not important. 20317308Speter# 20455678SmarcelUPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 20538978Sjb move-aout-libs 2063626Swollman 20717308Speter# 20838666Sjb# Handle the upgrade targets, using the source relative mk files. 20917308Speter# 21043226Sjkh 21143226Sjkhupgrade: aout-to-elf 21243226Sjkh 21338666Sjb${UPGRADE} : upgrade_checks 21438666Sjb @cd ${.CURDIR}; \ 21544103Smsmith ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 216