xref: /dragonfly/Makefile (revision 2cd2d2b5)
1#
2# $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $
3# $DragonFly: src/Makefile,v 1.8 2004/08/18 16:37:15 dillon Exp $
4#
5# The user-driven targets are:
6#
7# buildworld          - Rebuild *everything*, including glue to help do
8#                       upgrades.
9# quickworld	      - Skip bootstrap, build and cross-build tool steps
10# realquickworld      - Skip above steps, plus depend
11# crossworld	      - Just do the bootstrap, build, and cross-build steps
12# installworld        - Install everything built by "buildworld".
13# world               - buildworld + installworld.
14# buildkernel         - Rebuild the kernel and the kernel-modules from scratch
15#			using build/bootstrap/cross tools from the last
16#			buildworld.
17# nativekernel	      - Rebuild the kernel and the kernel-modules from scratch
18#		        using native tools.
19# quickkernel	      - rebuild the kernel quickly (build or native), skip
20#			the make depend step and do not clean out the obj
21#			modules.
22# installkernel       - Install the kernel and the kernel-modules.
23# reinstallkernel     - Reinstall the kernel and the kernel-modules.
24# kernel              - buildkernel + installkernel.
25# update              - Convenient way to update your source tree (cvs).
26# upgrade             - Upgrade the files in /etc and also setup the rest
27#			of the system for DragonFly. ex. two compilers
28# most                - Build user commands, no libraries or include files.
29# installmost         - Install user commands, no libraries or include files.
30#
31# This makefile is simple by design. The FreeBSD make automatically reads
32# the /usr/share/mk/sys.mk unless the -m argument is specified on the
33# command line. By keeping this makefile simple, it doesn't matter too
34# much how different the installed mk files are from those in the source
35# tree. This makefile executes a child make process, forcing it to use
36# the mk files from the source tree which are supposed to DTRT.
37#
38# The user-driven targets (as listed above) are implemented in Makefile.inc1.
39#
40# If you want to build your system from source be sure that /usr/obj has
41# at least 400MB of diskspace available.
42#
43# For individuals wanting to build from the sources currently on their
44# system, the simple instructions are:
45#
46# 1.  `cd /usr/src'  (or to the directory containing your source tree).
47# 2.  `make world'
48#
49# For individuals wanting to upgrade their sources (even if only a
50# delta of a few days):
51#
52# 1.  `cd /usr/src'       (or to the directory containing your source tree).
53# 2.  `make buildworld'
54# 3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
55# 4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
56# 5.  `reboot'        (in single user mode: boot -s from the loader prompt).
57# 6.  `mergemaster -p'
58# 7.  `make installworld'
59# 8.  `mergemaster'
60# 9.  `reboot'
61#
62# See src/UPDATING `COMMON ITEMS' for more complete information.
63#
64# If TARGET_ARCH=arch (e.g. amd64) is specified you can
65# cross build world for other architectures using the buildworld target,
66# and once the world is built you can cross build a kernel using the
67# buildkernel target.
68#
69# Define the user-driven targets. These are listed here in alphabetical
70# order, but that's not important.
71#
72TGTS=	all all-man buildkernel quickkernel nativekernel \
73	buildworld crossworld quickworld realquickworld checkdpadd clean \
74	cleandepend cleandir depend distribute distributeworld everything \
75	hierarchy install installcheck installkernel \
76	reinstallkernel installmost installworld libraries lint maninstall \
77	mk most obj objlink regress rerelease tags update
78
79BITGTS=	files includes
80BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
81
82.ORDER: buildworld installworld
83.ORDER: buildworld distributeworld
84.ORDER: buildworld buildkernel nativekernel quickkernel
85.ORDER: buildkernel nativekernel quickkernel installkernel
86.ORDER: buildkernel nativekernel quickkernel reinstallkernel
87
88PATH=	/sbin:/bin:/usr/sbin:/usr/bin
89MAKE=	PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
90
91#
92# Handle the user-driven targets, using the source relative mk files.
93#
94${TGTS} ${BITGTS}:
95	@cd ${.CURDIR}; \
96		${MAKE} ${.TARGET}
97
98# Set a reasonable default
99.MAIN:	all
100
101STARTTIME!= LC_ALL=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:
109	@echo "--------------------------------------------------------------"
110	@echo ">>> elf 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	@printf ">>> elf make world completed on `LC_ALL=C date`\n                        (started ${STARTTIME})\n"
131	@echo "--------------------------------------------------------------"
132
133#
134# kernel
135#
136# Short hand for `make buildkernel installkernel'
137#
138kernel: buildkernel installkernel
139
140#
141# A simple test target used as part of the test to see if make supports
142# the -m argument.  Also test that make will only evaluate a conditional
143# as far as is necessary to determine its value.
144#
145test:
146.if defined(notdef)
147.undef notdef
148.if defined(notdef) && ${notdef:U}
149.endif
150.endif
151
152#
153# Upgrade the installed make to the current version using the installed
154# headers, libraries and build tools. This is required on installed versions
155# prior to 2.2.5 in which the installed make doesn't support the -m argument.
156#
157make:
158	@echo
159	@echo "--------------------------------------------------------------"
160	@echo " Upgrading the installed make"
161	@echo "--------------------------------------------------------------"
162	@cd ${.CURDIR}/usr.bin/make; \
163		make obj && make depend && make all && make install
164
165#
166# Handle the upgrade of /etc
167#
168
169upgrade:	upgrade_etc
170
171#
172# Handle post-installworld updating of static files (e.g. like /etc/rc)
173#
174upgrade_etc:
175	@cd ${.CURDIR}/etc; make upgrade_etc
176