Makefile revision 54324
1139778Simp#
21541Srgrimes# $FreeBSD: head/Makefile 54324 1999-12-08 18:10:15Z marcel $
31541Srgrimes#
41541Srgrimes# The user-driven targets are:
51541Srgrimes#
61541Srgrimes# buildworld          - Rebuild *everything*, including glue to help do
71541Srgrimes#                       upgrades.
81541Srgrimes# installworld        - Install everything built by "buildworld".
91541Srgrimes# world               - buildworld + installworld.
101541Srgrimes# update              - Convenient way to update your source tree (cvs).
111541Srgrimes# upgrade             - Upgrade a.out (2.2.x/3.0) system to the new ELF way
121541Srgrimes# most                - Build user commands, no libraries or include files.
131541Srgrimes# installmost         - Install user commands, no libraries or include files.
141541Srgrimes# aout-to-elf         - Upgrade an system from a.out to elf format (see below).
151541Srgrimes# aout-to-elf-build   - Build everything required to upgrade a system from
161541Srgrimes#                       a.out to elf format (see below).
171541Srgrimes# aout-to-elf-install - Install everything built by aout-to-elf-build (see
181541Srgrimes#                       below).
191541Srgrimes# move-aout-libs      - Move the a.out libraries into an aout sub-directory
201541Srgrimes#                       of each elf library sub-directory.
211541Srgrimes#
221541Srgrimes# This makefile is simple by design. The FreeBSD make automatically reads
231541Srgrimes# the /usr/share/mk/sys.mk unless the -m argument is specified on the 
241541Srgrimes# command line. By keeping this makefile simple, it doesn't matter too
251541Srgrimes# much how different the installed mk files are from those in the source
261541Srgrimes# tree. This makefile executes a child make process, forcing it to use
271541Srgrimes# the mk files from the source tree which are supposed to DTRT.
281541Srgrimes#
291541Srgrimes# The user-driven targets (as listed above) are implemented in Makefile.inc0
301541Srgrimes# and the private targets are in Makefile.inc1. These are kept separate
311541Srgrimes# to help the bootstrap build from aout to elf format.
321541Srgrimes#
331541Srgrimes# For novices wanting to build from current sources, the simple instructions
3422521Sdyson# are:
3550477Speter#
361541Srgrimes# 1.  Ensure that your /usr/obj directory has at least 260 Mb of free space.
371541Srgrimes# 2.  `cd /usr/src'  (or to the directory containing your source tree).
381541Srgrimes# 3.  `make world'
397430Sbde#
4060041Sphk# Be warned, this will update your installed system, except for configuration
411541Srgrimes# files in the /etc directory and for the kernel. You have to do those manually.
421541Srgrimes#
431541Srgrimes# If at first you're a little nervous about having a `make world' update
441541Srgrimes# your system, a `make buildworld' will build everything in the /usr/obj
45297633Strasz# tree without touching your installed system. To be of any further use
461541Srgrimes# though, a `make installworld' is required.
4762976Smckusick#
481541Srgrimes# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
49202283Slulf# update the legacy support for aout. This includes all libraries, ld.so
50254260Spfg# and boot objects. This part of build should be regarded as
51202283Slulf# deprecated and you should _not_ expect to be able to do this past the
52254260Spfg# release of 4.0. You have exactly one major release to move entirely
53251344Spfg# to elf.
54202283Slulf#
551541Srgrimes# ----------------------------------------------------------------------------
56254260Spfg#
57254260Spfg#           Upgrading an i386 system from a.out to elf format
581541Srgrimes#
59202283Slulf#
601541Srgrimes# The aout->elf transition build is performed by doing a `make upgrade' (or
611541Srgrimes# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
621541Srgrimes# by a `make aout-to-elf-install', depending on user preference.
631541Srgrimes# You need to have at least 320 Mb of free space for the object tree.
64246634Spfg#
651541Srgrimes# The upgrade process checks the installed release. If this is 3.0-CURRENT,
66254283Spfg# it is assumed that your kernel contains all the syscalls required by the
6792363Smckusick# current sources.
6892363Smckusick#
691541Srgrimes# The upgrade procedure will stop and ask for confirmation to proceed
701541Srgrimes# several times. On each occasion, you can type Ctrl-C to abort the
711541Srgrimes# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
721541Srgrimes# the confirmation steps.
73137726Sphk#
74137726Sphk# At the end of the upgrade procedure, /etc/objformat is created or
751541Srgrimes# updated to contain OBJFORMAT=elf. From then on, you're elf by default.
761541Srgrimes#
771541Srgrimes# ----------------------------------------------------------------------------
78261235Spfg#
79254260Spfg#
80254260Spfg# Define the user-driven targets. These are listed here in alphabetical
81254260Spfg# order, but that's not important.
82254260Spfg#
83254260SpfgTGTS =	afterdistribute all buildworld checkdpadd clean cleandepend cleandir \
8492363Smckusick	depend distribute everything hierarchy includes install installmost \
8592363Smckusick	installworld lint maninstall mk most obj objlink regress rerelease \
861541Srgrimes	tags update
871541Srgrimes
881541SrgrimesMAKE=	make -m ${.CURDIR}/share/mk -f Makefile.inc1
89301559Spfg
90301559Spfg#
91254260Spfg# Handle the user-driven targets, using the source relative mk files.
92254260Spfg#
93254260Spfg${TGTS} : upgrade_checks
94254260Spfg	@cd ${.CURDIR}; \
95254260Spfg		${MAKE} ${.TARGET}
96254260Spfg
97254260Spfg# Set a reasonable default
98311231Spfg.MAIN:	all
99254260Spfg
100301560SpfgSTARTTIME!= LC_TIME=C date
101254260Spfg#
102254260Spfg# world
103254260Spfg#
104254260Spfg# Attempt to rebuild and reinstall *everything*, with reasonable chance of
105254260Spfg# success, regardless of how old your existing system is.
106254260Spfg#
107254260Spfgworld: upgrade_checks
108254260Spfg	@echo "--------------------------------------------------------------"
109254260Spfg	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
110301560Spfg	@echo "--------------------------------------------------------------"
111254260Spfg.if target(pre-world)
112254260Spfg	@echo
113293680Spfg	@echo "--------------------------------------------------------------"
114293680Spfg	@echo ">>> Making 'pre-world' target"
115293680Spfg	@echo "--------------------------------------------------------------"
116293680Spfg	@cd ${.CURDIR}; ${MAKE} pre-world
117293680Spfg.endif
118295494Spfg	@cd ${.CURDIR}; ${MAKE} buildworld
119295494Spfg	@cd ${.CURDIR}; ${MAKE} -B installworld
120293680Spfg.if target(post-world)
121301576Skevlo	@echo
122301560Spfg	@echo "--------------------------------------------------------------"
123301560Spfg	@echo ">>> Making 'post-world' target"
124301560Spfg	@echo "--------------------------------------------------------------"
125293680Spfg	@cd ${.CURDIR}; ${MAKE} post-world
126301560Spfg.endif
127301560Spfg	@echo
128254260Spfg	@echo "--------------------------------------------------------------"
129301560Spfg	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
130301560Spfg	@echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
131293680Spfg	@echo "--------------------------------------------------------------"
132301560Spfg
133301560Spfg#
134301560Spfg# Perform a few tests to determine if the installed tools are adequate
135301560Spfg# for building the world. These are for older systems (prior to 2.2.5).
136293370Spfg#
137254260Spfg# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
138301560Spfg# so the normal make world is capable of doing what is required to update
139301560Spfg# the system to current.
140293370Spfg#
141254260Spfgupgrade_checks :
142301559Spfg	@cd ${.CURDIR}; if `make -m ${.CURDIR}/share/mk test > /dev/null 2>&1`; then ok=1; else ${MAKE} -f Makefile.upgrade make; fi;
143254260Spfg
144254260Spfg#
145254260Spfg# A simple test target used as part of the test to see if make supports
1461541Srgrimes# the -m argument.
1471541Srgrimes#
1481541Srgrimestest	:
1491541Srgrimes
1501541Srgrimes#
1511541Srgrimes# Define the upgrade targets. These are listed here in alphabetical
1521541Srgrimes# order, but that's not important.
153202283Slulf#
1541541SrgrimesUPGRADE =	aout-to-elf aout-to-elf-build aout-to-elf-install \
1551541Srgrimes		move-aout-libs
1561541Srgrimes
1571541Srgrimes#
1581541Srgrimes# Handle the upgrade targets, using the source relative mk files.
1591541Srgrimes#
160254283Spfg
1611541Srgrimesupgrade:	aout-to-elf
16296506Sphk
1631541Srgrimes${UPGRADE} : upgrade_checks
16496596Siedowse	@cd ${.CURDIR}; \
1651541Srgrimes		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
166311231Spfg