5.4 changes.
[dragonfly.git] / Makefile
blob7ec8ebc22f6405ec31c0f91df3b9fc351f6c54c6
2 # $FreeBSD: src/Makefile,v 1.234.2.19 2003/04/16 09:59:40 ru Exp $
4 # The user-driven targets are:
6 # buildworld - Rebuild *everything* but the kernel, including glue to
7 # help do upgrades.
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.
11 # installworld - Install everything built by "buildworld".
12 # (includes rescue and initrd image)
13 # installworld-force - Install everything built by "buildworld";
14 # special case for old systems.
15 # installrescue - Install /rescue built by buildworld
16 # installinitrd - Install initrd image built by buildworld
17 # world - buildworld + installworld.
18 # buildkernel - Rebuild the kernel and the kernel-modules from scratch
19 # using build/bootstrap/cross tools from the last
20 # buildworld.
21 # nativekernel - Rebuild the kernel and the kernel-modules from scratch
22 # using native tools.
23 # quickkernel - Rebuild the kernel quickly (build or native), and do
24 # not clean out the obj modules.
25 # realquickkernel - Like quickkernel, but skips depend too.
26 # installkernel - Install the kernel and the kernel-modules.
27 # reinstallkernel - Reinstall the kernel and the kernel-modules.
28 # kernel - buildkernel + installkernel.
29 # preupgrade - Do certain upgrades (typically the addition of new
30 # users and groups used by installed utilities) before
31 # the installworld.
32 # upgrade - Upgrade the files in /etc and also setup the rest
33 # of the system for DragonFly. ex. two compilers.
34 # rescue - Build and install the statically linked rescue tools.
35 # initrd - Build the rescue tools and create the initrd image.
36 # backupworld - Copy /bin /sbin /usr/bin /usr/sbin /usr/lib
37 # /usr/libexec to manual backup dir.
38 # restoreworld - Install binaries from manual backup dir to world.
39 # restoreworld-auto - Install binaries from auto-backup dir to world;
40 # installworld target makes backup to auto-backup dir.
41 # backup-auto-clean - Delete backup from auto-backup dir.
42 # backup-clean - Delete backup from manual backup dir.
44 # This makefile is simple by design. The DragonFly make automatically reads
45 # /usr/share/mk/sys.mk unless the -m argument is specified on the
46 # command line. By keeping this makefile simple, it doesn't matter too
47 # much how different the installed mk files are from those in the source
48 # tree. This makefile executes a child make process, forcing it to use
49 # the mk files from the source tree which are supposed to DTRT.
51 # Most of the user-driven targets (as listed above) are implemented in
52 # Makefile.inc1.
54 # For individuals wanting to build from the sources currently on their
55 # system, the simple instructions are:
57 # 1. `cd /usr/src' (or to the directory containing your source tree).
58 # 2. `make world'
60 # For individuals wanting to upgrade their sources (even if only a
61 # delta of a few days):
63 # 1. `cd /usr/src' (or to the directory containing your source tree).
64 # 2. `make buildworld'
65 # 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default X86_64_GENERIC).
66 # 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default X86_64_GENERIC).
67 # 5. `make installworld'
68 # 6. `make upgrade'
69 # 7. `reboot'
70 # 8. `make installrescue' (after making sure that the new world works well).
71 # 9. `make installinitrd' (after making sure that the new world works well).
73 # If TARGET_ARCH=arch (e.g. x86_64) is specified you can
74 # cross build world for other architectures using the buildworld target,
75 # and once the world is built you can cross build a kernel using the
76 # buildkernel target.
78 # For more information, see the build(7) manual page.
81 TGTS= all all-man buildkernel quickkernel realquickkernel nativekernel \
82 buildworld crossworld quickworld realquickworld checkdpadd clean \
83 cleandepend cleandir depend everything \
84 hierarchy install installcheck installkernel \
85 reinstallkernel installworld installworld-force \
86 rescue initrd \
87 quickrescue quickinitrd installrescue installinitrd \
88 libraries lint maninstall \
89 manlint mk obj objlink regress rerelease tags \
90 backupworld restoreworld restoreworld-auto \
91 backup-clean backup-auto-clean \
92 _obj _includes _libraries _depend _worldtmp \
93 _bootstrap-tools _build-tools _cross-tools
94 TGTS+= mandiff # XXX temporary target
96 BITGTS= files includes
97 BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
99 .ORDER: buildworld installworld
100 .ORDER: buildworld buildkernel
101 .ORDER: buildworld nativekernel
102 .ORDER: buildworld quickkernel
103 .ORDER: buildworld realquickkernel
104 .ORDER: buildkernel installkernel
105 .ORDER: buildkernel reinstallkernel
106 .ORDER: quickworld installworld
107 .ORDER: quickworld buildkernel
108 .ORDER: quickworld nativekernel
109 .ORDER: quickworld quickkernel
110 .ORDER: quickworld realquickkernel
111 .ORDER: quickkernel installkernel
112 .ORDER: quickkernel reinstallkernel
113 .ORDER: realquickkernel installkernel
114 .ORDER: realquickkernel reinstallkernel
116 PATH= /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/pkg/bin
117 MAKE= PATH=${PATH} make -m ${.CURDIR}/share/mk -f Makefile.inc1
120 # Handle the user-driven targets, using the source relative mk files.
122 ${TGTS} ${BITGTS}:
123 @cd ${.CURDIR}; \
124 ${MAKE} ${.TARGET}
126 # Set a reasonable default
127 .MAIN: all
129 STARTTIME!= LC_ALL=C date
131 # world
133 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
134 # success, regardless of how old your existing system is.
136 world:
137 @echo "--------------------------------------------------------------"
138 @echo ">>> make world started on ${STARTTIME}"
139 @echo "--------------------------------------------------------------"
140 .if target(pre-world)
141 @echo
142 @echo "--------------------------------------------------------------"
143 @echo ">>> starting pre-world target"
144 @echo "--------------------------------------------------------------"
145 @cd ${.CURDIR}; ${MAKE} pre-world
146 @echo "--------------------------------------------------------------"
147 @echo ">>> pre-world target complete"
148 @echo "--------------------------------------------------------------"
149 .endif
150 @cd ${.CURDIR}; ${MAKE} buildworld
151 @cd ${.CURDIR}; ${MAKE} -B installworld
152 .if target(post-world)
153 @echo
154 @echo "--------------------------------------------------------------"
155 @echo ">>> starting post-world target"
156 @echo "--------------------------------------------------------------"
157 @cd ${.CURDIR}; ${MAKE} post-world
158 @echo "--------------------------------------------------------------"
159 @echo ">>> post-world target complete"
160 @echo "--------------------------------------------------------------"
161 .endif
162 @echo
163 @echo "--------------------------------------------------------------"
164 @printf ">>> make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
165 @echo "--------------------------------------------------------------"
168 # kernel
170 # Short hand for `make buildkernel installkernel'
172 kernel: buildkernel installkernel
175 # A simple test target used as part of the test to see if make supports
176 # the -m argument. Also test that make will only evaluate a conditional
177 # as far as is necessary to determine its value.
179 test:
180 .if defined(notdef)
181 .undef notdef
182 .if defined(notdef) && ${notdef:tu}
183 .endif
184 .endif
187 # Upgrade the installed make to the current version using the installed
188 # headers, libraries and build tools. This is required on installed versions
189 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
191 make:
192 @echo
193 @echo "--------------------------------------------------------------"
194 @echo " Upgrading the installed make"
195 @echo "--------------------------------------------------------------"
196 @cd ${.CURDIR}/usr.bin/make; \
197 make obj && make depend && make all && make install
200 # Handle the upgrade of /etc, post-installworld updating of static files
201 # and removing obsolete files.
204 preupgrade:
205 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk preupgrade
207 upgrade:
208 @cd ${.CURDIR}/etc; make -m ${.CURDIR}/share/mk upgrade_etc
209 .if !defined(NOMAN) && !defined(NO_MAKEDB_RUN)
210 @cd ${.CURDIR}/share/man; make makedb
211 .endif
212 @echo "--------------------------------------------------------------"
213 @echo "Now you can reboot into the new system! If the new system works as"
214 @echo "expected, consider updating the rescue tools and initrd image with:"
215 @echo " # cd ${.CURDIR}; make initrd"
216 @echo "NOTE: Do this only after verifying the new system works as expected!"
217 @echo ""
218 @echo "You also need to upgrade the 3rd-party packages with:"
219 @echo " # pkg update; pkg [-f] upgrade"
220 @echo "--------------------------------------------------------------"