Makefile revision 38804
121173Sjkh#
250479Speter#	$Id: Makefile,v 1.212 1998/09/01 05:53:00 jb Exp $
350479Speter#
421173Sjkh# The user-driven targets are:
521173Sjkh#
621173Sjkh# buildworld          - Rebuild *everything*, including glue to help do
721173Sjkh#                       upgrades.
821173Sjkh# installworld        - Install everything built by "buildworld".
921173Sjkh# world               - buildworld + installworld.
1021173Sjkh# update              - Convenient way to update your source tree (cvs).
1121173Sjkh# most                - Build user commands, no libraries or include files.
1221173Sjkh# installmost         - Install user commands, no libraries or include files.
1321173Sjkh# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
1464047Salex# aout-to-elf-build   - Build everything required to upgrade a system from
1564047Salex#                       a.out to elf format (see below).
1664057Salex# aout-to-elf-install - Install everything built by aout-to-elf-build (see
1764057Salex#                       below).
1864057Salex#
1921173Sjkh# This makefile is simple by design. The FreeBSD make automatically reads
2064057Salex# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
2164057Salex# command line. By keeping this makefile simple, it doesn't matter too
2221173Sjkh# much how different the installed mk files are from those in the source
2321369Smax# tree. This makefile executes a child make process, forcing it to use
2464057Salex# the mk files from the source tree which are supposed to DTRT.
2564057Salex#
2664057Salex# The user-driven targets (as listed above) are implemented in Makefile.inc0
2721173Sjkh# and the private targets are in Makefile.inc1. These are kept separate
2821173Sjkh# to help the bootstrap build from aout to elf format.
2921173Sjkh#
3021173Sjkh# For novices wanting to build from current sources, the simple instructions
3164047Salex# are:
3264047Salex#
3364047Salex# 1.  Ensure that your /usr/obj directory has at least 165 Mb of free space.
3464047Salex# 2.  `cd /usr/src'  (or to the directory containing your source tree).
3521173Sjkh# 3.  `make world'
3621173Sjkh#
3721173Sjkh# Be warned, this will update your installed system, except for configuration
3821173Sjkh# files in the /etc directory. You have to do those manually.
3921173Sjkh#
4021173Sjkh# If at first you're a little nervous about having a `make world' update
4121173Sjkh# your system, a `make buildworld' will build everything in the /usr/obj
4221173Sjkh# tree without touching your installed system. To be of any further use
4364047Salex# though, a `make installworld' is required.
4421173Sjkh#
4521173Sjkh# The `make world' process always follows the installed object format.
4621173Sjkh# This is set by creating /etc/objformat containing either OBJFORMAT=aout
4721173Sjkh# or OBJFORMAT=elf. If this file does not exist, the object format defaults
4821173Sjkh# to aout. This is expected to be changed to elf just prior to the release
4921173Sjkh# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
5021173Sjkh# this overrides /etc/objformat.
5121173Sjkh#
5221173Sjkh# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
5321173Sjkh# update the legacy support for aout. This includes all libraries, ld.so,
5439122Smarkm# lkms and boot objects. This part of build should be regarded as
5537283Sjkh# deprecated and you should _not_ expect to be able to do this past the
5621173Sjkh# release of 3.1. You have exactly one major release to move entirely
5721173Sjkh# to elf.
5821173Sjkh#
5921173Sjkh# ----------------------------------------------------------------------------
6021173Sjkh#
6121173Sjkh#           Upgrading an i386 system from a.out to elf format
6221173Sjkh#
6321173Sjkh#
6465298Smarkm# The aout->elf transition build is performed by doing a `make aout-to-elf'
6521173Sjkh# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
6621173Sjkh# You need to have at least 320 Mb of free space for the object tree.
6721173Sjkh#
6821173Sjkh# The upgrade process checks the installed release. If this is 3.0-CURRENT,
6921173Sjkh# it is assumed that your kernel contains all the syscalls required by the
7021173Sjkh# current sources.
7121173Sjkh#
7221173Sjkh# For installed systems where `uname -r' reports something other than
7321173Sjkh# 3.0-CURRENT, the upgrade process expects to build a kernel using the
7421173Sjkh# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
7521173Sjkh# defaulted to the GENERIC kernel configuration file on the assumption that
7621173Sjkh# it will be suitable for most systems. Before performing the upgrade,
7721173Sjkh# replace sys/i386/conf/GENERICupgrade with your own version if your
7821173Sjkh# hardware requires a different configuration.
7921173Sjkh#
8021173Sjkh# The upgrade procedure will stop and ask for confirmation to proceed
81# several times. On each occasion, you can type Ctrl-C to abort the
82# upgrade.
83#
84# At the end of the upgrade procedure, /etc/objformat is created or
85# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
86#
87# ----------------------------------------------------------------------------
88#
89#
90# Define the user-driven targets. These are listed here in alphabetical
91# order, but that's not important.
92#
93TGTS =	all buildworld clean cleandepend cleanobj depend distribute \
94	everything includes installmost install installworld most obj \
95	update world
96
97#
98# Handle the user-driven targets, using the source relative mk files.
99#
100${TGTS} : upgrade_checks
101	@cd ${.CURDIR}; \
102		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
103
104#
105# Perform a few tests to determine if the installed tools are adequate
106# for building the world. These are for older systems (prior to 2.2.5).
107#
108# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
109# so the normal make world is capable of doing what is required to update
110# the system to current.
111#
112upgrade_checks :
113	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
114
115#
116# A simple test target used as part of the test to see if make supports
117# the -m argument.
118#
119test	:
120
121#
122# Define the upgrade targets. These are listed here in alphabetical
123# order, but that's not important.
124#
125UPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install
126
127#
128# Handle the upgrade targets, using the source relative mk files.
129#
130${UPGRADE} : upgrade_checks
131	@cd ${.CURDIR}; \
132		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
133