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. 1011fb97daSJohn Birrell# update - Convenient way to update your source tree (cvs). 117785c4f2SJordan K. Hubbard# upgrade - Upgrade a.out (2.2.x/3.0) system to the new ELF way 1211fb97daSJohn Birrell# most - Build user commands, no libraries or include files. 1311fb97daSJohn Birrell# installmost - Install user commands, no libraries or include files. 1411fb97daSJohn Birrell# aout-to-elf - Upgrade an system from a.out to elf format (see below). 1511fb97daSJohn Birrell# aout-to-elf-build - Build everything required to upgrade a system from 1611fb97daSJohn Birrell# a.out to elf format (see below). 1711fb97daSJohn Birrell# aout-to-elf-install - Install everything built by aout-to-elf-build (see 1811fb97daSJohn Birrell# below). 192b0dadddSJohn Birrell# move-aout-libs - Move the a.out libraries into an aout sub-directory 202b0dadddSJohn Birrell# of each elf library sub-directory. 213540f0e1SJordan K. Hubbard# 2211fb97daSJohn Birrell# This makefile is simple by design. The FreeBSD make automatically reads 2311fb97daSJohn Birrell# the /usr/share/mk/sys.mk unless the -m argument is specified on the 2411fb97daSJohn Birrell# command line. By keeping this makefile simple, it doesn't matter too 2511fb97daSJohn Birrell# much how different the installed mk files are from those in the source 2611fb97daSJohn Birrell# tree. This makefile executes a child make process, forcing it to use 2711fb97daSJohn Birrell# the mk files from the source tree which are supposed to DTRT. 2811fb97daSJohn Birrell# 2911fb97daSJohn Birrell# The user-driven targets (as listed above) are implemented in Makefile.inc0 3011fb97daSJohn Birrell# and the private targets are in Makefile.inc1. These are kept separate 3111fb97daSJohn Birrell# to help the bootstrap build from aout to elf format. 3211fb97daSJohn Birrell# 3311fb97daSJohn Birrell# For novices wanting to build from current sources, the simple instructions 3411fb97daSJohn Birrell# are: 3511fb97daSJohn Birrell# 36cd486f4dSJohn Birrell# 1. Ensure that your /usr/obj directory has at least 260 Mb of free space. 3711fb97daSJohn Birrell# 2. `cd /usr/src' (or to the directory containing your source tree). 3811fb97daSJohn Birrell# 3. `make world' 3911fb97daSJohn Birrell# 4011fb97daSJohn Birrell# Be warned, this will update your installed system, except for configuration 41e74ce1d5STim Vanderhoek# files in the /etc directory and for the kernel. You have to do those manually. 4211fb97daSJohn Birrell# 4311fb97daSJohn Birrell# If at first you're a little nervous about having a `make world' update 4411fb97daSJohn Birrell# your system, a `make buildworld' will build everything in the /usr/obj 4511fb97daSJohn Birrell# tree without touching your installed system. To be of any further use 4611fb97daSJohn Birrell# though, a `make installworld' is required. 4711fb97daSJohn Birrell# 48990cbc64SDavid E. O'Brien# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will 4941da0323SPeter Wemm# update the legacy support for aout. This includes all libraries, ld.so 5041da0323SPeter Wemm# and boot objects. This part of build should be regarded as 5111fb97daSJohn Birrell# deprecated and you should _not_ expect to be able to do this past the 521379f879SJohn Birrell# release of 4.0. You have exactly one major release to move entirely 5311fb97daSJohn Birrell# to elf. 5411fb97daSJohn Birrell# 5511fb97daSJohn Birrell# ---------------------------------------------------------------------------- 5611fb97daSJohn Birrell# 5711fb97daSJohn Birrell# Upgrading an i386 system from a.out to elf format 5811fb97daSJohn Birrell# 5911fb97daSJohn Birrell# 601c67f883SJordan K. Hubbard# The aout->elf transition build is performed by doing a `make upgrade' (or 611c67f883SJordan K. Hubbard# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed 621c67f883SJordan K. Hubbard# by a `make aout-to-elf-install', depending on user preference. 6311fb97daSJohn Birrell# You need to have at least 320 Mb of free space for the object tree. 6411fb97daSJohn Birrell# 6511fb97daSJohn Birrell# The upgrade process checks the installed release. If this is 3.0-CURRENT, 6611fb97daSJohn Birrell# it is assumed that your kernel contains all the syscalls required by the 6711fb97daSJohn Birrell# current sources. 6811fb97daSJohn Birrell# 6911fb97daSJohn Birrell# The upgrade procedure will stop and ask for confirmation to proceed 7011fb97daSJohn Birrell# several times. On each occasion, you can type Ctrl-C to abort the 711c67f883SJordan K. Hubbard# upgrade. Optionally, you can also start it with NOCONFIRM=yes and skip 721c67f883SJordan K. Hubbard# the confirmation steps. 7311fb97daSJohn Birrell# 7411fb97daSJohn Birrell# At the end of the upgrade procedure, /etc/objformat is created or 7511fb97daSJohn Birrell# updated to contain OBJFORMAT=elf. From then on, you're elf by default. 7611fb97daSJohn Birrell# 7711fb97daSJohn Birrell# ---------------------------------------------------------------------------- 7811fb97daSJohn Birrell# 7911fb97daSJohn Birrell# 8011fb97daSJohn Birrell# Define the user-driven targets. These are listed here in alphabetical 8111fb97daSJohn Birrell# order, but that's not important. 8211fb97daSJohn Birrell# 83549f978aSMarcel MoolenaarTGTS= afterdistribute all buildkernel buildworld checkdpadd clean \ 84549f978aSMarcel Moolenaar cleandepend cleandir depend distribute everything hierarchy includes \ 85549f978aSMarcel Moolenaar install installkernel installmost installworld lint maninstall mk \ 86549f978aSMarcel Moolenaar most obj objlink regress rerelease tags update 876e59a256SMarcel Moolenaar 883e3a3133SMarcel MoolenaarPATH= /sbin:/bin:/usr/sbin:/usr/bin 893e3a3133SMarcel MoolenaarMAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1 90a962de47SPeter Wemm 91a962de47SPeter Wemm# 9211fb97daSJohn Birrell# Handle the user-driven targets, using the source relative mk files. 93f3c4dd0dSBruce Evans# 9411fb97daSJohn Birrell${TGTS}: upgrade_checks 9511fb97daSJohn Birrell @cd ${.CURDIR}; \ 966e59a256SMarcel Moolenaar ${MAKE} ${.TARGET} 97c3d9b0f0SRodney W. Grimes 98ce53af53SJordan K. Hubbard# Set a reasonable default 99ce53af53SJordan K. Hubbard.MAIN: all 100ce53af53SJordan K. Hubbard 1016e59a256SMarcel MoolenaarSTARTTIME!= LC_TIME=C date 1026e59a256SMarcel Moolenaar# 1036e59a256SMarcel Moolenaar# world 1046e59a256SMarcel Moolenaar# 1056e59a256SMarcel Moolenaar# Attempt to rebuild and reinstall *everything*, with reasonable chance of 1066e59a256SMarcel Moolenaar# success, regardless of how old your existing system is. 1076e59a256SMarcel Moolenaar# 1086e59a256SMarcel Moolenaarworld: upgrade_checks 1096e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1106e59a256SMarcel Moolenaar @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}" 1116e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1126e59a256SMarcel Moolenaar.if target(pre-world) 1136e59a256SMarcel Moolenaar @echo 1146e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1156e59a256SMarcel Moolenaar @echo ">>> Making 'pre-world' target" 1166e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1176e59a256SMarcel Moolenaar @cd ${.CURDIR}; ${MAKE} pre-world 1186e59a256SMarcel Moolenaar.endif 1196e59a256SMarcel Moolenaar @cd ${.CURDIR}; ${MAKE} buildworld 1206e59a256SMarcel Moolenaar @cd ${.CURDIR}; ${MAKE} -B installworld 1216e59a256SMarcel Moolenaar.if target(post-world) 1226e59a256SMarcel Moolenaar @echo 1236e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1246e59a256SMarcel Moolenaar @echo ">>> Making 'post-world' target" 1256e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1266e59a256SMarcel Moolenaar @cd ${.CURDIR}; ${MAKE} post-world 1276e59a256SMarcel Moolenaar.endif 1286e59a256SMarcel Moolenaar @echo 1296e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1306e59a256SMarcel Moolenaar @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}" 1316e59a256SMarcel Moolenaar @echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`" 1326e59a256SMarcel Moolenaar @echo "--------------------------------------------------------------" 1336e59a256SMarcel Moolenaar 134cf94fb21SBruce Evans# 13511fb97daSJohn Birrell# Perform a few tests to determine if the installed tools are adequate 13611fb97daSJohn Birrell# for building the world. These are for older systems (prior to 2.2.5). 137cf94fb21SBruce Evans# 13811fb97daSJohn Birrell# From 2.2.5 onwards, the installed tools will pass these upgrade tests, 13911fb97daSJohn Birrell# so the normal make world is capable of doing what is required to update 14011fb97daSJohn Birrell# the system to current. 14111fb97daSJohn Birrell# 14211fb97daSJohn Birrellupgrade_checks: 143549f978aSMarcel Moolenaar @cd ${.CURDIR}; \ 144549f978aSMarcel Moolenaar if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \ 145549f978aSMarcel Moolenaar make make; \ 146549f978aSMarcel Moolenaar fi 147a42830afSAndrey A. Chernov 148a962de47SPeter Wemm# 14911fb97daSJohn Birrell# A simple test target used as part of the test to see if make supports 15011fb97daSJohn Birrell# the -m argument. 151a962de47SPeter Wemm# 15211fb97daSJohn Birrelltest: 1536a8d432dSMark Murray 154a962de47SPeter Wemm# 155549f978aSMarcel Moolenaar# Upgrade the installed make to the current version using the installed 156549f978aSMarcel Moolenaar# headers, libraries and build tools. This is required on installed versions 157549f978aSMarcel Moolenaar# prior to 2.2.5 in which the installed make doesn't support the -m argument. 158549f978aSMarcel Moolenaar# 159549f978aSMarcel Moolenaarmake: 160549f978aSMarcel Moolenaar @echo 161549f978aSMarcel Moolenaar @echo "--------------------------------------------------------------" 162549f978aSMarcel Moolenaar @echo " Upgrading the installed make" 163549f978aSMarcel Moolenaar @echo "--------------------------------------------------------------" 164549f978aSMarcel Moolenaar @cd ${.CURDIR}/usr.bin/make; \ 165549f978aSMarcel Moolenaar make obj && make depend && make all && make install 166549f978aSMarcel Moolenaar 167549f978aSMarcel Moolenaar# 16811fb97daSJohn Birrell# Define the upgrade targets. These are listed here in alphabetical 16911fb97daSJohn Birrell# order, but that's not important. 170a962de47SPeter Wemm# 1712b0dadddSJohn BirrellUPGRADE= aout-to-elf aout-to-elf-build aout-to-elf-install \ 1722b0dadddSJohn Birrell move-aout-libs 1732799473bSSatoshi Asami 1742799473bSSatoshi Asami# 17511fb97daSJohn Birrell# Handle the upgrade targets, using the source relative mk files. 1762799473bSSatoshi Asami# 1771c67f883SJordan K. Hubbard 1781c67f883SJordan K. Hubbardupgrade: aout-to-elf 1791c67f883SJordan K. Hubbard 18011fb97daSJohn Birrell${UPGRADE} : upgrade_checks 18111fb97daSJohn Birrell @cd ${.CURDIR}; \ 1828bc83b23SMike Smith ${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET} 183