Makefile revision 40495
11590Srgrimes#
21590Srgrimes#	$Id: Makefile,v 1.220 1998/09/29 22:03:12 jkh Exp $
31590Srgrimes#
41590Srgrimes# The user-driven targets are:
51590Srgrimes#
61590Srgrimes# buildworld          - Rebuild *everything*, including glue to help do
71590Srgrimes#                       upgrades.
81590Srgrimes# installworld        - Install everything built by "buildworld".
91590Srgrimes# world               - buildworld + installworld.
101590Srgrimes# update              - Convenient way to update your source tree (cvs).
111590Srgrimes# most                - Build user commands, no libraries or include files.
121590Srgrimes# installmost         - Install user commands, no libraries or include files.
131590Srgrimes# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
141590Srgrimes# aout-to-elf-build   - Build everything required to upgrade a system from
151590Srgrimes#                       a.out to elf format (see below).
161590Srgrimes# aout-to-elf-install - Install everything built by aout-to-elf-build (see
171590Srgrimes#                       below).
181590Srgrimes# move-aout-libs      - Move the a.out libraries into an aout sub-directory
191590Srgrimes#                       of each elf library sub-directory.
201590Srgrimes#
211590Srgrimes# This makefile is simple by design. The FreeBSD make automatically reads
221590Srgrimes# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
231590Srgrimes# command line. By keeping this makefile simple, it doesn't matter too
241590Srgrimes# much how different the installed mk files are from those in the source
251590Srgrimes# tree. This makefile executes a child make process, forcing it to use
261590Srgrimes# the mk files from the source tree which are supposed to DTRT.
271590Srgrimes#
281590Srgrimes# The user-driven targets (as listed above) are implemented in Makefile.inc0
291590Srgrimes# and the private targets are in Makefile.inc1. These are kept separate
301590Srgrimes# to help the bootstrap build from aout to elf format.
311590Srgrimes#
321590Srgrimes# For novices wanting to build from current sources, the simple instructions
331590Srgrimes# are:
341590Srgrimes#
351590Srgrimes# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
361590Srgrimes# 2.  `cd /usr/src'  (or to the directory containing your source tree).
371590Srgrimes# 3.  `make world'
381590Srgrimes#
391590Srgrimes# Be warned, this will update your installed system, except for configuration
401590Srgrimes# files in the /etc directory. You have to do those manually.
411590Srgrimes#
421590Srgrimes# If at first you're a little nervous about having a `make world' update
431590Srgrimes# your system, a `make buildworld' will build everything in the /usr/obj
441590Srgrimes# tree without touching your installed system. To be of any further use
451590Srgrimes# though, a `make installworld' is required.
461590Srgrimes#
471590Srgrimes# The `make world' process always follows the installed object format.
481590Srgrimes# This is set by creating /etc/objformat containing either OBJFORMAT=aout
491590Srgrimes# or OBJFORMAT=elf. If this file does not exist, the object format defaults
501590Srgrimes# to aout. This is expected to be changed to elf just prior to the release
511590Srgrimes# or 3.0. If OBJFORMAT is set as an environment variable or in /etc/make.conf,
521590Srgrimes# this overrides /etc/objformat.
531590Srgrimes#
541590Srgrimes# Unless -DNOAOUT is specified, a `make world' with OBJFORMAT=elf will
551590Srgrimes# update the legacy support for aout. This includes all libraries, ld.so,
561590Srgrimes# lkms and boot objects. This part of build should be regarded as
571590Srgrimes# deprecated and you should _not_ expect to be able to do this past the
581590Srgrimes# release of 3.1. You have exactly one major release to move entirely
591590Srgrimes# to elf.
601590Srgrimes#
611590Srgrimes# ----------------------------------------------------------------------------
621590Srgrimes#
631590Srgrimes#           Upgrading an i386 system from a.out to elf format
641590Srgrimes#
651590Srgrimes#
661590Srgrimes# The aout->elf transition build is performed by doing a `make aout-to-elf'
671590Srgrimes# or a `make aout-to-elf-build' followed by a `make aout-to-elf-install'.
681590Srgrimes# You need to have at least 320 Mb of free space for the object tree.
691590Srgrimes#
701590Srgrimes# The upgrade process checks the installed release. If this is 3.0-CURRENT,
711590Srgrimes# it is assumed that your kernel contains all the syscalls required by the
721590Srgrimes# current sources.
731590Srgrimes#
741590Srgrimes# For installed systems where `uname -r' reports something other than
751590Srgrimes# 3.0-CURRENT, the upgrade process expects to build a kernel using the
761590Srgrimes# kernel configuration file sys/i386/conf/GENERICupgrade. This file is
771590Srgrimes# defaulted to the GENERIC kernel configuration file on the assumption that
781590Srgrimes# it will be suitable for most systems. Before performing the upgrade,
791590Srgrimes# replace sys/i386/conf/GENERICupgrade with your own version if your
801590Srgrimes# hardware requires a different configuration.
811590Srgrimes#
821590Srgrimes# The upgrade procedure will stop and ask for confirmation to proceed
831590Srgrimes# several times. On each occasion, you can type Ctrl-C to abort the
841590Srgrimes# upgrade.
851590Srgrimes#
861590Srgrimes# At the end of the upgrade procedure, /etc/objformat is created or
871590Srgrimes# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
881590Srgrimes#
891590Srgrimes# ----------------------------------------------------------------------------
901590Srgrimes#
911590Srgrimes#
921590Srgrimes# Define the user-driven targets. These are listed here in alphabetical
931590Srgrimes# order, but that's not important.
941590Srgrimes#
951590SrgrimesTGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
961590Srgrimes	depend distribute everything hierarchy includes install installmost \
971590Srgrimes	installworld lint maninstall mk most obj objlink regress rerelease \
981590Srgrimes	tags update world
991590Srgrimes
1001590Srgrimes#
1011590Srgrimes# Handle the user-driven targets, using the source relative mk files.
1021590Srgrimes#
1031590Srgrimes${TGTS} : upgrade_checks
1041590Srgrimes	@cd ${.CURDIR}; \
1051590Srgrimes		make -f Makefile.inc0 -m ${.CURDIR}/share/mk ${.TARGET}
1061590Srgrimes
1071590Srgrimes# Set a reasonable default
1081590Srgrimes.MAIN:	all
1091590Srgrimes
1101590Srgrimes#
1111590Srgrimes# Perform a few tests to determine if the installed tools are adequate
1121590Srgrimes# for building the world. These are for older systems (prior to 2.2.5).
1131590Srgrimes#
1141590Srgrimes# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
1151590Srgrimes# so the normal make world is capable of doing what is required to update
1161590Srgrimes# the system to current.
1171590Srgrimes#
1181590Srgrimesupgrade_checks :
1191590Srgrimes	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else make -f Makefile.upgrade make; fi;
1201590Srgrimes
1211590Srgrimes#
1221590Srgrimes# A simple test target used as part of the test to see if make supports
1231590Srgrimes# the -m argument.
1241590Srgrimes#
1251590Srgrimestest	:
1261590Srgrimes
1271590Srgrimes#
1281590Srgrimes# Define the upgrade targets. These are listed here in alphabetical
1291590Srgrimes# order, but that's not important.
1301590Srgrimes#
1311590SrgrimesUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
1321590Srgrimes		move-aout-libs
1331590Srgrimes
1341590Srgrimes#
1351590Srgrimes# Handle the upgrade targets, using the source relative mk files.
1361590Srgrimes#
1371590Srgrimes${UPGRADE} : upgrade_checks
1381590Srgrimes	@cd ${.CURDIR}; \
1391590Srgrimes		make -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
1401590Srgrimes