Makefile revision 79471
1184610Salfred# 2184610Salfred# $FreeBSD: head/Makefile 74842 2001-03-27 08:43:28Z ru $ 3184610Salfred# 4184610Salfred# The user-driven targets are: 5184610Salfred# 6184610Salfred# buildworld - Rebuild *everything*, including glue to help do 7184610Salfred# upgrades. 8184610Salfred# installworld - Install everything built by "buildworld". 9184610Salfred# world - buildworld + installworld. 10184610Salfred# buildkernel - Rebuild the kernel and the kernel-modules. 11184610Salfred# installkernel - Install the kernel and the kernel-modules. 12184610Salfred# reinstallkernel - Reinstall the kernel and the kernel-modules. 13184610Salfred# kernel - buildkernel + installkernel. 14184610Salfred# update - Convenient way to update your source tree (cvs). 15184610Salfred# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 16184610Salfred# most - Build user commands, no libraries or include files. 17184610Salfred# installmost - Install user commands, no libraries or include files. 18184610Salfred# aout-to-elf - Upgrade an system from a.out to elf format (see below). 19184610Salfred# aout-to-elf-build - Build everything required to upgrade a system from 20184610Salfred# a.out to elf format (see below). 21184610Salfred# aout-to-elf-install - Install everything built by aout-to-elf-build (see 22184610Salfred# below). 23184610Salfred# move-aout-libs - Move the a.out libraries into an aout sub-directory 24184610Salfred# of each elf library sub-directory. 25184610Salfred# 26184610Salfred# This makefile is simple by design. The FreeBSD make automatically reads 27203815Swkoszek# the /usr/share/mk/sys.mk unless the -m argument is specified on the 28203815Swkoszek# command line. By keeping this makefile simple, it doesn't matter too 29184610Salfred# much how different the installed mk files are from those in the source 30184610Salfred# tree. This makefile executes a child make process, forcing it to use 31184610Salfred# the mk files from the source tree which are supposed to DTRT. 32184610Salfred# 33184610Salfred# The user-driven targets (as listed above) are implemented in Makefile.inc0 34184610Salfred# and the private targets are in Makefile.inc1. These are kept separate 35184610Salfred# to help the bootstrap build from aout to elf format. 36184610Salfred# 37184610Salfred# For novices wanting to build from current sources, the simple instructions 38184610Salfred# are: 39184610Salfred# 40184610Salfred# 1. Ensure that your /usr/obj directory has at least 260 Mb of free space. 41184610Salfred# 2. `cd /usr/src' (or to the directory containing your source tree). 42184610Salfred# 3. `make world' 43184610Salfred# 44229122Shselasky# Be warned, this will update your installed system, except for configuration 45229122Shselasky# files in the /etc directory and for the kernel. You have to do those manually. 46229122Shselasky# 47229122Shselasky# If at first you're a little nervous about having a `make world' update 48184610Salfred# your system, a `make buildworld' will build everything in the /usr/obj 49184610Salfred# tree without touching your installed system. To be of any further use 50184610Salfred# though, a `make installworld' is required. 51184610Salfred# 52184610Salfred# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will 53184610Salfred# update the legacy support for aout. This includes all libraries, ld.so 54184610Salfred# and boot objects. This part of build should be regarded as 55184610Salfred# deprecated and you should _not_ expect to be able to do this past the 56184610Salfred# release of 4.0. You have exactly one major release to move entirely 57184610Salfred# to elf. 58184610Salfred# 59184610Salfred# ---------------------------------------------------------------------------- 60184610Salfred# 61184610Salfred# Upgrading an i386 system from a.out to elf format 62184610Salfred# 63184610Salfred# 64184610Salfred# The aout->elf transition build is performed by doing a `make upgrade' (or 65184610Salfred# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 66184610Salfred# by a `make aout-to-elf-install', depending on user preference. 67184610Salfred# You need to have at least 320 Mb of free space for the object tree. 68184610Salfred# 69184610Salfred# The upgrade process checks the installed release. If this is 3.0-CURRENT, 70184610Salfred# it is assumed that your kernel contains all the syscalls required by the 71184610Salfred# current sources. 72235004Shselasky# 73184610Salfred# The upgrade procedure will stop and ask for confirmation to proceed 74184610Salfred# several times. On each occasion, you can type Ctrl-C to abort the 75184610Salfred# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 76184610Salfred# the confirmation steps. 77184610Salfred# 78184610Salfred# At the end of the upgrade procedure, /etc/objformat is created or 79184610Salfred# updated to contain OBJFORMAT=elf. From then on, you're elf by default. 80184610Salfred# 81184610Salfred# ---------------------------------------------------------------------------- 82184610Salfred# 83184610Salfred# 84184610Salfred# Define the user-driven targets. These are listed here in alphabetical 85235004Shselasky# order, but that's not important. 86184610Salfred# 87184610SalfredTGTS= afterdistribute all all-man buildkernel buildworld checkdpadd clean \ 88184610Salfred cleandepend cleandir depend distribute distribworld everything \ 89184610Salfred hierarchy includes install installkernel kernel reinstallkernel \ 90184610Salfred installmost installworld libraries lint maninstall mk most obj \ 91185087Salfred objlink regress rerelease tags update 92185087Salfred 93184610SalfredPATH= /sbin:/bin:/usr/sbin:/usr/bin 94184610SalfredMAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 95184610Salfred 96184610Salfred# 97184610Salfred# Handle the user-driven targets, using the source relative mk files. 98184610Salfred# 99184610Salfred${TGTS}: upgrade_checks 100184610Salfred @cd ${.CURDIR}; \ 101184610Salfred ${MAKE} ${.TARGET} 102184610Salfred 103184610Salfred# Set a reasonable default 104184610Salfred.MAIN: all 105184610Salfred 106184610SalfredSTARTTIME!= LC_ALL=C date 107184610Salfred# 108184610Salfred# world 109184610Salfred# 110184610Salfred# Attempt to rebuild and reinstall *everything*, with reasonable chance of 111184610Salfred# success, regardless of how old your existing system is. 112184610Salfred# 113184610Salfredworld: upgrade_checks 114184610Salfred @echo "--------------------------------------------------------------" 115184610Salfred @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}" 116184610Salfred @echo "--------------------------------------------------------------" 117184610Salfred.if target(pre-world) 118184610Salfred @echo 119184610Salfred @echo "--------------------------------------------------------------" 120184610Salfred @echo ">>> Making 'pre-world' target" 121184610Salfred @echo "--------------------------------------------------------------" 122184610Salfred @cd ${.CURDIR}; ${MAKE} pre-world 123184610Salfred.endif 124184610Salfred @cd ${.CURDIR}; ${MAKE} buildworld 125199055Sthompsa @cd ${.CURDIR}; ${MAKE} -B installworld 126199055Sthompsa.if target(post-world) 127199055Sthompsa @echo 128184610Salfred @echo "--------------------------------------------------------------" 129184610Salfred @echo ">>> Making 'post-world' target" 130184610Salfred @echo "--------------------------------------------------------------" 131184610Salfred @cd ${.CURDIR}; ${MAKE} post-world 132184610Salfred.endif 133184610Salfred @echo 134184610Salfred @echo "--------------------------------------------------------------" 135184610Salfred @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 136184610Salfred @echo "--------------------------------------------------------------" 137184610Salfred 138184610Salfred# 139184610Salfred# Perform a few tests to determine if the installed tools are adequate 140184610Salfred# for building the world. These are for older systems (prior to 2.2.5). 141184610Salfred# 142184610Salfred# From 2.2.5 onwards, the installed tools will pass these upgrade tests, 143184610Salfred# so the normal make world is capable of doing what is required to update 144184610Salfred# the system to current. 145184610Salfred# 146184610Salfredupgrade_checks: 147184610Salfred @cd ${.CURDIR}; \ 148184610Salfred if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \ 149184610Salfred make make; \ 150184610Salfred fi 151184610Salfred 152184610Salfred# 153184610Salfred# A simple test target used as part of the test to see if make supports 154184610Salfred# the -m argument. 155184610Salfred# 156184610Salfredtest: 157184610Salfred 158235004Shselasky# 159184610Salfred# Upgrade the installed make to the current version using the installed 160184610Salfred# headers, libraries and build tools. This is required on installed versions 161184610Salfred# prior to 2.2.5 in which the installed make doesn't support the -m argument. 162184610Salfred# 163184610Salfredmake: 164184610Salfred @echo 165184610Salfred @echo "--------------------------------------------------------------" 166184610Salfred @echo " Upgrading the installed make" 167184610Salfred @echo "--------------------------------------------------------------" 168184610Salfred @cd ${.CURDIR}/usr.bin/make; \ 169184610Salfred make obj && make depend && make all && make install 170184610Salfred 171184610Salfred# 172184610Salfred# Define the upgrade targets. These are listed here in alphabetical 173184610Salfred# order, but that's not important. 174184610Salfred# 175184610SalfredUPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 176184610Salfred move-aout-libs 177184610Salfred 178184610Salfred# 179184610Salfred# Handle the upgrade targets, using the source relative mk files. 180184610Salfred# 181184610Salfred 182184610Salfredupgrade: aout-to-elf 183184610Salfred 184184610Salfred${UPGRADE} : upgrade_checks 185184610Salfred @cd ${.CURDIR}; \ 186184610Salfred ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 187184610Salfred