Makefile revision 41257
1179260Sjb#
2179260Sjb#	$Id: Makefile,v 1.220 1998/09/29 22:03:12 jkh Exp $
3179260Sjb#
4179260Sjb# The user-driven targets are:
5179260Sjb#
6179260Sjb# buildworld          - Rebuild *everything*, including glue to help do
7179260Sjb#                       upgrades.
8179260Sjb# installworld        - Install everything built by "buildworld".
9179260Sjb# world               - buildworld + installworld.
10179260Sjb# update              - Convenient way to update your source tree (cvs).
11179260Sjb# most                - Build user commands, no libraries or include files.
12179260Sjb# installmost         - Install user commands, no libraries or include files.
13179260Sjb# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
14179260Sjb# aout-to-elf-build   - Build everything required to upgrade a system from
15179260Sjb#                       a.out to elf format (see below).
16179260Sjb# aout-to-elf-install - Install everything built by aout-to-elf-build (see
17179260Sjb#                       below).
18179260Sjb# move-aout-libs      - Move the a.out libraries into an aout sub-directory
19179260Sjb#                       of each elf library sub-directory.
20179260Sjb#
21179260Sjb# This makefile is simple by design. The FreeBSD make automatically reads
22179260Sjb# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
23179260Sjb# command line. By keeping this makefile simple, it doesn't matter too
24179260Sjb# much how different the installed mk files are from those in the source
25179260Sjb# tree. This makefile executes a child make process, forcing it to use
26179260Sjb# the mk files from the source tree which are supposed to DTRT.
27179260Sjb#
28179260Sjb# The user-driven targets (as listed above) are implemented in Makefile.inc0
29179260Sjb# and the private targets are in Makefile.inc1. These are kept separate
30179260Sjb# to help the bootstrap build from aout to elf format.
31179260Sjb#
32179260Sjb# For novices wanting to build from current sources, the simple instructions
33179260Sjb# are:
34179260Sjb#
35179260Sjb# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
36179260Sjb# 2.  `cd /usr/src'  (or to the directory containing your source tree).
37179260Sjb# 3.  `make world'
38179260Sjb#
39179260Sjb# Be warned, this will update your installed system, except for configuration
40179260Sjb# files in the /etc directory. You have to do those manually.
41179260Sjb#
42179260Sjb# If at first you're a little nervous about having a `make world' update
43179260Sjb# your system, a `make buildworld' will build everything in the /usr/obj
44179260Sjb# tree without touching your installed system. To be of any further use
45179260Sjb# though, a `make installworld' is required.
46179260Sjb#
47179260Sjb# The `make world' process always follows the installed object format.
48179260Sjb# This is set by creating /etc/objformat containing either OBJFORMAT=aout
49179260Sjb# or OBJFORMAT=elf. If this file does not exist, the object format defaults
50179260Sjb# to aout. This is expected to be changed to elf just prior to the release
51179260Sjb# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
52179260Sjb# this overrides /etc/objformat.
53179260Sjb#
54179260Sjb# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
55179260Sjb# update the legacy support for aout. This includes all libraries, ld.so,
56179260Sjb# lkms and boot objects. This part of build should be regarded as
57179260Sjb# deprecated and you should _not_ expect to be able to do this past the
58179260Sjb# release of 3.1. You have exactly one major release to move entirely
59179260Sjb# to elf.
60179260Sjb#
61179260Sjb# ----------------------------------------------------------------------------
62179260Sjb#
63179260Sjb#           Upgrading an i386 system from a.out to elf format
64179260Sjb#
65179260Sjb#
66179260Sjb# The aout->elf transition build is performed by doing a `make aout-to-elf'
67179260Sjb# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
68179260Sjb# You need to have at least 320 Mb of free space for the object tree.
69179260Sjb#
70179260Sjb# The upgrade process checks the installed release. If this is 3.0-CURRENT,
71179260Sjb# it is assumed that your kernel contains all the syscalls required by the
72179260Sjb# current sources.
73179260Sjb#
74179260Sjb# For installed systems where `uname -r' reports something other than
75179260Sjb# 3.0-CURRENT, the upgrade process expects to build a kernel using the
76179260Sjb# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
77179260Sjb# defaulted to the GENERIC kernel configuration file on the assumption that
78179260Sjb# it will be suitable for most systems. Before performing the upgrade,
79179260Sjb# replace sys/i386/conf/GENERICupgrade with your own version if your
80179260Sjb# hardware requires a different configuration.
81179260Sjb#
82179260Sjb# The upgrade procedure will stop and ask for confirmation to proceed
83179260Sjb# several times. On each occasion, you can type Ctrl-C to abort the
84179260Sjb# upgrade.
85179260Sjb#
86179260Sjb# At the end of the upgrade procedure, /etc/objformat is created or
87179260Sjb# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
88179260Sjb#
89179260Sjb# ----------------------------------------------------------------------------
90179260Sjb#
91179260Sjb#
92179260Sjb# Define the user-driven targets. These are listed here in alphabetical
93179260Sjb# order, but that's not important.
94179260Sjb#
95179260SjbTGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
96179260Sjb	depend distribute everything hierarchy includes install installmost \
97179260Sjb	installworld lint maninstall mk most obj objlink regress rerelease \
98179260Sjb	tags update world
99179260Sjb
100179260Sjb#
101179260Sjb# Handle the user-driven targets, using the source relative mk files.
102179260Sjb#
103179260Sjb${TGTS} : upgrade_checks
104179260Sjb	@cd ${.CURDIR}; \
105179260Sjb		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
106179260Sjb
107179260Sjb# Set a reasonable default
108179260Sjb.MAIN:	all
109179260Sjb
110179260Sjb#
111179260Sjb# Perform a few tests to determine if the installed tools are adequate
112179260Sjb# for building the world. These are for older systems (prior to 2.2.5).
113179260Sjb#
114179260Sjb# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
115179260Sjb# so the normal make world is capable of doing what is required to update
116179260Sjb# the system to current.
117179260Sjb#
118179260Sjbupgrade_checks :
119179260Sjb	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
120179260Sjb
121179260Sjb#
122179260Sjb# A simple test target used as part of the test to see if make supports
123179260Sjb# the -m argument.
124179260Sjb#
125179260Sjbtest	:
126179260Sjb
127179260Sjb#
128179260Sjb# Define the upgrade targets. These are listed here in alphabetical
129179260Sjb# order, but that's not important.
130179260Sjb#
131179260SjbUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
132179260Sjb		move-aout-libs
133179260Sjb
134179260Sjb#
135179260Sjb# Handle the upgrade targets, using the source relative mk files.
136179260Sjb#
137179260Sjb${UPGRADE} : upgrade_checks
138179260Sjb	@cd ${.CURDIR}; \
139179260Sjb		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
140179260Sjb