Makefile revision 57459
11541Srgrimes#
214507Shsu# $FreeBSD: head/Makefile 57457 2000-02-24 23:03:16Z markm $
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
341541Srgrimes# are:
351541Srgrimes#
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).
3814507Shsu# 3.  `make world'
3950477Speter#
401541Srgrimes# 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.
422165Spaul#
432165Spaul# If at first you're a little nervous about having a `make world' update
442165Spaul# your system, a `make buildworld' will build everything in the /usr/obj
451541Srgrimes# tree without touching your installed system. To be of any further use
461541Srgrimes# though, a `make installworld' is required.
471541Srgrimes#
481541Srgrimes# If -DWANT_AOUT is specified, a `make world' with OBJFORMAT=elf will
491541Srgrimes# update the legacy support for aout. This includes all libraries, ld.so
5014507Shsu# and boot objects. This part of build should be regarded as
511541Srgrimes# deprecated and you should _not_ expect to be able to do this past the
5255205Speter# release of 4.0. You have exactly one major release to move entirely
5348726Sphk# to elf.
5448726Sphk#
5548726Sphk# ----------------------------------------------------------------------------
5648726Sphk#
5748726Sphk#           Upgrading an i386 system from a.out to elf format
5810086Sjkh#
591541Srgrimes#
6014507Shsu# The aout->elf transition build is performed by doing a `make upgrade' (or
6114507Shsu# `make aout-to-elf') or in two steps by a `make aout-to-elf-build' followed
6214507Shsu# by a `make aout-to-elf-install', depending on user preference.
6314507Shsu# You need to have at least 320 Mb of free space for the object tree.
6414507Shsu#
6514507Shsu# The upgrade process checks the installed release. If this is 3.0-CURRENT,
6614507Shsu# it is assumed that your kernel contains all the syscalls required by the
6714507Shsu# current sources.
6814507Shsu#
6948726Sphk# The upgrade procedure will stop and ask for confirmation to proceed
7014507Shsu# several times. On each occasion, you can type Ctrl-C to abort the
7114507Shsu# upgrade.  Optionally, you can also start it with NOCONFIRM=yes and skip
7282619Srwatson# the confirmation steps.
731541Srgrimes#
741541Srgrimes# 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#
7714507Shsu# ----------------------------------------------------------------------------
781541Srgrimes#
7948726Sphk#
801541Srgrimes# Define the user-driven targets. These are listed here in alphabetical
811541Srgrimes# order, but that's not important.
821541Srgrimes#
831541SrgrimesTGTS=	afterdistribute all buildkernel buildworld checkdpadd clean \
841541Srgrimes	cleandepend cleandir depend distribute everything hierarchy includes \
851541Srgrimes	install installkernel installmost installworld libraries lint \
861541Srgrimes	maninstall mk most obj objlink regress rerelease tags update
8755205Speter
8883366SjulianPATH=	/sbin:/bin:/usr/sbin:/usr/bin
8932995SbdeMAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
9092719Salfred
911541Srgrimes#
9214507Shsu# Handle the user-driven targets, using the source relative mk files.
9314507Shsu#
94${TGTS}: upgrade_checks
95	@cd ${.CURDIR}; \
96		${MAKE} ${.TARGET}
97
98# Set a reasonable default
99.MAIN:	all
100
101STARTTIME!= LC_TIME=C date
102#
103# world
104#
105# Attempt to rebuild and reinstall *everything*, with reasonable chance of
106# success, regardless of how old your existing system is.
107#
108world: upgrade_checks
109	@echo "--------------------------------------------------------------"
110	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
111	@echo "--------------------------------------------------------------"
112.if target(pre-world)
113	@echo
114	@echo "--------------------------------------------------------------"
115	@echo ">>> Making 'pre-world' target"
116	@echo "--------------------------------------------------------------"
117	@cd ${.CURDIR}; ${MAKE} pre-world
118.endif
119	@cd ${.CURDIR}; ${MAKE} buildworld
120	@cd ${.CURDIR}; ${MAKE} -B installworld
121.if target(post-world)
122	@echo
123	@echo "--------------------------------------------------------------"
124	@echo ">>> Making 'post-world' target"
125	@echo "--------------------------------------------------------------"
126	@cd ${.CURDIR}; ${MAKE} post-world
127.endif
128	@echo
129	@echo "--------------------------------------------------------------"
130	@echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
131	@echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
132	@echo "--------------------------------------------------------------"
133
134#
135# Perform a few tests to determine if the installed tools are adequate
136# for building the world. These are for older systems (prior to 2.2.5).
137#
138# From 2.2.5 onwards, the installed tools will pass these upgrade tests,
139# so the normal make world is capable of doing what is required to update
140# the system to current.
141#
142upgrade_checks:
143	@cd ${.CURDIR}; \
144		if ! make -m ${.CURDIR}/share/mk test > /dev/null 2>&1; then \
145			make make; \
146		fi
147
148#
149# A simple test target used as part of the test to see if make supports
150# the -m argument.
151#
152test:
153
154#
155# Upgrade the installed make to the current version using the installed
156# headers, libraries and build tools. This is required on installed versions
157# prior to 2.2.5 in which the installed make doesn't support the -m argument.
158#
159make:
160	@echo
161	@echo "--------------------------------------------------------------"
162	@echo " Upgrading the installed make"
163	@echo "--------------------------------------------------------------"
164	@cd ${.CURDIR}/usr.bin/make; \
165		make obj && make depend && make all && make install
166
167#
168# Define the upgrade targets. These are listed here in alphabetical
169# order, but that's not important.
170#
171UPGRADE=	aout-to-elf aout-to-elf-build aout-to-elf-install \
172		move-aout-libs
173
174#
175# Handle the upgrade targets, using the source relative mk files.
176#
177
178upgrade:	aout-to-elf
179
180${UPGRADE} : upgrade_checks
181	@cd ${.CURDIR}; \
182		${MAKE} -f Makefile.upgrade -m ${.CURDIR}/share/mk ${.TARGET}
183