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
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", and the
12 # rescue tools and initrd image if they do not exist.
13 # installworld-force - Install everything built by "buildworld";
14 # special case for old systems.
15 # world - buildworld + installworld.
16 # buildkernel - Rebuild the kernel and the kernel-modules from scratch
17 # using build/bootstrap/cross tools from the last
19 # nativekernel - Rebuild the kernel and the kernel-modules from scratch
21 # quickkernel - Rebuild the kernel quickly (build or native), and do
22 # not clean out the obj modules.
23 # realquickkernel - Like quickkernel, but skips depend too.
24 # installkernel - Install the kernel and the kernel-modules.
25 # reinstallkernel - Reinstall the kernel and the kernel-modules.
26 # kernel - buildkernel + installkernel.
27 # preinstall - Do certain operations (typically the addition of new
28 # users and groups used by utilities to be installed)
29 # before doing installworld.
30 # upgrade - Upgrade the files in /etc and also setup the rest
31 # of the system for DragonFly. ex. two compilers.
32 # build-all - Runs buildworld and buildkernel both with -j hw.ncpu
33 # install-all - Runs installkernel, installworld and upgrade all with
35 # initrd - Install the statically linked rescue tools and the
36 # initrd image built by "buildworld".
37 # backupworld - Copy /bin /sbin /usr/bin /usr/sbin /usr/lib
38 # /usr/libexec to manual backup dir.
39 # restoreworld - Install binaries from manual backup dir to world.
40 # restoreworld-auto - Install binaries from auto-backup dir to world;
41 # installworld target makes backup to auto-backup dir.
42 # backup-auto-clean - Delete backup from auto-backup dir.
43 # backup-clean - Delete backup from manual backup dir.
45 # This makefile is simple by design. The DragonFly make automatically reads
46 # /usr/share/mk/sys.mk unless the -m argument is specified on the
47 # command line. By keeping this makefile simple, it doesn't matter too
48 # much how different the installed mk files are from those in the source
49 # tree. This makefile executes a child make process, forcing it to use
50 # the mk files from the source tree which are supposed to DTRT.
52 # Most of the user-driven targets (as listed above) are implemented in
55 # For individuals wanting to build from the sources currently on their
56 # system, the simple instructions are:
58 # 1. `cd /usr/src' (or to the directory containing your source tree).
61 # For individuals wanting to upgrade their sources (even if only a
62 # delta of a few days):
64 # 1. `cd /usr/src' (or to the directory containing your source tree).
65 # 2. `make buildworld'
66 # 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default X86_64_GENERIC).
67 # 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default X86_64_GENERIC).
68 # 5. `make installworld'
71 # 8. `make initrd' (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
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 os-release initrd \
86 libraries lint maninstall \
87 manlint mk obj objlink regress rerelease
tags \
88 backupworld restoreworld restoreworld-auto \
89 build-all install-all \
90 backup-clean backup-auto-clean \
91 _obj _includes _libraries _depend _worldtmp \
92 _bootstrap-tools _build-tools _cross-tools
93 #TGTS+= mandiff # XXX temporary target
95 BITGTS
= files includes
96 BITGTS
:=${BITGTS} ${BITGTS
:S
/^
/build
/} ${BITGTS
:S
/^
/install/}
98 .ORDER
: buildworld installworld
99 .ORDER
: buildworld buildkernel
100 .ORDER
: buildworld nativekernel
101 .ORDER
: buildworld quickkernel
102 .ORDER
: buildworld realquickkernel
103 .ORDER
: buildkernel installkernel
104 .ORDER
: buildkernel reinstallkernel
105 .ORDER
: quickworld installworld
106 .ORDER
: quickworld buildkernel
107 .ORDER
: quickworld nativekernel
108 .ORDER
: quickworld quickkernel
109 .ORDER
: quickworld realquickkernel
110 .ORDER
: quickkernel installkernel
111 .ORDER
: quickkernel reinstallkernel
112 .ORDER
: realquickkernel installkernel
113 .ORDER
: realquickkernel reinstallkernel
114 .ORDER
: build-all install-all
116 _HOSTPATH
= /sbin
:/bin
:/usr
/sbin
:/usr
/bin
:/usr
/local
/bin
:/usr
/pkg
/bin
117 MAKE
= PATH
=${_HOSTPATH} make
-m
${.CURDIR
}/share
/mk
-f Makefile.inc1
120 # Handle the user-driven targets, using the source relative mk files.
122 ${TGTS} ${BITGTS}: .PHONY
126 # Fail with an error when no target is given.
131 @echo
"Explicit target required. See build(7)."
135 STARTTIME
!= LC_ALL
=C date
140 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
141 # success, regardless of how old your existing system is.
144 @echo
"--------------------------------------------------------------"
145 @echo
">>> make world started on ${STARTTIME}"
146 @echo
"--------------------------------------------------------------"
147 .if target
(pre-world
)
149 @echo
"--------------------------------------------------------------"
150 @echo
">>> starting pre-world target"
151 @echo
"--------------------------------------------------------------"
152 @cd
${.CURDIR
}; ${MAKE} pre-world
153 @echo
"--------------------------------------------------------------"
154 @echo
">>> pre-world target complete"
155 @echo
"--------------------------------------------------------------"
157 @cd
${.CURDIR
}; ${MAKE} buildworld
158 @cd
${.CURDIR
}; ${MAKE} -B installworld
159 .if target
(post-world
)
161 @echo
"--------------------------------------------------------------"
162 @echo
">>> starting post-world target"
163 @echo
"--------------------------------------------------------------"
164 @cd
${.CURDIR
}; ${MAKE} post-world
165 @echo
"--------------------------------------------------------------"
166 @echo
">>> post-world target complete"
167 @echo
"--------------------------------------------------------------"
170 @echo
"--------------------------------------------------------------"
171 @printf
">>> make world completed on `LC_ALL=C date`\n (started ${STARTTIME})\n"
172 @echo
"--------------------------------------------------------------"
176 # Short hand for `make buildkernel installkernel'
178 kernel
: buildkernel installkernel
181 # A simple test target used as part of the test to see if make supports
182 # the -m argument. Also test that make will only evaluate a conditional
183 # as far as is necessary to determine its value.
188 .if defined
(notdef
) && ${notdef
:tu
}
193 # Upgrade the installed make to the current version using the installed
194 # headers, libraries and build tools. This is required on installed versions
195 # prior to 2.2.5 in which the installed make doesn't support the -m argument.
199 @echo
"--------------------------------------------------------------"
200 @echo
" Upgrading the installed make"
201 @echo
"--------------------------------------------------------------"
202 @cd
${.CURDIR
}/usr.bin
/make
; \
203 make obj
&& make depend
&& make
all && make
install
205 # Handle pre-installworld operations (e.g., creating of new users/groups).
207 installworld
: preinstall
209 @cd
${.CURDIR
}/etc
; make
-m
${.CURDIR
}/share
/mk preinstall
211 # Handle the upgrade of /etc, post-installworld updating of static files
212 # and removing obsolete files.
215 @cd
${.CURDIR
}/etc
; make
-m
${.CURDIR
}/share
/mk upgrade_etc
216 .if
!defined
(NOMAN
) && !defined
(NO_MAKEDB_RUN
)
217 @cd
${.CURDIR
}/share
/man
; make makedb
219 @echo
"--------------------------------------------------------------"
220 @echo
"Now you can reboot into the new system! If the new system works as"
221 @echo
"expected, consider updating the rescue tools and initrd image with:"
222 @echo
" # cd ${.CURDIR}; make initrd"
223 @echo
"NOTE: Do this only after verifying the new system works as expected!"
225 @echo
"You also need to upgrade the 3rd-party packages with:"
226 @echo
" # pkg update; pkg upgrade [-f]"
227 @echo
"--------------------------------------------------------------"