Makefile revision 73504
10Sduke#
212721Smgerdin# $FreeBSD: head/Makefile 73504 2001-03-04 10:43:14Z obrien $
30Sduke#
40Sduke# The user-driven targets are:
50Sduke#
60Sduke# buildworld          - Rebuild *everything*, including glue to help do
70Sduke#                       upgrades.
80Sduke# installworld        - Install everything built by "buildworld".
90Sduke# world               - buildworld + installworld.
100Sduke# buildkernel         - Rebuild the kernel and the kernel-modules.
110Sduke# installkernel       - Install the kernel and the kernel-modules.
120Sduke# reinstallkernel     - Reinstall the kernel and the kernel-modules.
130Sduke# kernel              - buildkernel + installkernel.
140Sduke# update              - Convenient way to update your source tree (cvs).
150Sduke# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
160Sduke# most                - Build user commands, no libraries or include files.
170Sduke# installmost         - Install user commands, no libraries or include files.
180Sduke# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
191472Strims# aout-to-elf-build   - Build everything required to upgrade a system from
201472Strims#                       a.out to elf format (see below).
211472Strims# aout-to-elf-install - Install everything built by aout-to-elf-build (see
220Sduke#                       below).
230Sduke# move-aout-libs      - Move the a.out libraries into an aout sub-directory
240Sduke#                       of each elf library sub-directory.
251879Sstefank#
268629Saph# This makefile is simple by design. The FreeBSD make automatically reads
278629Saph# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
288629Saph# command line. By keeping this makefile simple, it doesn't matter too
293883Stwisti# much how different the installed mk files are from those in the source
303883Stwisti# tree. This makefile executes a child make process, forcing it to use
311879Sstefank# the mk files from the source tree which are supposed to DTRT.
321879Sstefank#
331879Sstefank# The user-driven targets (as listed above) are implemented in Makefile.inc0
341879Sstefank# and the private targets are in Makefile.inc1. These are kept separate
3511205Srehn# to help the bootstrap build from aout to elf format.
3610762Sjprovino#
373602Scoleenp# For novices wanting to build from current sources, the simple instructions
381879Sstefank# are:
391879Sstefank#
4013249Sstefank# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
4113249Sstefank# 2.  `cd /usr/src'  (or to the directory containing your source tree).
421879Sstefank# 3.  `make world'
431879Sstefank#
441879Sstefank# Be warned, this will update your installed system, except for configuration
451879Sstefank# files in the /etc directory and for the kernel. You have to do those manually.
461879Sstefank#
471879Sstefank# If at first you're a little nervous about having a `make world' update
481879Sstefank# your system, a `make buildworld' will build everything in the /usr/obj
499111Stwisti# tree without touching your installed system. To be of any further use
509111Stwisti# though, a `make installworld' is required.
519111Stwisti#
520Sduke# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
532515Snever# update the legacy support for aout. This includes all libraries, ld.so
540Sduke# and boot objects. This part of build should be regarded as
55524Sxlu# deprecated and you should _not_ expect to be able to do this past the
56524Sxlu# release of 4.0. You have exactly one major release to move entirely
570Sduke# to elf.
580Sduke#
590Sduke# ----------------------------------------------------------------------------
600Sduke#
610Sduke#           Upgrading an i386 system from a.out to elf format
620Sduke#
630Sduke#
640Sduke# The aout->elf transition build is performed by doing a `make upgrade' (or
650Sduke# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
660Sduke# by a `make aout-to-elf-install', depending on user preference.
670Sduke# You need to have at least 320 Mb of free space for the object tree.
680Sduke#
690Sduke# The upgrade process checks the installed release. If this is 3.0-CURRENT,
700Sduke# it is assumed that your kernel contains all the syscalls required by the
710Sduke# current sources.
720Sduke#
730Sduke# The upgrade procedure will stop and ask for confirmation to proceed
740Sduke# several times. On each occasion, you can type Ctrl-C to abort the
750Sduke# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
760Sduke# the confirmation steps.
770Sduke#
789450Siveresov# At the end of the upgrade procedure, /etc/objformat is created or
799450Siveresov# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
809450Siveresov#
819450Siveresov# ----------------------------------------------------------------------------
820Sduke#
839450Siveresov#
848965Smcberg# Define the user-driven targets. These are listed here in alphabetical
850Sduke# order, but that's not important.
860Sduke#
879450SiveresovTGTS=	afterdistribute all buildkernel buildworld checkdpadd clean \
880Sduke	cleandepend cleandir depend distribute distribworld everything \
890Sduke	hierarchy includes install installkernel kernel reinstallkernel \
909450Siveresov	installmost installworld libraries lint maninstall mk most obj \
919450Siveresov	objlink regress rerelease tags update
929450Siveresov
939450SiveresovPATH=	/sbin:/bin:/usr/sbin:/usr/bin
949450SiveresovMAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
959450Siveresov
969450Siveresov#
978965Smcberg# Handle the user-driven targets, using the source relative mk files.
988965Smcberg#
999450Siveresov${TGTS}: upgrade_checks
1008965Smcberg	@cd ${.CURDIR}; \
1010Sduke		${MAKE} ${.TARGET}
1020Sduke
1030Sduke# Set a reasonable default
1040Sduke.MAIN:	all
1050Sduke
1060SdukeSTARTTIME!= LC_ALL=C date
1070Sduke#
1080Sduke# world
1090Sduke#
1100Sduke# Attempt to rebuild and reinstall *everything*, with reasonable chance of
1110Sduke# success, regardless of how old your existing system is.
1120Sduke#
1130Sdukeworld: upgrade_checks
1140Sduke	@echo "--------------------------------------------------------------"
1150Sduke	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
1160Sduke	@echo "--------------------------------------------------------------"
1170Sduke.if target(pre-world)
1180Sduke	@echo
1190Sduke	@echo "--------------------------------------------------------------"
1200Sduke	@echo ">>> Making 'pre-world' target"
1210Sduke	@echo "--------------------------------------------------------------"
1220Sduke	@cd ${.CURDIR}; ${MAKE} pre-world
1230Sduke.endif
1240Sduke	@cd ${.CURDIR}; ${MAKE} buildworld
1250Sduke	@cd ${.CURDIR}; ${MAKE} -B installworld
1260Sduke.if target(post-world)
1270Sduke	@echo
1280Sduke	@echo "--------------------------------------------------------------"
1290Sduke	@echo ">>> Making 'post-world' target"
1303668Skvn	@echo "--------------------------------------------------------------"
1313668Skvn	@cd ${.CURDIR}; ${MAKE} post-world
1320Sduke.endif
1330Sduke	@echo
1340Sduke	@echo "--------------------------------------------------------------"
1350Sduke	@printf ">>> ${OBJFORMAT} make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
1360Sduke	@echo "--------------------------------------------------------------"
1370Sduke
138304Snever#
1390Sduke# Perform a few tests to determine if the installed tools are adequate
1400Sduke# for building the world. These are for older systems (prior to 2.2.5).
1410Sduke#
1420Sduke# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
1430Sduke# so the normal make world is capable of doing what is required to update
1440Sduke# the system to current.
1450Sduke#
1460Sdukeupgrade_checks:
1470Sduke	@cd ${.CURDIR}; \
1483668Skvn		if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
1498965Smcberg			make make; \
1508965Smcberg		fi
1518965Smcberg
1528965Smcberg#
1538379Skvn# A simple test target used as part of the test to see if make supports
1549111Stwisti# the -m argument.
1553668Skvn#
15613064Svdeshpandetest:
15713064Svdeshpande
1583668Skvn#
1593668Skvn# Upgrade the installed make to the current version using the installed
1609111Stwisti# headers, libraries and build tools. This is required on installed versions
1613668Skvn# prior to 2.2.5 in which the installed make doesn't support the -m argument.
1620Sduke#
1639450Siveresovmake:
16413244Sstefank	@echo
1650Sduke	@echo "--------------------------------------------------------------"
1660Sduke	@echo " Upgrading the installed make"
1670Sduke	@echo "--------------------------------------------------------------"
1680Sduke	@cd ${.CURDIR}/usr.bin/make; \
1690Sduke		make obj && make depend && make all && make install
1700Sduke
1710Sduke#
1720Sduke# Define the upgrade targets. These are listed here in alphabetical
1730Sduke# order, but that's not important.
1740Sduke#
1750SdukeUPGRADE=	aout-to-elf aout-to-elf-build aout-to-elf-install \
1760Sduke		move-aout-libs
1770Sduke
1780Sduke#
1793668Skvn# Handle the upgrade targets, using the source relative mk files.
1808965Smcberg#
1819450Siveresov
18210072Sthartmannupgrade:	aout-to-elf
1839450Siveresov
1849450Siveresov${UPGRADE} : upgrade_checks
18510435Smikael	@cd ${.CURDIR}; \
1869450Siveresov		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
1879450Siveresov