Makefile revision 54324
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 54324 1999-12-08 18:10:15Z 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.
1038666Sjb# update              - Convenient way to update your source tree (cvs).
1144918Sjkh# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
1238666Sjb# most                - Build user commands, no libraries or include files.
1338666Sjb# installmost         - Install user commands, no libraries or include files.
1438666Sjb# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1538666Sjb# aout-to-elf-build   - Build everything required to upgrade a system from
1638666Sjb#                       a.out to elf format (see below).
1738666Sjb# aout-to-elf-install - Install everything built by aout-to-elf-build (see
1838666Sjb#                       below).
1938978Sjb# move-aout-libs      - Move the a.out libraries into an aout sub-directory
2038978Sjb#                       of each elf library sub-directory.
2132427Sjb#
2238666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
2338666Sjb# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
2438666Sjb# command line. By keeping this makefile simple, it doesn't matter too
2538666Sjb# much how different the installed mk files are from those in the source
2638666Sjb# tree. This makefile executes a child make process, forcing it to use
2738666Sjb# the mk files from the source tree which are supposed to DTRT.
2817308Speter#
2938666Sjb# The user-driven targets (as listed above) are implemented in Makefile.inc0
3038666Sjb# and the private targets are in Makefile.inc1. These are kept separate
3138666Sjb# to help the bootstrap build from aout to elf format.
3219175Sbde#
3338666Sjb# For novices wanting to build from current sources, the simple instructions
3438666Sjb# are:
3538042Sbde#
3639726Sjb# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
3738666Sjb# 2.  `cd /usr/src'  (or to the directory containing your source tree).
3838666Sjb# 3.  `make world'
3938042Sbde#
4038666Sjb# Be warned, this will update your installed system, except for configuration
4149315Shoek# files in the /etc directory and for the kernel. You have to do those manually.
4217308Speter#
4338666Sjb# If at first you're a little nervous about having a `make world' update
4438666Sjb# your system, a `make buildworld' will build everything in the /usr/obj
4538666Sjb# tree without touching your installed system. To be of any further use
4638666Sjb# though, a `make installworld' is required.
4717308Speter#
4845108Sobrien# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
4942128Speter# update the legacy support for aout. This includes all libraries, ld.so
5042128Speter# and boot objects. This part of build should be regarded as
5138666Sjb# deprecated and you should _not_ expect to be able to do this past the
5251361Sjb# release of 4.0. You have exactly one major release to move entirely
5338666Sjb# to elf.
5417308Speter#
5538666Sjb# ----------------------------------------------------------------------------
5617308Speter#
5738666Sjb#           Upgrading an i386 system from a.out to elf format
5817308Speter#
5927910Sasami#
6043226Sjkh# The aout->elf transition build is performed by doing a `make upgrade' (or
6143226Sjkh# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
6243226Sjkh# by a `make aout-to-elf-install', depending on user preference.
6338666Sjb# You need to have at least 320 Mb of free space for the object tree.
6427910Sasami#
6538666Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT,
6638666Sjb# it is assumed that your kernel contains all the syscalls required by the
6738666Sjb# current sources.
6827910Sasami#
6938666Sjb# The upgrade procedure will stop and ask for confirmation to proceed
7038666Sjb# several times. On each occasion, you can type Ctrl-C to abort the
7143226Sjkh# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
7243226Sjkh# the confirmation steps.
7327910Sasami#
7438666Sjb# At the end of the upgrade procedure, /etc/objformat is created or
7538666Sjb# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
7627910Sasami#
7738666Sjb# ----------------------------------------------------------------------------
7827910Sasami#
7917308Speter#
8038666Sjb# Define the user-driven targets. These are listed here in alphabetical
8138666Sjb# order, but that's not important.
8217308Speter#
8340495SbdeTGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
8440495Sbde	depend distribute everything hierarchy includes install installmost \
8540495Sbde	installworld lint maninstall mk most obj objlink regress rerelease \
8654324Smarcel	tags update
872061Sjkh
8854324SmarcelMAKE=	make -m ${.CURDIR}/share/mk -f Makefile.inc1
8954324Smarcel
9017308Speter#
9138666Sjb# Handle the user-driven targets, using the source relative mk files.
9217308Speter#
9338666Sjb${TGTS} : upgrade_checks
9438666Sjb	@cd ${.CURDIR}; \
9554324Smarcel		${MAKE} ${.TARGET}
962302Spaul
9739206Sjkh# Set a reasonable default
9839206Sjkh.MAIN:	all
9939206Sjkh
10054324SmarcelSTARTTIME!= LC_TIME=C date
10117308Speter#
10254324Smarcel# world
10354324Smarcel#
10454324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of
10554324Smarcel# success, regardless of how old your existing system is.
10654324Smarcel#
10754324Smarcelworld: upgrade_checks
10854324Smarcel	@echo "--------------------------------------------------------------"
10954324Smarcel	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
11054324Smarcel	@echo "--------------------------------------------------------------"
11154324Smarcel.if target(pre-world)
11254324Smarcel	@echo
11354324Smarcel	@echo "--------------------------------------------------------------"
11454324Smarcel	@echo ">>> Making 'pre-world' target"
11554324Smarcel	@echo "--------------------------------------------------------------"
11654324Smarcel	@cd ${.CURDIR}; ${MAKE} pre-world
11754324Smarcel.endif
11854324Smarcel	@cd ${.CURDIR}; ${MAKE} buildworld
11954324Smarcel	@cd ${.CURDIR}; ${MAKE} -B installworld
12054324Smarcel.if target(post-world)
12154324Smarcel	@echo
12254324Smarcel	@echo "--------------------------------------------------------------"
12354324Smarcel	@echo ">>> Making 'post-world' target"
12454324Smarcel	@echo "--------------------------------------------------------------"
12554324Smarcel	@cd ${.CURDIR}; ${MAKE} post-world
12654324Smarcel.endif
12754324Smarcel	@echo
12854324Smarcel	@echo "--------------------------------------------------------------"
12954324Smarcel	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
13054324Smarcel	@echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
13154324Smarcel	@echo "--------------------------------------------------------------"
13254324Smarcel
13354324Smarcel#
13438666Sjb# Perform a few tests to determine if the installed tools are adequate
13538666Sjb# for building the world. These are for older systems (prior to 2.2.5).
13617308Speter#
13738666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
13838666Sjb# so the normal make world is capable of doing what is required to update
13938666Sjb# the system to current.
14017308Speter#
14138666Sjbupgrade_checks :
14244103Smsmith	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else ${MAKE} -f Makefile.upgrade make; fi;
1432061Sjkh
14417308Speter#
14538666Sjb# A simple test target used as part of the test to see if make supports
14638666Sjb# the -m argument.
14717308Speter#
14838666Sjbtest	:
1493626Swollman
15017308Speter#
15138666Sjb# Define the upgrade targets. These are listed here in alphabetical
15238666Sjb# order, but that's not important.
15317308Speter#
15438978SjbUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
15538978Sjb		move-aout-libs
1563626Swollman
15717308Speter#
15838666Sjb# Handle the upgrade targets, using the source relative mk files.
15917308Speter#
16043226Sjkh
16143226Sjkhupgrade:	aout-to-elf
16243226Sjkh
16338666Sjb${UPGRADE} : upgrade_checks
16438666Sjb	@cd ${.CURDIR}; \
16544103Smsmith		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
166