Makefile revision 95730
157429Smarkm# 257429Smarkm# $FreeBSD: head/Makefile 95730 2002-04-29 15:22:01Z ru $ 357429Smarkm# 457429Smarkm# The user-driven targets are: 557429Smarkm# 660576Skris# buildworld - Rebuild *everything*, including glue to help do 765674Skris# upgrades. 865674Skris# installworld - Install everything built by "buildworld". 965674Skris# world - buildworld + installworld. 1065674Skris# buildkernel - Rebuild the kernel and the kernel-modules. 1165674Skris# installkernel - Install the kernel and the kernel-modules. 1257429Smarkm# reinstallkernel - Reinstall the kernel and the kernel-modules. 1357429Smarkm# kernel - buildkernel + installkernel. 1457429Smarkm# update - Convenient way to update your source tree (cvs). 1592559Sdes# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 1665674Skris# most - Build user commands, no libraries or include files. 1757429Smarkm# installmost - Install user commands, no libraries or include files. 1857429Smarkm# aout-to-elf - Upgrade an system from a.out to elf format (see below). 1976262Sgreen# aout-to-elf-build - Build everything required to upgrade a system from 2076262Sgreen# a.out to elf format (see below). 2176262Sgreen# aout-to-elf-install - Install everything built by aout-to-elf-build (see 2276262Sgreen# below). 2376262Sgreen# move-aout-libs - Move the a.out libraries into an aout sub-directory 2457429Smarkm# of each elf library sub-directory. 2560576Skris# 2676262Sgreen# This makefile is simple by design. The FreeBSD make automatically reads 2776262Sgreen# the /usr/share/mk/sys.mk unless the -m argument is specified on the 2876262Sgreen# command line. By keeping this makefile simple, it doesn't matter too 2957429Smarkm# much how different the installed mk files are from those in the source 3057429Smarkm# tree. This makefile executes a child make process, forcing it to use 3157429Smarkm# the mk files from the source tree which are supposed to DTRT. 3257429Smarkm# 3357429Smarkm# The user-driven targets (as listed above) are implemented in Makefile.inc1. 3457429Smarkm# 3557429Smarkm# For novices wanting to build from current sources, the simple instructions 3657429Smarkm# are: 3757429Smarkm# 3857429Smarkm# 1. Ensure that your /usr/obj directory has at least 260 Mb of free space. 3957429Smarkm# 2. `cd /usr/src' (or to the directory containing your source tree). 4057429Smarkm# 3. `make world' 4157429Smarkm# 4257429Smarkm# Be warned, this will update your installed system, except for configuration 4357429Smarkm# files in the /etc directory and for the kernel. You have to do those manually. 4457429Smarkm# 4557429Smarkm# If at first you're a little nervous about having a `make world' update 4657429Smarkm# your system, a `make buildworld' will build everything in the /usr/obj 4757429Smarkm# tree without touching your installed system. To be of any further use 4857429Smarkm# though, a `make installworld' is required. 4957429Smarkm# 5057429Smarkm# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will 5157429Smarkm# update the legacy support for aout. This includes all libraries, ld.so 5257429Smarkm# and boot objects. This part of build should be regarded as 5357429Smarkm# deprecated and you should _not_ expect to be able to do this past the 5457429Smarkm# release of 4.0. You have exactly one major release to move entirely 5557429Smarkm# to elf. 5657429Smarkm# 5757429Smarkm# ---------------------------------------------------------------------------- 5857429Smarkm# 5957429Smarkm# Upgrading an i386 system from a.out to elf format 6057429Smarkm# 6157429Smarkm# 6257429Smarkm# The aout->elf transition build is performed by doing a `make upgrade' (or 6357429Smarkm# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 6457429Smarkm# by a `make aout-to-elf-install', depending on user preference. 6557429Smarkm# You need to have at least 320 Mb of free space for the object tree. 6657429Smarkm# 6757429Smarkm# The upgrade process checks the installed release. If this is 3.0-CURRENT, 6857429Smarkm# it is assumed that your kernel contains all the syscalls required by the 6957429Smarkm# current sources. 7057429Smarkm# 7157429Smarkm# The upgrade procedure will stop and ask for confirmation to proceed 7257429Smarkm# several times. On each occasion, you can type Ctrl-C to abort the 7357429Smarkm# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 7457429Smarkm# the confirmation steps. 7557429Smarkm# 7657429Smarkm# At the end of the upgrade procedure, /etc/objformat is created or 7757429Smarkm# updated to contain OBJFORMAT=elf. From then on, you're elf by default. 7876262Sgreen# 7957429Smarkm# ---------------------------------------------------------------------------- 8057429Smarkm# 8157429Smarkm# 8257429Smarkm# Define the user-driven targets. These are listed here in alphabetical 8357429Smarkm# order, but that's not important. 8457429Smarkm# 8557429SmarkmTGTS= all all-man buildkernel buildworld checkdpadd clean \ 8657429Smarkm cleandepend cleandir depend distribute distribworld everything \ 8757429Smarkm hierarchy includes install installcheck installkernel \ 8857429Smarkm reinstallkernel installmost installworld libraries lint \ 8957429Smarkm mk most obj objlink regress rerelease tags update 9057429Smarkm 9157429Smarkm.ORDER: buildworld installworld 9257429Smarkm.ORDER: buildworld distribworld 9357429Smarkm.ORDER: buildkernel installkernel 9457429Smarkm.ORDER: buildkernel reinstallkernel 9557429Smarkm 9657429SmarkmPATH= /sbin:/bin:/usr/sbin:/usr/bin 9757429SmarkmMAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 9857429Smarkm 9976262Sgreen# 10073400Sassar# Handle the user-driven targets, using the source relative mk files. 10173400Sassar# 10292559Sdes${TGTS}: upgrade_checks 10392559Sdes @cd ${.CURDIR}; \ 10492559Sdes ${MAKE} ${.TARGET} 10592559Sdes 10657429Smarkm# Set a reasonable default 10792559Sdes.MAIN: all 10857429Smarkm 10957429SmarkmSTARTTIME!= LC_ALL=C date 11057429Smarkm# 11157429Smarkm# world 11257429Smarkm# 11376262Sgreen# Attempt to rebuild and reinstall *everything*, with reasonable chance of 11476262Sgreen# success, regardless of how old your existing system is. 11576262Sgreen# 11676262Sgreenworld: upgrade_checks 11776262Sgreen @echo "--------------------------------------------------------------" 11892559Sdes @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}" 11992559Sdes @echo "--------------------------------------------------------------" 12057429Smarkm.if target(pre-world) 12157429Smarkm @echo 12257429Smarkm @echo "--------------------------------------------------------------" 12357429Smarkm @echo ">>> Making 'pre-world' target" 12457429Smarkm @echo "--------------------------------------------------------------" 12557429Smarkm @cd ${.CURDIR}; ${MAKE} pre-world 12657429Smarkm.endif 12757429Smarkm @cd ${.CURDIR}; ${MAKE} buildworld 12857429Smarkm @cd ${.CURDIR}; ${MAKE} -B installworld 12957429Smarkm.if target(post-world) 13065674Skris @echo 13157429Smarkm @echo "--------------------------------------------------------------" 13257429Smarkm @echo ">>> Making 'post-world' target" 13357429Smarkm @echo "--------------------------------------------------------------" 13457429Smarkm @cd ${.CURDIR}; ${MAKE} post-world 13569591Sgreen.endif 13669591Sgreen @echo 13757429Smarkm @echo "--------------------------------------------------------------" 13876262Sgreen @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 13976262Sgreen @echo "--------------------------------------------------------------" 14076262Sgreen 14176262Sgreen# 14276262Sgreen# kernel 14376262Sgreen# 14476262Sgreen# Short hand for `make buildkernel installkernel' 14573400Sassar# 14673400Sassarkernel: buildkernel installkernel 14792559Sdes 14892559Sdes# 14992559Sdes# Perform a few tests to determine if the installed tools are adequate 15092559Sdes# for building the world. These are for older systems (prior to 2.2.5). 15157429Smarkm# 15257429Smarkm# From 2.2.5 onwards, the installed tools will pass these upgrade tests, 15357429Smarkm# so the normal make world is capable of doing what is required to update 15457429Smarkm# the system to current. 15557429Smarkm# 15657429Smarkmupgrade_checks: 15776262Sgreen @cd ${.CURDIR}; \ 15857429Smarkm if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \ 15976262Sgreen make make; \ 16057429Smarkm fi 16157429Smarkm @cd ${.CURDIR}; \ 16257429Smarkm if make -V .CURDIR:C/.// 2>&1 >/dev/null | \ 16360576Skris grep -q "Unknown modifier 'C'"; then \ 16476262Sgreen make make; \ 16560576Skris fi 16657429Smarkm 16757429Smarkm# 16857429Smarkm# A simple test target used as part of the test to see if make supports 16957429Smarkm# the -m argument. 17057429Smarkm# 17157429Smarkmtest: 17292559Sdes 17360576Skris# 17492559Sdes# Upgrade the installed make to the current version using the installed 17557429Smarkm# headers, libraries and build tools. This is required on installed versions 17657429Smarkm# prior to 2.2.5 in which the installed make doesn't support the -m argument. 17757429Smarkm# 17857429Smarkmmake: 17957429Smarkm @echo 18057429Smarkm @echo "--------------------------------------------------------------" 18157429Smarkm @echo " Upgrading the installed make" 18257429Smarkm @echo "--------------------------------------------------------------" 18357429Smarkm @cd ${.CURDIR}/usr.bin/make; \ 18476262Sgreen make obj && make depend && make all && make install 18576262Sgreen 18676262Sgreen# 18792559Sdes# Define the upgrade targets. These are listed here in alphabetical 18892559Sdes# order, but that's not important. 18992559Sdes# 19092559SdesUPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 19192559Sdes move-aout-libs 19257429Smarkm 19357429Smarkm# 19457429Smarkm# Handle the upgrade targets, using the source relative mk files. 19557429Smarkm# 19657429Smarkm 19757429Smarkmupgrade: aout-to-elf 19857429Smarkm 19960576Skris${UPGRADE} : upgrade_checks 20057429Smarkm @cd ${.CURDIR}; \ 20157429Smarkm ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 20257429Smarkm