Makefile revision 55678
12061Sjkh#
250479Speter# $FreeBSD: head/Makefile 55678 2000-01-09 18:17:48Z 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#
8355678SmarcelTGTS=	afterdistribute all buildkernel buildworld checkdpadd clean \
8455678Smarcel	cleandepend cleandir depend distribute everything hierarchy includes \
8555678Smarcel	install installkernel installmost installworld lint maninstall mk \
8655678Smarcel	most obj objlink regress rerelease tags update
872061Sjkh
8855026SmarcelPATH=	/sbin:/bin:/usr/sbin:/usr/bin
8955026SmarcelMAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
9054324Smarcel
9117308Speter#
9238666Sjb# Handle the user-driven targets, using the source relative mk files.
9317308Speter#
9455678Smarcel${TGTS}: upgrade_checks
9538666Sjb	@cd ${.CURDIR}; \
9654324Smarcel		${MAKE} ${.TARGET}
972302Spaul
9839206Sjkh# Set a reasonable default
9939206Sjkh.MAIN:	all
10039206Sjkh
10154324SmarcelSTARTTIME!= LC_TIME=C date
10217308Speter#
10354324Smarcel# world
10454324Smarcel#
10554324Smarcel# Attempt to rebuild and reinstall *everything*, with reasonable chance of
10654324Smarcel# success, regardless of how old your existing system is.
10754324Smarcel#
10854324Smarcelworld: upgrade_checks
10954324Smarcel	@echo "--------------------------------------------------------------"
11054324Smarcel	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
11154324Smarcel	@echo "--------------------------------------------------------------"
11254324Smarcel.if target(pre-world)
11354324Smarcel	@echo
11454324Smarcel	@echo "--------------------------------------------------------------"
11554324Smarcel	@echo ">>> Making 'pre-world' target"
11654324Smarcel	@echo "--------------------------------------------------------------"
11754324Smarcel	@cd ${.CURDIR}; ${MAKE} pre-world
11854324Smarcel.endif
11954324Smarcel	@cd ${.CURDIR}; ${MAKE} buildworld
12054324Smarcel	@cd ${.CURDIR}; ${MAKE} -B installworld
12154324Smarcel.if target(post-world)
12254324Smarcel	@echo
12354324Smarcel	@echo "--------------------------------------------------------------"
12454324Smarcel	@echo ">>> Making 'post-world' target"
12554324Smarcel	@echo "--------------------------------------------------------------"
12654324Smarcel	@cd ${.CURDIR}; ${MAKE} post-world
12754324Smarcel.endif
12854324Smarcel	@echo
12954324Smarcel	@echo "--------------------------------------------------------------"
13054324Smarcel	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
13154324Smarcel	@echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
13254324Smarcel	@echo "--------------------------------------------------------------"
13354324Smarcel
13454324Smarcel#
13538666Sjb# Perform a few tests to determine if the installed tools are adequate
13638666Sjb# for building the world. These are for older systems (prior to 2.2.5).
13717308Speter#
13838666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
13938666Sjb# so the normal make world is capable of doing what is required to update
14038666Sjb# the system to current.
14117308Speter#
14255678Smarcelupgrade_checks:
14355678Smarcel	@cd ${.CURDIR}; \
14455678Smarcel		if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
14555678Smarcel			make make; \
14655678Smarcel		fi
1472061Sjkh
14817308Speter#
14938666Sjb# A simple test target used as part of the test to see if make supports
15038666Sjb# the -m argument.
15117308Speter#
15255678Smarceltest:
1533626Swollman
15417308Speter#
15555678Smarcel# Upgrade the installed make to the current version using the installed
15655678Smarcel# headers, libraries and build tools. This is required on installed versions
15755678Smarcel# prior to 2.2.5 in which the installed make doesn't support the -m argument.
15855678Smarcel#
15955678Smarcelmake:
16055678Smarcel	@echo
16155678Smarcel	@echo "--------------------------------------------------------------"
16255678Smarcel	@echo " Upgrading the installed make"
16355678Smarcel	@echo "--------------------------------------------------------------"
16455678Smarcel	@cd ${.CURDIR}/usr.bin/make; \
16555678Smarcel		make obj && make depend && make all && make install
16655678Smarcel
16755678Smarcel#
16838666Sjb# Define the upgrade targets. These are listed here in alphabetical
16938666Sjb# order, but that's not important.
17017308Speter#
17155678SmarcelUPGRADE=	aout-to-elf aout-to-elf-build aout-to-elf-install \
17238978Sjb		move-aout-libs
1733626Swollman
17417308Speter#
17538666Sjb# Handle the upgrade targets, using the source relative mk files.
17617308Speter#
17743226Sjkh
17843226Sjkhupgrade:	aout-to-elf
17943226Sjkh
18038666Sjb${UPGRADE} : upgrade_checks
18138666Sjb	@cd ${.CURDIR}; \
18244103Smsmith		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
183