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