Makefile{,.inc1}: Merge user-driven target descriptions and cleanups
[dragonfly.git] / Makefile
CommitLineData
984263bc
MD
1#
2# $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $
3#
4# The user-driven targets are:
5#
6# buildworld - Rebuild *everything*, including glue to help do
7# upgrades.
f71956f7
AL
8# quickworld - Skip bootstrap, build and cross-build tool steps.
9# realquickworld - Skip above steps, plus depend.
10# crossworld - Just do the bootstrap, build, and cross-build steps.
984263bc 11# installworld - Install everything built by "buildworld".
f71956f7
AL
12# installworld-force - Install everything built by "buildworld";
13# special case for old systems.
984263bc 14# world - buildworld + installworld.
fc7aca3e 15# buildkernel - Rebuild the kernel and the kernel-modules from scratch
f71956f7
AL
16# using build/bootstrap/cross tools from the last
17# buildworld.
18# nativekernel - Rebuild the kernel and the kernel-modules from scratch
19# using native tools.
20# quickkernel - Rebuild the kernel quickly (build or native), and do
21# not clean out the obj modules.
92c9dfec 22# realquickkernel - Like quickkernel, but skips depend too.
984263bc
MD
23# installkernel - Install the kernel and the kernel-modules.
24# reinstallkernel - Reinstall the kernel and the kernel-modules.
25# kernel - buildkernel + installkernel.
f71956f7
AL
26# preupgrade - Do certain upgrades in /etc (typically the addition of
27# new users and groups used by installed utilities) before
28# the installworld.
8db5e54f 29# upgrade - Upgrade the files in /etc and also setup the rest
f71956f7 30# of the system for DragonFly. ex. two compilers.
984263bc
MD
31# most - Build user commands, no libraries or include files.
32# installmost - Install user commands, no libraries or include files.
f71956f7 33# backupworld - Copy /bin /sbin /usr/bin /usr/sbin /usr/lib
2decc9b9 34# /usr/libexec to manual backup dir.
f71956f7
AL
35# restoreworld - Install binaries from manual backup dir to world.
36# restoreworld-auto - Install binaries from auto-backup dir to world;
2decc9b9
JM
37# installworld target makes backup to auto-backup dir.
38# backup-auto-clean - Delete backup from auto-backup dir.
39# backup-clean - Delete backup from manual backup dir.
984263bc 40#
114580ac 41# This makefile is simple by design. The DragonFly make automatically reads
f71956f7 42# /usr/share/mk/sys.mk unless the -m argument is specified on the
984263bc
MD
43# command line. By keeping this makefile simple, it doesn't matter too
44# much how different the installed mk files are from those in the source
45# tree. This makefile executes a child make process, forcing it to use
46# the mk files from the source tree which are supposed to DTRT.
47#
f71956f7
AL
48# Most of the user-driven targets (as listed above) are implemented in
49# Makefile.inc1. The exceptions are preupgrade and upgrade.
984263bc
MD
50#
51# For individuals wanting to build from the sources currently on their
52# system, the simple instructions are:
53#
54# 1. `cd /usr/src' (or to the directory containing your source tree).
55# 2. `make world'
56#
57# For individuals wanting to upgrade their sources (even if only a
58# delta of a few days):
59#
60# 1. `cd /usr/src' (or to the directory containing your source tree).
61# 2. `make buildworld'
dd7331fe
SW
62# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is X86_64_GENERIC).
63# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is X86_64_GENERIC).
30d6fede
SW
64# 5. `make installworld'
65# 6. `make upgrade'
66# 7. `reboot'
984263bc 67#
b2b3ffcd 68# If TARGET_ARCH=arch (e.g. x86_64) is specified you can
984263bc
MD
69# cross build world for other architectures using the buildworld target,
70# and once the world is built you can cross build a kernel using the
71# buildkernel target.
72#
f71956f7 73# For more information, see the build(7) manual page.
984263bc 74#
f71956f7 75
92c9dfec 76TGTS= all all-man buildkernel quickkernel realquickkernel nativekernel \
fc7aca3e 77 buildworld crossworld quickworld realquickworld checkdpadd clean \
5cccfb7b 78 cleandepend cleandir depend everything \
984263bc 79 hierarchy install installcheck installkernel \
f71956f7
AL
80 reinstallkernel installmost installworld installworld-force \
81 libraries lint maninstall \
28d76656 82 manlint mk most obj objlink regress rerelease tags \
917662e5 83 rescue backupworld restoreworld restoreworld-auto \
2decc9b9 84 backup-clean backup-auto-clean \
fd4528de 85 _obj _includes _libraries _depend _worldtmp \
9f8ba22c 86 _bootstrap-tools _build-tools _cross-tools
18cdb849 87TGTS+= mandiff # XXX temporary target
984263bc
MD
88
89BITGTS= files includes
90BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
91
92.ORDER: buildworld installworld
828e58f9
SS
93.ORDER: buildworld buildkernel
94.ORDER: buildworld nativekernel
95.ORDER: buildworld quickkernel
92c9dfec 96.ORDER: buildworld realquickkernel
828e58f9
SS
97.ORDER: buildkernel installkernel
98.ORDER: buildkernel reinstallkernel
99.ORDER: quickworld installworld
828e58f9
SS
100.ORDER: quickworld buildkernel
101.ORDER: quickworld nativekernel
102.ORDER: quickworld quickkernel
92c9dfec 103.ORDER: quickworld realquickkernel
828e58f9
SS
104.ORDER: quickkernel installkernel
105.ORDER: quickkernel reinstallkernel
92c9dfec
SW
106.ORDER: realquickkernel installkernel
107.ORDER: realquickkernel reinstallkernel
984263bc 108
ee48961f 109PATH= /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/pkg/bin
984263bc
MD
110MAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
111
112#
113# Handle the user-driven targets, using the source relative mk files.
114#
8db5e54f 115${TGTS} ${BITGTS}:
984263bc
MD
116 @cd ${.CURDIR}; \
117 ${MAKE} ${.TARGET}
118
119# Set a reasonable default
120.MAIN: all
121
122STARTTIME!= LC_ALL=C date
123#
124# world
125#
126# Attempt to rebuild and reinstall *everything*, with reasonable chance of
127# success, regardless of how old your existing system is.
128#
8db5e54f 129world:
984263bc 130 @echo "--------------------------------------------------------------"
24c1eacf 131 @echo ">>> make world started on ${STARTTIME}"
984263bc
MD
132 @echo "--------------------------------------------------------------"
133.if target(pre-world)
134 @echo
135 @echo "--------------------------------------------------------------"
24c1eacf 136 @echo ">>> starting pre-world target"
984263bc
MD
137 @echo "--------------------------------------------------------------"
138 @cd ${.CURDIR}; ${MAKE} pre-world
24c1eacf
JM
139 @echo "--------------------------------------------------------------"
140 @echo ">>> pre-world target complete"
141 @echo "--------------------------------------------------------------"
984263bc
MD
142.endif
143 @cd ${.CURDIR}; ${MAKE} buildworld
144 @cd ${.CURDIR}; ${MAKE} -B installworld
145.if target(post-world)
146 @echo
147 @echo "--------------------------------------------------------------"
24c1eacf 148 @echo ">>> starting post-world target"
984263bc
MD
149 @echo "--------------------------------------------------------------"
150 @cd ${.CURDIR}; ${MAKE} post-world
24c1eacf
JM
151 @echo "--------------------------------------------------------------"
152 @echo ">>> post-world target complete"
153 @echo "--------------------------------------------------------------"
984263bc
MD
154.endif
155 @echo
156 @echo "--------------------------------------------------------------"
24c1eacf 157 @printf ">>> make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
984263bc
MD
158 @echo "--------------------------------------------------------------"
159
160#
161# kernel
162#
163# Short hand for `make buildkernel installkernel'
164#
165kernel: buildkernel installkernel
166
984263bc
MD
167#
168# A simple test target used as part of the test to see if make supports
169# the -m argument. Also test that make will only evaluate a conditional
170# as far as is necessary to determine its value.
171#
172test:
173.if defined(notdef)
174.undef notdef
3da8e88f
JM
175.if defined(notdef) && ${notdef:tu}
176.endif
3da8e88f 177.endif
984263bc
MD
178
179#
180# Upgrade the installed make to the current version using the installed
181# headers, libraries and build tools. This is required on installed versions
182# prior to 2.2.5 in which the installed make doesn't support the -m argument.
183#
184make:
185 @echo
186 @echo "--------------------------------------------------------------"
187 @echo " Upgrading the installed make"
188 @echo "--------------------------------------------------------------"
189 @cd ${.CURDIR}/usr.bin/make; \
190 make obj && make depend && make all && make install
191
192#
30d8ccf3
SW
193# Handle the upgrade of /etc, post-installworld updating of static files
194# and removing obsolete files.
984263bc
MD
195#
196
f35282e3 197preupgrade:
ab64cf06 198 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk preupgrade
f35282e3 199
30d8ccf3 200upgrade:
ab64cf06 201 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk upgrade_etc
30d8ccf3
SW
202.if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
203 cd ${.CURDIR}/share/man; make makedb
204.endif