Makefile revision 43226
1#
2#	$Id: Makefile,v 1.222 1998/12/28 17:03:49 peter Exp $
3#
4# The user-driven targets are:
5#
6# buildworld          - Rebuild *everything*, including glue to help do
7#                       upgrades.
8# installworld        - Install everything built by "buildworld".
9# world               - buildworld + installworld.
10# update              - Convenient way to update your source tree (cvs).
11# most                - Build user commands, no libraries or include files.
12# installmost         - Install user commands, no libraries or include files.
13# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
14# aout-to-elf-build   - Build everything required to upgrade a system from
15#                       a.out to elf format (see below).
16# aout-to-elf-install - Install everything built by aout-to-elf-build (see
17#                       below).
18# move-aout-libs      - Move the a.out libraries into an aout sub-directory
19#                       of each elf library sub-directory.
20#
21# This makefile is simple by design. The FreeBSD make automatically reads
22# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
23# command line. By keeping this makefile simple, it doesn't matter too
24# much how different the installed mk files are from those in the source
25# tree. This makefile executes a child make process, forcing it to use
26# the mk files from the source tree which are supposed to DTRT.
27#
28# The user-driven targets (as listed above) are implemented in Makefile.inc0
29# and the private targets are in Makefile.inc1. These are kept separate
30# to help the bootstrap build from aout to elf format.
31#
32# For novices wanting to build from current sources, the simple instructions
33# are:
34#
35# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
36# 2.  `cd /usr/src'  (or to the directory containing your source tree).
37# 3.  `make world'
38#
39# Be warned, this will update your installed system, except for configuration
40# files in the /etc directory. You have to do those manually.
41#
42# If at first you're a little nervous about having a `make world' update
43# your system, a `make buildworld' will build everything in the /usr/obj
44# tree without touching your installed system. To be of any further use
45# though, a `make installworld' is required.
46#
47# The `make world' process always follows the installed object format.
48# This is set by creating /etc/objformat containing either OBJFORMAT=aout
49# or OBJFORMAT=elf. If this file does not exist, the object format defaults
50# to aout. This is expected to be changed to elf just prior to the release
51# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
52# this overrides /etc/objformat.
53#
54# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
55# update the legacy support for aout. This includes all libraries, ld.so
56# and boot objects. This part of build should be regarded as
57# deprecated and you should _not_ expect to be able to do this past the
58# release of 3.1. You have exactly one major release to move entirely
59# to elf.
60#
61# ----------------------------------------------------------------------------
62#
63#           Upgrading an i386 system from a.out to elf format
64#
65#
66# The aout->elf transition build is performed by doing a `make upgrade' (or
67# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
68# by a `make aout-to-elf-install', depending on user preference.
69# You need to have at least 320 Mb of free space for the object tree.
70#
71# The upgrade process checks the installed release. If this is 3.0-CURRENT,
72# it is assumed that your kernel contains all the syscalls required by the
73# current sources.
74#
75# The upgrade procedure will stop and ask for confirmation to proceed
76# several times. On each occasion, you can type Ctrl-C to abort the
77# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
78# the confirmation steps.
79#
80# At the end of the upgrade procedure, /etc/objformat is created or
81# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
82#
83# ----------------------------------------------------------------------------
84#
85#
86# Define the user-driven targets. These are listed here in alphabetical
87# order, but that's not important.
88#
89TGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
90	depend distribute everything hierarchy includes install installmost \
91	installworld lint maninstall mk most obj objlink regress rerelease \
92	tags update world
93
94#
95# Handle the user-driven targets, using the source relative mk files.
96#
97${TGTS} : upgrade_checks
98	@cd ${.CURDIR}; \
99		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
100
101# Set a reasonable default
102.MAIN:	all
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		move-aout-libs
127
128#
129# Handle the upgrade targets, using the source relative mk files.
130#
131
132upgrade:	aout-to-elf
133
134${UPGRADE} : upgrade_checks
135	@cd ${.CURDIR}; \
136		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
137