Makefile revision 68987
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 68987 2000-11-21 04:37:30Z marcel $
32061Sjkh#
438666Sjb# The user-driven targets are:
532427Sjb#
638666Sjb# buildworld          - Rebuild *everything*, including glue to help do
738666Sjb#                       upgrades.
838666Sjb# installworld        - Install everything built by "buildworld".
938666Sjb# world               - buildworld + installworld.
1064049Salex# buildkernel         - Rebuild the kernel and the kernel-modules.
1164049Salex# installkernel       - Install the kernel and the kernel-modules.
1266071Smarkm# reinstallkernel     - Reinstall the kernel and the kernel-modules.
1338666Sjb# update              - Convenient way to update your source tree (cvs).
1444918Sjkh# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
1538666Sjb# most                - Build user commands, no libraries or include files.
1638666Sjb# installmost         - Install user commands, no libraries or include files.
1738666Sjb# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1838666Sjb# aout-to-elf-build   - Build everything required to upgrade a system from
1938666Sjb#                       a.out to elf format (see below).
2038666Sjb# aout-to-elf-install - Install everything built by aout-to-elf-build (see
2138666Sjb#                       below).
2238978Sjb# move-aout-libs      - Move the a.out libraries into an aout sub-directory
2338978Sjb#                       of each elf library sub-directory.
2432427Sjb#
2538666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
2638666Sjb# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
2738666Sjb# command line. By keeping this makefile simple, it doesn't matter too
2838666Sjb# much how different the installed mk files are from those in the source
2938666Sjb# tree. This makefile executes a child make process, forcing it to use
3038666Sjb# the mk files from the source tree which are supposed to DTRT.
3117308Speter#
3238666Sjb# The user-driven targets (as listed above) are implemented in Makefile.inc0
3338666Sjb# and the private targets are in Makefile.inc1. These are kept separate
3438666Sjb# to help the bootstrap build from aout to elf format.
3519175Sbde#
3638666Sjb# For novices wanting to build from current sources, the simple instructions
3738666Sjb# are:
3838042Sbde#
3939726Sjb# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
4038666Sjb# 2.  `cd /usr/src'  (or to the directory containing your source tree).
4138666Sjb# 3.  `make world'
4238042Sbde#
4338666Sjb# Be warned, this will update your installed system, except for configuration
4449315Shoek# files in the /etc directory and for the kernel. You have to do those manually.
4517308Speter#
4638666Sjb# If at first you're a little nervous about having a `make world' update
4738666Sjb# your system, a `make buildworld' will build everything in the /usr/obj
4838666Sjb# tree without touching your installed system. To be of any further use
4938666Sjb# though, a `make installworld' is required.
5017308Speter#
5145108Sobrien# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
5242128Speter# update the legacy support for aout. This includes all libraries, ld.so
5342128Speter# and boot objects. This part of build should be regarded as
5438666Sjb# deprecated and you should _not_ expect to be able to do this past the
5551361Sjb# release of 4.0. You have exactly one major release to move entirely
5638666Sjb# to elf.
5717308Speter#
5838666Sjb# ----------------------------------------------------------------------------
5917308Speter#
6038666Sjb#           Upgrading an i386 system from a.out to elf format
6117308Speter#
6227910Sasami#
6343226Sjkh# The aout->elf transition build is performed by doing a `make upgrade' (or
6443226Sjkh# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
6543226Sjkh# by a `make aout-to-elf-install', depending on user preference.
6638666Sjb# You need to have at least 320 Mb of free space for the object tree.
6727910Sasami#
6838666Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT,
6938666Sjb# it is assumed that your kernel contains all the syscalls required by the
7038666Sjb# current sources.
7127910Sasami#
7238666Sjb# The upgrade procedure will stop and ask for confirmation to proceed
7338666Sjb# several times. On each occasion, you can type Ctrl-C to abort the
7443226Sjkh# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
7543226Sjkh# the confirmation steps.
7627910Sasami#
7738666Sjb# At the end of the upgrade procedure, /etc/objformat is created or
7838666Sjb# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
7927910Sasami#
8038666Sjb# ----------------------------------------------------------------------------
8127910Sasami#
8217308Speter#
8338666Sjb# Define the user-driven targets. These are listed here in alphabetical
8438666Sjb# order, but that's not important.
8517308Speter#
8655678SmarcelTGTS=	afterdistribute all buildkernel buildworld checkdpadd clean \
8768987Smarcel	cleandepend cleandir depend distribute distribworld everything \
8868987Smarcel	hierarchy includes install installkernel reinstallkernel installmost \
8968987Smarcel	installworld libraries lint maninstall mk most obj objlink regress \
9068987Smarcel	rerelease tags update
912061Sjkh
9255026SmarcelPATH=	/sbin:/bin:/usr/sbin:/usr/bin
9355026SmarcelMAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
9454324Smarcel
9517308Speter#
9638666Sjb# Handle the user-driven targets, using the source relative mk files.
9717308Speter#
9855678Smarcel${TGTS}: upgrade_checks
9938666Sjb	@cd ${.CURDIR}; \
10054324Smarcel		${MAKE} ${.TARGET}
1012302Spaul
10239206Sjkh# Set a reasonable default
10339206Sjkh.MAIN:	all
10439206Sjkh
10517308Speter#
10654324Smarcel# world
10754324Smarcel#
10854324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of
10954324Smarcel# success, regardless of how old your existing system is.
11054324Smarcel#
11154324Smarcelworld: upgrade_checks
11254324Smarcel	@echo "--------------------------------------------------------------"
11368428Sjkh	@echo ">>> ${OBJFORMAT} make world started on `LC_TIME=C date`"
11454324Smarcel	@echo "--------------------------------------------------------------"
11554324Smarcel.if target(pre-world)
11654324Smarcel	@echo
11754324Smarcel	@echo "--------------------------------------------------------------"
11854324Smarcel	@echo ">>> Making 'pre-world' target"
11954324Smarcel	@echo "--------------------------------------------------------------"
12054324Smarcel	@cd ${.CURDIR}; ${MAKE} pre-world
12154324Smarcel.endif
12254324Smarcel	@cd ${.CURDIR}; ${MAKE} buildworld
12354324Smarcel	@cd ${.CURDIR}; ${MAKE} -B installworld
12454324Smarcel.if target(post-world)
12554324Smarcel	@echo
12654324Smarcel	@echo "--------------------------------------------------------------"
12754324Smarcel	@echo ">>> Making 'post-world' target"
12854324Smarcel	@echo "--------------------------------------------------------------"
12954324Smarcel	@cd ${.CURDIR}; ${MAKE} post-world
13054324Smarcel.endif
13154324Smarcel	@echo
13254324Smarcel	@echo "--------------------------------------------------------------"
13354324Smarcel	@echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
13454324Smarcel	@echo "--------------------------------------------------------------"
13554324Smarcel
13654324Smarcel#
13738666Sjb# Perform a few tests to determine if the installed tools are adequate
13838666Sjb# for building the world. These are for older systems (prior to 2.2.5).
13917308Speter#
14038666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
14138666Sjb# so the normal make world is capable of doing what is required to update
14238666Sjb# the system to current.
14317308Speter#
14455678Smarcelupgrade_checks:
14555678Smarcel	@cd ${.CURDIR}; \
14655678Smarcel		if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
14755678Smarcel			make make; \
14855678Smarcel		fi
1492061Sjkh
15017308Speter#
15138666Sjb# A simple test target used as part of the test to see if make supports
15238666Sjb# the -m argument.
15317308Speter#
15455678Smarceltest:
1553626Swollman
15617308Speter#
15755678Smarcel# Upgrade the installed make to the current version using the installed
15855678Smarcel# headers, libraries and build tools. This is required on installed versions
15955678Smarcel# prior to 2.2.5 in which the installed make doesn't support the -m argument.
16055678Smarcel#
16155678Smarcelmake:
16255678Smarcel	@echo
16355678Smarcel	@echo "--------------------------------------------------------------"
16455678Smarcel	@echo " Upgrading the installed make"
16555678Smarcel	@echo "--------------------------------------------------------------"
16655678Smarcel	@cd ${.CURDIR}/usr.bin/make; \
16755678Smarcel		make obj && make depend && make all && make install
16855678Smarcel
16955678Smarcel#
17038666Sjb# Define the upgrade targets. These are listed here in alphabetical
17138666Sjb# order, but that's not important.
17217308Speter#
17355678SmarcelUPGRADE=	aout-to-elf aout-to-elf-build aout-to-elf-install \
17438978Sjb		move-aout-libs
1753626Swollman
17617308Speter#
17738666Sjb# Handle the upgrade targets, using the source relative mk files.
17817308Speter#
17943226Sjkh
18043226Sjkhupgrade:	aout-to-elf
18143226Sjkh
18238666Sjb${UPGRADE} : upgrade_checks
18338666Sjb	@cd ${.CURDIR}; \
18444103Smsmith		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
185