Makefile revision 50477
1125699Spjd#
2163872Spjd#	$Id: Makefile,v 1.226 1999/03/29 10:59:52 obrien Exp $
3125699Spjd#
4125699Spjd# The user-driven targets are:
5125699Spjd#
6125699Spjd# buildworld          - Rebuild *everything*, including glue to help do
7125699Spjd#                       upgrades.
8125699Spjd# installworld        - Install everything built by "buildworld".
9125699Spjd# world               - buildworld + installworld.
10125699Spjd# update              - Convenient way to update your source tree (cvs).
11125699Spjd# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
12125699Spjd# most                - Build user commands, no libraries or include files.
13125699Spjd# installmost         - Install user commands, no libraries or include files.
14125699Spjd# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
15125699Spjd# aout-to-elf-build   - Build everything required to upgrade a system from
16125699Spjd#                       a.out to elf format (see below).
17125699Spjd# aout-to-elf-install - Install everything built by aout-to-elf-build (see
18125699Spjd#                       below).
19125699Spjd# move-aout-libs      - Move the a.out libraries into an aout sub-directory
20125699Spjd#                       of each elf library sub-directory.
21125699Spjd#
22125699Spjd# This makefile is simple by design. The FreeBSD make automatically reads
23125699Spjd# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
24125699Spjd# command line. By keeping this makefile simple, it doesn't matter too
25125699Spjd# much how different the installed mk files are from those in the source
26125699Spjd# tree. This makefile executes a child make process, forcing it to use
27292201Sbrueffer# the mk files from the source tree which are supposed to DTRT.
28131689Sru#
29125699Spjd# The user-driven targets (as listed above) are implemented in Makefile.inc0
30125699Spjd# and the private targets are in Makefile.inc1. These are kept separate
31125699Spjd# to help the bootstrap build from aout to elf format.
32125699Spjd#
33125714Spjd# For novices wanting to build from current sources, the simple instructions
34125714Spjd# are:
35129381Sle#
36125699Spjd# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
37125699Spjd# 2.  `cd /usr/src'  (or to the directory containing your source tree).
38125699Spjd# 3.  `make world'
39125699Spjd#
40125699Spjd# Be warned, this will update your installed system, except for configuration
41125699Spjd# files in the /etc directory and for the kernel. You have to do those manually.
42163872Spjd#
43163872Spjd# If at first you're a little nervous about having a `make world' update
44125699Spjd# your system, a `make buildworld' will build everything in the /usr/obj
45163872Spjd# tree without touching your installed system. To be of any further use
46163872Spjd# though, a `make installworld' is required.
47125699Spjd#
48125699Spjd# The `make world' process always follows the installed object format.
49125714Spjd# This is set by creating /etc/objformat containing either OBJFORMAT=aout
50125714Spjd# or OBJFORMAT=elf. If this file does not exist, the object format defaults
51125699Spjd# to aout. This is expected to be changed to elf just prior to the release
52129381Sle# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
53131689Sru# this overrides /etc/objformat.
54129381Sle#
55129381Sle# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
56125699Spjd# update the legacy support for aout. This includes all libraries, ld.so
57125699Spjd# and boot objects. This part of build should be regarded as
58129381Sle# deprecated and you should _not_ expect to be able to do this past the
59125699Spjd# release of 3.1. You have exactly one major release to move entirely
60131689Sru# to elf.
61125699Spjd#
62129381Sle# ----------------------------------------------------------------------------
63125699Spjd#
64129381Sle#           Upgrading an i386 system from a.out to elf format
65125699Spjd#
66129381Sle#
67125699Spjd# The aout->elf transition build is performed by doing a `make upgrade' (or
68125699Spjd# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
69125699Spjd# by a `make aout-to-elf-install', depending on user preference.
70125699Spjd# You need to have at least 320 Mb of free space for the object tree.
71125699Spjd#
72125699Spjd# The upgrade process checks the installed release. If this is 3.0-CURRENT,
73129387Sle# it is assumed that your kernel contains all the syscalls required by the
74125699Spjd# current sources.
75125699Spjd#
76125699Spjd# The upgrade procedure will stop and ask for confirmation to proceed
77125699Spjd# several times. On each occasion, you can type Ctrl-C to abort the
78163870Spjd# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
79163873Spjd# the confirmation steps.
80125699Spjd#
81125699Spjd# At the end of the upgrade procedure, /etc/objformat is created or
82125699Spjd# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
83133142Spjd#
84125699Spjd# ----------------------------------------------------------------------------
85125699Spjd#
86129381Sle#
87129381Sle# Define the user-driven targets. These are listed here in alphabetical
88125699Spjd# order, but that's not important.
89125699Spjd#
90125699SpjdTGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
91133142Spjd	depend distribute everything hierarchy includes install installmost \
92133142Spjd	installworld lint maninstall mk most obj objlink regress rerelease \
93133142Spjd	tags update world
94133142Spjd
95133142Spjd#
96133142Spjd# Handle the user-driven targets, using the source relative mk files.
97133142Spjd#
98133142Spjd${TGTS} : upgrade_checks
99125699Spjd	@cd ${.CURDIR}; \
100131689Sru		${MAKE} -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
101131689Sru
102131689Sru# Set a reasonable default
103125699Spjd.MAIN:	all
104129381Sle
105125699Spjd#
106133142Spjd# Perform a few tests to determine if the installed tools are adequate
107125699Spjd# for building the world. These are for older systems (prior to 2.2.5).
108133142Spjd#
109125699Spjd# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
110133142Spjd# so the normal make world is capable of doing what is required to update
111125699Spjd# the system to current.
112133142Spjd#
113125699Spjdupgrade_checks :
114131689Sru	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else ${MAKE} -f Makefile.upgrade make; fi;
115131689Sru
116131689Sru#
117125699Spjd# A simple test target used as part of the test to see if make supports
118125699Spjd# the -m argument.
119125699Spjd#
120131689Srutest	:
121125699Spjd
122131689Sru#
123125699Spjd# Define the upgrade targets. These are listed here in alphabetical
124125699Spjd# order, but that's not important.
125125699Spjd#
126125699SpjdUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
127125699Spjd		move-aout-libs
128125699Spjd
129131689Sru#
130131689Sru# Handle the upgrade targets, using the source relative mk files.
131131689Sru#
132125699Spjd
133131689Sruupgrade:	aout-to-elf
134131689Sru
135131689Sru${UPGRADE} : upgrade_checks
136125699Spjd	@cd ${.CURDIR}; \
137131689Sru		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
138131689Sru