13540f0e1SJordan K. Hubbard# 297d92980SPeter Wemm# $FreeBSD$ 3cf763a57SJohn Birrell# 411fb97daSJohn Birrell# The user-driven targets are: 5cf763a57SJohn Birrell# 611fb97daSJohn Birrell# buildworld - Rebuild *everything*, including glue to help do 711fb97daSJohn Birrell# upgrades. 811fb97daSJohn Birrell# installworld - Install everything built by "buildworld". 911fb97daSJohn Birrell# world - buildworld + installworld. 1000eb8cbdSAlexander Langer# buildkernel - Rebuild the kernel and the kernel-modules. 1100eb8cbdSAlexander Langer# installkernel - Install the kernel and the kernel-modules. 12737ffab7SMark Murray# reinstallkernel - Reinstall the kernel and the kernel-modules. 13bc4311beSDavid E. O'Brien# kernel - buildkernel + installkernel. 1411fb97daSJohn Birrell# update - Convenient way to update your source tree (cvs). 157785c4f2SJordan K. Hubbard# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 1611fb97daSJohn Birrell# most - Build user commands, no libraries or include files. 1711fb97daSJohn Birrell# installmost - Install user commands, no libraries or include files. 1811fb97daSJohn Birrell# aout-to-elf - Upgrade an system from a.out to elf format (see below). 1911fb97daSJohn Birrell# aout-to-elf-build - Build everything required to upgrade a system from 2011fb97daSJohn Birrell# a.out to elf format (see below). 2111fb97daSJohn Birrell# aout-to-elf-install - Install everything built by aout-to-elf-build (see 2211fb97daSJohn Birrell# below). 232b0dadddSJohn Birrell# move-aout-libs - Move the a.out libraries into an aout sub-directory 242b0dadddSJohn Birrell# of each elf library sub-directory. 253540f0e1SJordan K. Hubbard# 2611fb97daSJohn Birrell# This makefile is simple by design. The FreeBSD make automatically reads 2711fb97daSJohn Birrell# the /usr/share/mk/sys.mk unless the -m argument is specified on the 2811fb97daSJohn Birrell# command line. By keeping this makefile simple, it doesn't matter too 2911fb97daSJohn Birrell# much how different the installed mk files are from those in the source 3011fb97daSJohn Birrell# tree. This makefile executes a child make process, forcing it to use 3111fb97daSJohn Birrell# the mk files from the source tree which are supposed to DTRT. 3211fb97daSJohn Birrell# 33912422f0SGiorgos Keramidas# The user-driven targets (as listed above) are implemented in Makefile.inc1. 3411fb97daSJohn Birrell# 3511fb97daSJohn Birrell# For novices wanting to build from current sources, the simple instructions 3611fb97daSJohn Birrell# are: 3711fb97daSJohn Birrell# 38cd486f4dSJohn Birrell# 1. Ensure that your /usr/obj directory has at least 260 Mb of free space. 3911fb97daSJohn Birrell# 2. `cd /usr/src' (or to the directory containing your source tree). 4011fb97daSJohn Birrell# 3. `make world' 4111fb97daSJohn Birrell# 4211fb97daSJohn Birrell# Be warned, this will update your installed system, except for configuration 43e74ce1d5STim Vanderhoek# files in the /etc directory and for the kernel. You have to do those manually. 4411fb97daSJohn Birrell# 4511fb97daSJohn Birrell# If at first you're a little nervous about having a `make world' update 4611fb97daSJohn Birrell# your system, a `make buildworld' will build everything in the /usr/obj 4711fb97daSJohn Birrell# tree without touching your installed system. To be of any further use 4811fb97daSJohn Birrell# though, a `make installworld' is required. 4911fb97daSJohn Birrell# 50990cbc64SDavid E. O'Brien# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will 5141da0323SPeter Wemm# update the legacy support for aout. This includes all libraries, ld.so 5241da0323SPeter Wemm# and boot objects. This part of build should be regarded as 5311fb97daSJohn Birrell# deprecated and you should _not_ expect to be able to do this past the 541379f879SJohn Birrell# release of 4.0. You have exactly one major release to move entirely 5511fb97daSJohn Birrell# to elf. 5611fb97daSJohn Birrell# 5711fb97daSJohn Birrell# ---------------------------------------------------------------------------- 5811fb97daSJohn Birrell# 5911fb97daSJohn Birrell# Upgrading an i386 system from a.out to elf format 6011fb97daSJohn Birrell# 6111fb97daSJohn Birrell# 621c67f883SJordan K. Hubbard# The aout->elf transition build is performed by doing a `make upgrade' (or 631c67f883SJordan K. Hubbard# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 641c67f883SJordan K. Hubbard# by a `make aout-to-elf-install', depending on user preference. 6511fb97daSJohn Birrell# You need to have at least 320 Mb of free space for the object tree. 6611fb97daSJohn Birrell# 6711fb97daSJohn Birrell# The upgrade process checks the installed release. If this is 3.0-CURRENT, 6811fb97daSJohn Birrell# it is assumed that your kernel contains all the syscalls required by the 6911fb97daSJohn Birrell# current sources. 7011fb97daSJohn Birrell# 7111fb97daSJohn Birrell# The upgrade procedure will stop and ask for confirmation to proceed 7211fb97daSJohn Birrell# several times. On each occasion, you can type Ctrl-C to abort the 731c67f883SJordan K. Hubbard# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 741c67f883SJordan K. Hubbard# the confirmation steps. 7511fb97daSJohn Birrell# 7611fb97daSJohn Birrell# At the end of the upgrade procedure, /etc/objformat is created or 7711fb97daSJohn Birrell# updated to contain OBJFORMAT=elf. From then on, you're elf by default. 7811fb97daSJohn Birrell# 7911fb97daSJohn Birrell# ---------------------------------------------------------------------------- 8011fb97daSJohn Birrell# 8111fb97daSJohn Birrell# 8211fb97daSJohn Birrell# Define the user-driven targets. These are listed here in alphabetical 8311fb97daSJohn Birrell# order, but that's not important. 8411fb97daSJohn Birrell# 856bde859fSRuslan ErmilovTGTS= all all-man buildkernel buildworld checkdpadd clean \ 868f1f55e9SRuslan Ermilov cleandepend cleandir depend distribute distributeworld everything \ 87d672a609SRuslan Ermilov hierarchy includes install installcheck installkernel \ 88b25a566dSRuslan Ermilov reinstallkernel installmost installworld libraries lint \ 89b56f8802SGregory Neil Shapiro mk most obj objlink regress rerelease tags update 906e59a256SMarcel Moolenaar 91d672a609SRuslan Ermilov.ORDER: buildworld installworld 928f1f55e9SRuslan Ermilov.ORDER: buildworld distributeworld 93d672a609SRuslan Ermilov.ORDER: buildkernel installkernel 94d672a609SRuslan Ermilov.ORDER: buildkernel reinstallkernel 95d672a609SRuslan Ermilov 963e3a3133SMarcel MoolenaarPATH= /sbin:/bin:/usr/sbin:/usr/bin 973e3a3133SMarcel MoolenaarMAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 98a962de47SPeter Wemm 99a962de47SPeter Wemm# 10011fb97daSJohn Birrell# Handle the user-driven targets, using the source relative mk files. 101f3c4dd0dSBruce Evans# 10211fb97daSJohn Birrell${TGTS}: upgrade_checks 10311fb97daSJohn Birrell @cd ${.CURDIR}; \ 1046e59a256SMarcel Moolenaar ${MAKE} ${.TARGET} 105c3d9b0f0SRodney W. Grimes 106ce53af53SJordan K. Hubbard# Set a reasonable default 107ce53af53SJordan K. Hubbard.MAIN: all 108ce53af53SJordan K. Hubbard 109afcf05e4SRuslan ErmilovSTARTTIME!= LC_ALL=C date 1106e59a256SMarcel Moolenaar# 1116e59a256SMarcel Moolenaar# world 1126e59a256SMarcel Moolenaar# 1136e59a256SMarcel Moolenaar# Attempt to rebuild and reinstall *everything*, with reasonable chance of 1146e59a256SMarcel Moolenaar# success, regardless of how old your existing system is. 1156e59a256SMarcel Moolenaar# 1166e59a256SMarcel Moolenaarworld: upgrade_checks 1176e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 11859084d0cSDavid E. O'Brien @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}" 1196e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1206e59a256SMarcel Moolenaar.if target(pre-world) 1216e59a256SMarcel Moolenaar @echo 1226e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1236e59a256SMarcel Moolenaar @echo ">>> Making 'pre-world' target" 1246e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1256e59a256SMarcel Moolenaar @cd ${.CURDIR}; ${MAKE} pre-world 1266e59a256SMarcel Moolenaar.endif 1276e59a256SMarcel Moolenaar @cd ${.CURDIR}; ${MAKE} buildworld 1286e59a256SMarcel Moolenaar @cd ${.CURDIR}; ${MAKE} -B installworld 1296e59a256SMarcel Moolenaar.if target(post-world) 1306e59a256SMarcel Moolenaar @echo 1316e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1326e59a256SMarcel Moolenaar @echo ">>> Making 'post-world' target" 1336e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1346e59a256SMarcel Moolenaar @cd ${.CURDIR}; ${MAKE} post-world 1356e59a256SMarcel Moolenaar.endif 1366e59a256SMarcel Moolenaar @echo 1376e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 138afcf05e4SRuslan Ermilov @printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n" 1396e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1406e59a256SMarcel Moolenaar 141cf94fb21SBruce Evans# 142d672a609SRuslan Ermilov# kernel 143d672a609SRuslan Ermilov# 144d672a609SRuslan Ermilov# Short hand for `make buildkernel installkernel' 145d672a609SRuslan Ermilov# 146d672a609SRuslan Ermilovkernel: buildkernel installkernel 147d672a609SRuslan Ermilov 148d672a609SRuslan Ermilov# 14911fb97daSJohn Birrell# Perform a few tests to determine if the installed tools are adequate 15011fb97daSJohn Birrell# for building the world. These are for older systems (prior to 2.2.5). 151cf94fb21SBruce Evans# 15211fb97daSJohn Birrell# From 2.2.5 onwards, the installed tools will pass these upgrade tests, 15311fb97daSJohn Birrell# so the normal make world is capable of doing what is required to update 15411fb97daSJohn Birrell# the system to current. 15511fb97daSJohn Birrell# 15611fb97daSJohn Birrellupgrade_checks: 157549f978aSMarcel Moolenaar @cd ${.CURDIR}; \ 158549f978aSMarcel Moolenaar if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \ 159549f978aSMarcel Moolenaar make make; \ 160549f978aSMarcel Moolenaar fi 161ceeb1caaSRuslan Ermilov @cd ${.CURDIR}; \ 162ceeb1caaSRuslan Ermilov if make -V .CURDIR:C/.// 2>&1 >/dev/null | \ 163ceeb1caaSRuslan Ermilov grep -q "Unknown modifier 'C'"; then \ 164ceeb1caaSRuslan Ermilov make make; \ 165ceeb1caaSRuslan Ermilov fi 166a42830afSAndrey A. Chernov 167a962de47SPeter Wemm# 16811fb97daSJohn Birrell# A simple test target used as part of the test to see if make supports 16911fb97daSJohn Birrell# the -m argument. 170a962de47SPeter Wemm# 17111fb97daSJohn Birrelltest: 1726a8d432dSMark Murray 173a962de47SPeter Wemm# 174549f978aSMarcel Moolenaar# Upgrade the installed make to the current version using the installed 175549f978aSMarcel Moolenaar# headers, libraries and build tools. This is required on installed versions 176549f978aSMarcel Moolenaar# prior to 2.2.5 in which the installed make doesn't support the -m argument. 177549f978aSMarcel Moolenaar# 178549f978aSMarcel Moolenaarmake: 179549f978aSMarcel Moolenaar @echo 180549f978aSMarcel Moolenaar @echo "--------------------------------------------------------------" 181549f978aSMarcel Moolenaar @echo " Upgrading the installed make" 182549f978aSMarcel Moolenaar @echo "--------------------------------------------------------------" 183549f978aSMarcel Moolenaar @cd ${.CURDIR}/usr.bin/make; \ 184549f978aSMarcel Moolenaar make obj && make depend && make all && make install 185549f978aSMarcel Moolenaar 186549f978aSMarcel Moolenaar# 18711fb97daSJohn Birrell# Define the upgrade targets. These are listed here in alphabetical 18811fb97daSJohn Birrell# order, but that's not important. 189a962de47SPeter Wemm# 1902b0dadddSJohn BirrellUPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 1912b0dadddSJohn Birrell move-aout-libs 1922799473bSSatoshi Asami 1932799473bSSatoshi Asami# 19411fb97daSJohn Birrell# Handle the upgrade targets, using the source relative mk files. 1952799473bSSatoshi Asami# 1961c67f883SJordan K. Hubbard 1971c67f883SJordan K. Hubbardupgrade: aout-to-elf 1981c67f883SJordan K. Hubbard 19911fb97daSJohn Birrell${UPGRADE} : upgrade_checks 20011fb97daSJohn Birrell @cd ${.CURDIR}; \ 2018bc83b23SMike Smith ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 202