Makefile revision 41257
12061Sjkh#
240495Sbde#	$Id: Makefile,v 1.220 1998/09/29 22:03:12 jkh Exp $
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).
1138666Sjb# most                - Build user commands, no libraries or include files.
1238666Sjb# installmost         - Install user commands, no libraries or include files.
1338666Sjb# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1438666Sjb# aout-to-elf-build   - Build everything required to upgrade a system from
1538666Sjb#                       a.out to elf format (see below).
1638666Sjb# aout-to-elf-install - Install everything built by aout-to-elf-build (see
1738666Sjb#                       below).
1838978Sjb# move-aout-libs      - Move the a.out libraries into an aout sub-directory
1938978Sjb#                       of each elf library sub-directory.
2032427Sjb#
2138666Sjb# This makefile is simple by design. The FreeBSD make automatically reads
2238666Sjb# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
2338666Sjb# command line. By keeping this makefile simple, it doesn't matter too
2438666Sjb# much how different the installed mk files are from those in the source
2538666Sjb# tree. This makefile executes a child make process, forcing it to use
2638666Sjb# the mk files from the source tree which are supposed to DTRT.
2717308Speter#
2838666Sjb# The user-driven targets (as listed above) are implemented in Makefile.inc0
2938666Sjb# and the private targets are in Makefile.inc1. These are kept separate
3038666Sjb# to help the bootstrap build from aout to elf format.
3119175Sbde#
3238666Sjb# For novices wanting to build from current sources, the simple instructions
3338666Sjb# are:
3438042Sbde#
3539726Sjb# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
3638666Sjb# 2.  `cd /usr/src'  (or to the directory containing your source tree).
3738666Sjb# 3.  `make world'
3838042Sbde#
3938666Sjb# Be warned, this will update your installed system, except for configuration
4038666Sjb# files in the /etc directory. You have to do those manually.
4117308Speter#
4238666Sjb# If at first you're a little nervous about having a `make world' update
4338666Sjb# your system, a `make buildworld' will build everything in the /usr/obj
4438666Sjb# tree without touching your installed system. To be of any further use
4538666Sjb# though, a `make installworld' is required.
4617308Speter#
4738666Sjb# The `make world' process always follows the installed object format.
4838666Sjb# This is set by creating /etc/objformat containing either OBJFORMAT=aout
4938666Sjb# or OBJFORMAT=elf. If this file does not exist, the object format defaults
5038666Sjb# to aout. This is expected to be changed to elf just prior to the release
5138666Sjb# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
5238666Sjb# this overrides /etc/objformat.
5317308Speter#
5438666Sjb# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
5538666Sjb# update the legacy support for aout. This includes all libraries, ld.so,
5638666Sjb# lkms and boot objects. This part of build should be regarded as
5738666Sjb# deprecated and you should _not_ expect to be able to do this past the
5838666Sjb# release of 3.1. You have exactly one major release to move entirely
5938666Sjb# to elf.
6017308Speter#
6138666Sjb# ----------------------------------------------------------------------------
6217308Speter#
6338666Sjb#           Upgrading an i386 system from a.out to elf format
6417308Speter#
6527910Sasami#
6638666Sjb# The aout->elf transition build is performed by doing a `make aout-to-elf'
6738666Sjb# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
6838666Sjb# You need to have at least 320 Mb of free space for the object tree.
6927910Sasami#
7038666Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT,
7138666Sjb# it is assumed that your kernel contains all the syscalls required by the
7238666Sjb# current sources.
7327910Sasami#
7438666Sjb# For installed systems where `uname -r' reports something other than
7538666Sjb# 3.0-CURRENT, the upgrade process expects to build a kernel using the
7638666Sjb# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
7738666Sjb# defaulted to the GENERIC kernel configuration file on the assumption that
7838666Sjb# it will be suitable for most systems. Before performing the upgrade,
7938666Sjb# replace sys/i386/conf/GENERICupgrade with your own version if your
8038666Sjb# hardware requires a different configuration.
8117308Speter#
8238666Sjb# The upgrade procedure will stop and ask for confirmation to proceed
8338666Sjb# several times. On each occasion, you can type Ctrl-C to abort the
8438666Sjb# upgrade.
8527910Sasami#
8638666Sjb# At the end of the upgrade procedure, /etc/objformat is created or
8738666Sjb# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
8827910Sasami#
8938666Sjb# ----------------------------------------------------------------------------
9027910Sasami#
9117308Speter#
9238666Sjb# Define the user-driven targets. These are listed here in alphabetical
9338666Sjb# order, but that's not important.
9417308Speter#
9540495SbdeTGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
9640495Sbde	depend distribute everything hierarchy includes install installmost \
9740495Sbde	installworld lint maninstall mk most obj objlink regress rerelease \
9840495Sbde	tags update world
992061Sjkh
10017308Speter#
10138666Sjb# Handle the user-driven targets, using the source relative mk files.
10217308Speter#
10338666Sjb${TGTS} : upgrade_checks
10438666Sjb	@cd ${.CURDIR}; \
10538666Sjb		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
1062302Spaul
10739206Sjkh# Set a reasonable default
10839206Sjkh.MAIN:	all
10939206Sjkh
11017308Speter#
11138666Sjb# Perform a few tests to determine if the installed tools are adequate
11238666Sjb# for building the world. These are for older systems (prior to 2.2.5).
11317308Speter#
11438666Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
11538666Sjb# so the normal make world is capable of doing what is required to update
11638666Sjb# the system to current.
11717308Speter#
11838666Sjbupgrade_checks :
11938666Sjb	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
1202061Sjkh
12117308Speter#
12238666Sjb# A simple test target used as part of the test to see if make supports
12338666Sjb# the -m argument.
12417308Speter#
12538666Sjbtest	:
1263626Swollman
12717308Speter#
12838666Sjb# Define the upgrade targets. These are listed here in alphabetical
12938666Sjb# order, but that's not important.
13017308Speter#
13138978SjbUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
13238978Sjb		move-aout-libs
1333626Swollman
13417308Speter#
13538666Sjb# Handle the upgrade targets, using the source relative mk files.
13617308Speter#
13738666Sjb${UPGRADE} : upgrade_checks
13838666Sjb	@cd ${.CURDIR}; \
13938666Sjb		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
140