Makefile revision 44918
17443Sjfranck#
27443Sjfranck#	$Id: Makefile,v 1.224 1999/02/17 20:56:09 msmith Exp $
37443Sjfranck#
47443Sjfranck# The user-driven targets are:
57443Sjfranck#
67443Sjfranck# buildworld          - Rebuild *everything*, including glue to help do
77443Sjfranck#                       upgrades.
87443Sjfranck# installworld        - Install everything built by "buildworld".
97443Sjfranck# world               - buildworld + installworld.
107443Sjfranck# update              - Convenient way to update your source tree (cvs).
117443Sjfranck# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
127443Sjfranck# most                - Build user commands, no libraries or include files.
137443Sjfranck# installmost         - Install user commands, no libraries or include files.
147443Sjfranck# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
157443Sjfranck# aout-to-elf-build   - Build everything required to upgrade a system from
167443Sjfranck#                       a.out to elf format (see below).
177443Sjfranck# aout-to-elf-install - Install everything built by aout-to-elf-build (see
187443Sjfranck#                       below).
197443Sjfranck# move-aout-libs      - Move the a.out libraries into an aout sub-directory
207443Sjfranck#                       of each elf library sub-directory.
217443Sjfranck#
227443Sjfranck# This makefile is simple by design. The FreeBSD make automatically reads
237443Sjfranck# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
247443Sjfranck# command line. By keeping this makefile simple, it doesn't matter too
257443Sjfranck# much how different the installed mk files are from those in the source
267443Sjfranck# tree. This makefile executes a child make process, forcing it to use
277443Sjfranck# the mk files from the source tree which are supposed to DTRT.
287443Sjfranck#
297443Sjfranck# The user-driven targets (as listed above) are implemented in Makefile.inc0
307443Sjfranck# and the private targets are in Makefile.inc1. These are kept separate
317443Sjfranck# to help the bootstrap build from aout to elf format.
327443Sjfranck#
337443Sjfranck# For novices wanting to build from current sources, the simple instructions
347443Sjfranck# are:
357443Sjfranck#
367443Sjfranck# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
377443Sjfranck# 2.  `cd /usr/src'  (or to the directory containing your source tree).
387443Sjfranck# 3.  `make world'
397443Sjfranck#
407443Sjfranck# Be warned, this will update your installed system, except for configuration
417443Sjfranck# files in the /etc directory. You have to do those manually.
427443Sjfranck#
437443Sjfranck# If at first you're a little nervous about having a `make world' update
447443Sjfranck# your system, a `make buildworld' will build everything in the /usr/obj
457443Sjfranck# tree without touching your installed system. To be of any further use
467443Sjfranck# though, a `make installworld' is required.
477443Sjfranck#
488781Srfield# The `make world' process always follows the installed object format.
498781Srfield# This is set by creating /etc/objformat containing either OBJFORMAT=aout
508781Srfield# or OBJFORMAT=elf. If this file does not exist, the object format defaults
518781Srfield# to aout. This is expected to be changed to elf just prior to the release
527443Sjfranck# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
537443Sjfranck# this overrides /etc/objformat.
547443Sjfranck#
557443Sjfranck# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
567443Sjfranck# update the legacy support for aout. This includes all libraries, ld.so
57# and boot objects. This part of build should be regarded as
58# deprecated and you should _not_ expect to be able to do this past the
59# release of 3.1. You have exactly one major release to move entirely
60# to elf.
61#
62# ----------------------------------------------------------------------------
63#
64#           Upgrading an i386 system from a.out to elf format
65#
66#
67# The aout->elf transition build is performed by doing a `make upgrade' (or
68# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
69# by a `make aout-to-elf-install', depending on user preference.
70# You need to have at least 320 Mb of free space for the object tree.
71#
72# The upgrade process checks the installed release. If this is 3.0-CURRENT,
73# it is assumed that your kernel contains all the syscalls required by the
74# current sources.
75#
76# The upgrade procedure will stop and ask for confirmation to proceed
77# several times. On each occasion, you can type Ctrl-C to abort the
78# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
79# the confirmation steps.
80#
81# At the end of the upgrade procedure, /etc/objformat is created or
82# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
83#
84# ----------------------------------------------------------------------------
85#
86#
87# Define the user-driven targets. These are listed here in alphabetical
88# order, but that's not important.
89#
90TGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
91	depend distribute everything hierarchy includes install installmost \
92	installworld lint maninstall mk most obj objlink regress rerelease \
93	tags update world
94
95#
96# Handle the user-driven targets, using the source relative mk files.
97#
98${TGTS} : upgrade_checks
99	@cd ${.CURDIR}; \
100		${MAKE} -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
101
102# Set a reasonable default
103.MAIN:	all
104
105#
106# Perform a few tests to determine if the installed tools are adequate
107# for building the world. These are for older systems (prior to 2.2.5).
108#
109# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
110# so the normal make world is capable of doing what is required to update
111# the system to current.
112#
113upgrade_checks :
114	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else ${MAKE} -f Makefile.upgrade make; fi;
115
116#
117# A simple test target used as part of the test to see if make supports
118# the -m argument.
119#
120test	:
121
122#
123# Define the upgrade targets. These are listed here in alphabetical
124# order, but that's not important.
125#
126UPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
127		move-aout-libs
128
129#
130# Handle the upgrade targets, using the source relative mk files.
131#
132
133upgrade:	aout-to-elf
134
135${UPGRADE} : upgrade_checks
136	@cd ${.CURDIR}; \
137		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
138