Commit | Line | Data |
---|---|---|
984263bc MD |
1 | # |
2 | # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $ | |
cecff5c1 MD |
3 | # |
4 | # Build-time options are documented in make.conf(5). | |
984263bc MD |
5 | # |
6 | # The intended user-driven targets are: | |
1397f94a | 7 | # |
984263bc | 8 | # buildworld - rebuild *everything*, including glue to help do upgrades |
1397f94a MD |
9 | # quickworld - skip the glue and do a depend+build on the meat |
10 | # realquickworld - skip the glue and depend stages and just build the meat | |
11 | # crossworld - only build the glue (particularly the cross-build environment) | |
984263bc | 12 | # installworld- install everything built by "buildworld" |
2decc9b9 JM |
13 | # backupworld - copies /bin /sbin /usr/bin /usr/sbin /usr/lib /usr/libexec |
14 | # to manual backup dir | |
15 | # restoreworld- installs binaries from manual backup dir to world | |
16 | # restoreworld-auto - installs binaries from auto-backup dir to world | |
984263bc MD |
17 | # most - build user commands, no libraries or include files |
18 | # installmost - install user commands, no libraries or include files | |
2decc9b9 JM |
19 | # backup-clean - delete backup from manual backup dir |
20 | # backup-auto-clean - delete backup from auto-backup dir | |
984263bc MD |
21 | # |
22 | # Standard targets (not defined here) are documented in the makefiles in | |
23 | # /usr/share/mk. These include: | |
24 | # obj depend all install clean cleandepend cleanobj | |
25 | ||
26 | # Put initial settings here. | |
27 | SUBDIR= | |
28 | ||
16dbe6a9 FT |
29 | # /libexec/ld-elf.so.2 needs to be installed first |
30 | # Otherwise, install(1) beeing a dynamically linked binary will fail | |
31 | # during the first upgrade from a static to a dynamic world | |
32 | .if exists(${.CURDIR}/libexec) | |
33 | SUBDIR+= libexec | |
34 | .endif | |
35 | ||
984263bc MD |
36 | # We must do share/info early so that installation of info `dir' |
37 | # entries works correctly. Do it first since it is less likely to | |
38 | # grow dependencies on include and lib than vice versa. | |
39 | .if exists(${.CURDIR}/share/info) | |
40 | SUBDIR+= share/info | |
41 | .endif | |
42 | ||
43 | # We must do include and lib early so that the perl *.ph generation | |
44 | # works correctly as it uses the header files installed by this. | |
45 | .if exists(${.CURDIR}/include) | |
46 | SUBDIR+= include | |
47 | .endif | |
48 | .if exists(${.CURDIR}/lib) | |
49 | SUBDIR+= lib | |
50 | .endif | |
17d0fefe MD |
51 | # This exists simply to ensure that the obj dir hierarchy is |
52 | # intact for nrelease, allowing the nrelease Makefile's to | |
53 | # reference ${.OBJDIR}. | |
54 | # | |
55 | .if exists(${.CURDIR}/nrelease) | |
56 | SUBDIR+= nrelease | |
57 | .endif | |
984263bc MD |
58 | |
59 | .if exists(${.CURDIR}/bin) | |
60 | SUBDIR+= bin | |
61 | .endif | |
cecff5c1 | 62 | .if exists(${.CURDIR}/games) && !defined(NO_GAMES) |
984263bc MD |
63 | SUBDIR+= games |
64 | .endif | |
65 | .if exists(${.CURDIR}/gnu) | |
66 | SUBDIR+= gnu | |
67 | .endif | |
984263bc MD |
68 | .if exists(${.CURDIR}/sbin) |
69 | SUBDIR+= sbin | |
70 | .endif | |
cecff5c1 | 71 | .if exists(${.CURDIR}/secure) && !defined(NO_CRYPT) |
984263bc MD |
72 | SUBDIR+= secure |
73 | .endif | |
cecff5c1 | 74 | .if exists(${.CURDIR}/share) && !defined(NO_SHARE) |
984263bc MD |
75 | SUBDIR+= share |
76 | .endif | |
77 | .if exists(${.CURDIR}/sys) | |
78 | SUBDIR+= sys | |
79 | .endif | |
80 | .if exists(${.CURDIR}/usr.bin) | |
81 | SUBDIR+= usr.bin | |
82 | .endif | |
83 | .if exists(${.CURDIR}/usr.sbin) | |
84 | SUBDIR+= usr.sbin | |
85 | .endif | |
86 | ||
984263bc MD |
87 | .if exists(${.CURDIR}/etc) |
88 | SUBDIR+= etc | |
89 | .endif | |
90 | ||
91 | # These are last, since it is nice to at least get the base system | |
92 | # rebuilt before you do them. | |
93 | .if defined(LOCAL_DIRS) | |
94 | .for _DIR in ${LOCAL_DIRS} | |
95 | .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile) | |
96 | SUBDIR+= ${_DIR} | |
97 | .endif | |
98 | .endfor | |
99 | .endif | |
100 | ||
101 | .if defined(SUBDIR_OVERRIDE) | |
102 | SUBDIR= ${SUBDIR_OVERRIDE} | |
103 | .endif | |
104 | ||
105 | .if defined(NOCLEANDIR) | |
106 | CLEANDIR= clean cleandepend | |
107 | .else | |
108 | CLEANDIR= cleandir | |
109 | .endif | |
110 | ||
9974d917 SS |
111 | .if defined(NO_CLEAN) |
112 | NOCLEAN= # defined | |
113 | .endif | |
d0a8f509 | 114 | |
1397f94a MD |
115 | # Object directory base in primary make. Note that when we rerun make |
116 | # from inside this file we change MAKEOBJDIRPREFIX to the appropriate | |
117 | # subdirectory because the rest of the build system needs it that way. | |
118 | # The original object directory base is saved in OBJTREE. | |
119 | # | |
984263bc | 120 | MAKEOBJDIRPREFIX?= /usr/obj |
1397f94a MD |
121 | OBJTREE?= ${MAKEOBJDIRPREFIX} |
122 | ||
123 | # Used for stage installs and pathing | |
124 | # | |
75d86d8d | 125 | DESTDIRBASE:= ${OBJTREE}${.CURDIR} |
1397f94a | 126 | |
c89fd520 SS |
127 | # Remove DESTDIR from MAKEFLAGS. It is present in the environment |
128 | # anyhow, and we need to be able to override it for stage installs | |
129 | .MAKEFLAGS:= ${.MAKEFLAGS:NDESTDIR=*} | |
130 | ||
0756733f | 131 | # This section sets the tools used to build the world/kernel |
6100d1de | 132 | WORLD_CCVER?= gcc47 |
0756733f | 133 | WORLD_LDVER?= ld.bfd |
e05895f1 | 134 | WORLD_BINUTILSVER?= binutils224 |
ded5c503 | 135 | |
7bee86c0 JM |
136 | # Set the backup parameters if they are not already defined |
137 | # | |
61443441 | 138 | WORLD_BACKUP?= /var/backups/world_backup |
2decc9b9 | 139 | AUTO_BACKUP?= ${OBJTREE}/world_backup/${DESTDIR} |
7bee86c0 | 140 | |
984263bc MD |
141 | TARGET_ARCH?= ${MACHINE_ARCH} |
142 | .if ${TARGET_ARCH} == ${MACHINE_ARCH} | |
143 | TARGET?= ${MACHINE} | |
144 | .else | |
145 | TARGET?= ${TARGET_ARCH} | |
146 | .endif | |
147 | .if make(buildworld) | |
148 | BUILD_ARCH!= sysctl -n hw.machine_arch | |
b2b3ffcd SS |
149 | |
150 | # temporary until everybody has converted to x86_64 | |
151 | .if ${BUILD_ARCH} == "amd64" | |
152 | BUILD_ARCH= x86_64 | |
153 | .endif | |
154 | ||
984263bc MD |
155 | .if ${MACHINE_ARCH} != ${BUILD_ARCH} |
156 | .error To cross-build, set TARGET_ARCH. | |
157 | .endif | |
158 | .endif | |
1397f94a | 159 | |
0955fd91 MD |
160 | # Backwards compatibility with older make's or older sys.mk's. make |
161 | # is expected to define MACHINE_PLATFORM. | |
162 | # | |
163 | .if !defined(MACHINE_PLATFORM) | |
164 | MACHINE_PLATFORM= pc32 | |
165 | .endif | |
4d005c1d SS |
166 | |
167 | # XXX this is ugly and we need to come up with a nicer solution | |
168 | .if !defined(TARGET_PLATFORM) | |
169 | .if ${TARGET_ARCH} == "i386" | |
170 | TARGET_PLATFORM= pc32 | |
b2b3ffcd | 171 | .elif ${TARGET_ARCH} == "x86_64" |
4d005c1d SS |
172 | TARGET_PLATFORM= pc64 |
173 | .else | |
174 | .error Unknown target architecture. | |
175 | .endif | |
176 | .endif | |
0955fd91 | 177 | |
5f87b7d3 SZ |
178 | THREAD_LIB?= thread_xu |
179 | .if ${THREAD_LIB} == "c_r" | |
180 | .if defined(NO_LIBC_R) | |
181 | .error libc_r is chosen as the default thread library, but NO_LIBC_R is defined | |
182 | .endif | |
183 | .endif | |
184 | ||
1397f94a MD |
185 | # BTOOLS (Natively built) All non-cross-development tools that the |
186 | # main build needs. This includes things like 'mkdir' and 'rm'. | |
187 | # We will not use the native system's exec path once we start | |
188 | # on WORLD. (bootstrap-tools and build-tools or BTOOLS) | |
189 | # | |
190 | # CTOOLS (Natively built) Cross development tools which are specific | |
191 | # to the target architecture. | |
192 | # | |
193 | # WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and | |
194 | # CTOOLS. | |
195 | # | |
0955fd91 MD |
196 | # MACHINE_PLATFORM Platform Architecture we are building on |
197 | # MACHINE Machine Architecture (usually the same as MACHINE_ARCH) | |
e2ea6619 MD |
198 | # MACHINE_ARCH Cpu Architecture we are building on |
199 | # | |
0955fd91 MD |
200 | # TARGET_PLATFORM Platform Architecture we are building for |
201 | # TARGET Machine Architecture we are building for | |
e2ea6619 | 202 | # TARGET_ARCH Cpu Architecture we are building for |
1397f94a MD |
203 | # |
204 | BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH} | |
205 | CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH} | |
206 | WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH} | |
207 | ||
79aa78bc MD |
208 | # The bootstrap-tools path is used by the bootstrap-tools, build-tools, and |
209 | # cross-tools stages to augment the existing command path to access newer | |
210 | # versions of certain utilities such as 'patch' that the cross-tools stage | |
211 | # might expect. | |
212 | # | |
213 | BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games | |
214 | ||
1397f94a MD |
215 | # The strict temporary command path contains all binaries required |
216 | # by the buildworld system after the cross-tools stage. | |
217 | # | |
ee48961f | 218 | STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games:/usr/local/bin:/usr/pkg/bin |
984263bc MD |
219 | |
220 | TMPDIR?= /tmp | |
221 | TMPPID!= echo $$$$ | |
984263bc MD |
222 | |
223 | # | |
224 | # Building a world goes through the following stages | |
225 | # | |
226 | # 1. bootstrap-tool stage [BMAKE] | |
227 | # This stage is responsible for creating programs that | |
228 | # are needed for backward compatibility reasons. They | |
229 | # are not built as cross-tools. | |
230 | # 2. build-tool stage [TMAKE] | |
231 | # This stage is responsible for creating the object | |
232 | # tree and building any tools that are needed during | |
233 | # the build process. | |
234 | # 3. cross-tool stage [XMAKE] | |
235 | # This stage is responsible for creating any tools that | |
236 | # are needed for cross-builds. A cross-compiler is one | |
237 | # of them. | |
238 | # 4. world stage [WMAKE] | |
239 | # This stage actually builds the world. | |
240 | # 5. install stage (optional) [IMAKE] | |
241 | # This stage installs a previously built world. | |
242 | # | |
e92bae40 MD |
243 | # In all cases we must carefully adjust the environment so the proper |
244 | # tools and header files are used. | |
245 | # | |
246 | # NOTE: The M4 environment variable is used by the [f]lex binary to | |
247 | # override the location of the 'm4' binary. The override is | |
248 | # needed for certain buildworld version transitions, specifically | |
249 | # past a certain point in 3.3 because the older /usr/bin/m4 will | |
250 | # generate output that will blow up the newer [f]lex/yacc/bison | |
251 | # utilities. | |
252 | # | |
984263bc | 253 | |
984263bc | 254 | # bootstrap-tool stage |
1397f94a MD |
255 | # |
256 | BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \ | |
257 | OBJTREE=${OBJTREE} \ | |
44831353 | 258 | DESTDIR=${BTOOLSDEST} \ |
79aa78bc | 259 | PATH=${BTOOLSPATH}:${PATH} \ |
e92bae40 | 260 | M4=${BTOOLSDEST}/usr/bin/m4 \ |
984263bc | 261 | INSTALL="sh ${.CURDIR}/tools/install.sh" |
1397f94a | 262 | |
f8a75064 | 263 | BMAKE= ${BMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \ |
e486d225 SS |
264 | -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \ |
265 | -DNO_WERROR -DNO_NLS | |
984263bc MD |
266 | |
267 | # build-tool stage | |
1397f94a MD |
268 | # |
269 | TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \ | |
270 | OBJTREE=${OBJTREE} \ | |
984263bc | 271 | DESTDIR= \ |
79aa78bc | 272 | PATH=${BTOOLSPATH}:${PATH} \ |
e92bae40 | 273 | M4=${BTOOLSDEST}/usr/bin/m4 \ |
984263bc | 274 | INSTALL="sh ${.CURDIR}/tools/install.sh" |
1397f94a | 275 | |
f8a75064 | 276 | TMAKE= ${TMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \ |
e486d225 | 277 | -DNO_FORTRAN -DNOSHARED |
984263bc MD |
278 | |
279 | # cross-tool stage | |
1397f94a MD |
280 | # |
281 | # note: TOOLS_PREFIX points to the obj root holding the cross | |
44831353 MD |
282 | # compiler binaries, while USRDATA_PREFIX points to the obj root |
283 | # holding the target environment (and also determines where cross-built | |
284 | # libraries, crt*.o, and include files are installed). | |
1397f94a MD |
285 | # |
286 | XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \ | |
287 | OBJTREE=${OBJTREE} \ | |
288 | DESTDIR=${CTOOLSDEST} \ | |
aa8dd846 | 289 | _SHLIBDIRPREFIX=${CTOOLSDEST} \ |
1397f94a MD |
290 | INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
291 | TOOLS_PREFIX=${CTOOLSDEST} \ | |
79aa78bc | 292 | USRDATA_PREFIX=${WORLDDEST} \ |
e92bae40 | 293 | M4=${BTOOLSDEST}/usr/bin/m4 \ |
79aa78bc | 294 | PATH=${BTOOLSPATH}:${PATH} |
1397f94a | 295 | |
f8a75064 | 296 | XMAKE= ${XMAKEENV} make -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \ |
e486d225 | 297 | -DBOOTSTRAPPING -DNOSHARED |
1397f94a MD |
298 | |
299 | # world stage, note the strict path and note that TOOLS_PREFIX is left | |
300 | # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty, | |
301 | # which is primarily for the compiler so it targets / (e.g. /usr/<blah>) | |
302 | # for both binary and library paths, even though it is being compiled to | |
303 | # WORLDDEST. None of the programs in the world stage are ever actually | |
304 | # executed during the buildworld/installworld. | |
305 | # | |
306 | CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \ | |
307 | OBJTREE=${OBJTREE} \ | |
308 | MACHINE_ARCH=${TARGET_ARCH} \ | |
309 | MACHINE=${TARGET} \ | |
0955fd91 | 310 | MACHINE_PLATFORM=${TARGET_PLATFORM} \ |
ded5c503 | 311 | OBJFORMAT_PATH=${CTOOLSDEST} \ |
ce6fa878 | 312 | HOST_CCVER=${HOST_CCVER} \ |
123dec51 | 313 | CCVER=${WORLD_CCVER} \ |
0756733f | 314 | LDVER=${WORLD_LDVER} \ |
123dec51 | 315 | BINUTILSVER=${WORLD_BINUTILSVER} |
984263bc | 316 | |
984263bc | 317 | WMAKEENV= ${CROSSENV} \ |
1397f94a | 318 | DESTDIR=${WORLDDEST} \ |
aa8dd846 | 319 | _SHLIBDIRPREFIX=${WORLDDEST} \ |
984263bc | 320 | INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
e92bae40 | 321 | M4=${BTOOLSDEST}/usr/bin/m4 \ |
1397f94a MD |
322 | PATH=${STRICTTMPPATH} |
323 | ||
f8a75064 | 324 | WMAKE= ${WMAKEENV} make -f Makefile.inc1 |
984263bc MD |
325 | |
326 | # install stage | |
b07b69cc | 327 | # |
984263bc | 328 | IMAKEENV= ${CROSSENV} \ |
1397f94a | 329 | PATH=${STRICTTMPPATH} |
f8a75064 | 330 | IMAKE= ${IMAKEENV} make -f Makefile.inc1 |
984263bc MD |
331 | |
332 | # kernel stage | |
b07b69cc MD |
333 | # |
334 | KMAKEENV= ${WMAKEENV} | |
984263bc | 335 | |
984263bc MD |
336 | # buildworld |
337 | # | |
338 | # Attempt to rebuild the entire system, with reasonable chance of | |
339 | # success, regardless of how old your existing system is. | |
340 | # | |
2cde9453 SS |
341 | _worldtmp: _cleantmp _mtreetmp |
342 | .ORDER: _cleantmp _mtreetmp | |
343 | ||
344 | _cleantmp: | |
984263bc MD |
345 | @echo |
346 | @echo "--------------------------------------------------------------" | |
347 | @echo ">>> Rebuilding the temporary build tree" | |
348 | @echo "--------------------------------------------------------------" | |
349 | .if !defined(NOCLEAN) | |
1397f94a | 350 | rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST} |
984263bc MD |
351 | .else |
352 | # XXX - These two can depend on any header file. | |
353 | rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c | |
354 | rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c | |
355 | .endif | |
2cde9453 SS |
356 | |
357 | _mtreetmp: | |
1397f94a MD |
358 | mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST} |
359 | .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST} | |
360 | mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ | |
361 | -p ${_dir}/ > /dev/null | |
362 | mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ | |
363 | -p ${_dir}/usr > /dev/null | |
984263bc | 364 | .endfor |
1397f94a MD |
365 | mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ |
366 | -p ${WORLDDEST}/usr/include > /dev/null | |
062db326 | 367 | ${LN} -sf ${.CURDIR}/sys ${WORLDDEST} |
1397f94a | 368 | |
984263bc MD |
369 | _bootstrap-tools: |
370 | @echo | |
371 | @echo "--------------------------------------------------------------" | |
372 | @echo ">>> stage 1: bootstrap tools" | |
373 | @echo "--------------------------------------------------------------" | |
374 | cd ${.CURDIR}; ${BMAKE} bootstrap-tools | |
375 | _cleanobj: | |
984263bc MD |
376 | @echo |
377 | @echo "--------------------------------------------------------------" | |
1397f94a | 378 | @echo ">>> stage 2a: cleaning up the object tree" |
984263bc MD |
379 | @echo "--------------------------------------------------------------" |
380 | cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} | |
984263bc MD |
381 | _obj: |
382 | @echo | |
383 | @echo "--------------------------------------------------------------" | |
1397f94a | 384 | @echo ">>> stage 2b: rebuilding the object tree" |
984263bc MD |
385 | @echo "--------------------------------------------------------------" |
386 | cd ${.CURDIR}; ${WMAKE} par-obj | |
387 | _build-tools: | |
388 | @echo | |
389 | @echo "--------------------------------------------------------------" | |
1397f94a | 390 | @echo ">>> stage 2c: build tools" |
984263bc MD |
391 | @echo "--------------------------------------------------------------" |
392 | cd ${.CURDIR}; ${TMAKE} build-tools | |
393 | _cross-tools: | |
394 | @echo | |
395 | @echo "--------------------------------------------------------------" | |
396 | @echo ">>> stage 3: cross tools" | |
397 | @echo "--------------------------------------------------------------" | |
398 | cd ${.CURDIR}; ${XMAKE} cross-tools | |
399 | _includes: | |
400 | @echo | |
401 | @echo "--------------------------------------------------------------" | |
1397f94a | 402 | @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include" |
984263bc MD |
403 | @echo "--------------------------------------------------------------" |
404 | cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes | |
405 | _libraries: | |
406 | @echo | |
407 | @echo "--------------------------------------------------------------" | |
1397f94a | 408 | @echo ">>> stage 4b: building libraries" |
984263bc MD |
409 | @echo "--------------------------------------------------------------" |
410 | cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries | |
411 | _depend: | |
412 | @echo | |
413 | @echo "--------------------------------------------------------------" | |
1397f94a | 414 | @echo ">>> stage 4c: make dependencies" |
984263bc MD |
415 | @echo "--------------------------------------------------------------" |
416 | cd ${.CURDIR}; ${WMAKE} par-depend | |
417 | everything: | |
418 | @echo | |
419 | @echo "--------------------------------------------------------------" | |
1397f94a | 420 | @echo ">>> stage 4d: building everything.." |
984263bc MD |
421 | @echo "--------------------------------------------------------------" |
422 | cd ${.CURDIR}; ${WMAKE} all | |
423 | ||
1397f94a MD |
424 | # note: buildworld no longer depends on _cleanobj because we rm -rf the |
425 | # entire object tree and built the bootstrap tools in a different location. | |
426 | # | |
427 | # buildworld - build everything from scratch | |
428 | # quickworld - skip the bootstrap, build, and cross-build steps | |
429 | # realquickworld - skip the bootstrap, build, crossbuild, and depend step. | |
430 | # | |
431 | # note: we include _obj in realquickworld to prevent accidental creation | |
432 | # of files in /usr/src. | |
984263bc | 433 | |
c08b39fe | 434 | WMAKE_TGTS= |
984263bc MD |
435 | .if !defined(SUBDIR_OVERRIDE) |
436 | WMAKE_TGTS+= _worldtmp _bootstrap-tools | |
437 | .endif | |
1397f94a | 438 | WMAKE_TGTS+= _obj _build-tools |
984263bc MD |
439 | .if !defined(SUBDIR_OVERRIDE) |
440 | WMAKE_TGTS+= _cross-tools | |
441 | .endif | |
442 | WMAKE_TGTS+= _includes _libraries _depend everything | |
443 | ||
444 | buildworld: ${WMAKE_TGTS} | |
1397f94a | 445 | |
2cde9453 | 446 | quickworld: _mtreetmp _obj _includes _libraries _depend everything |
1397f94a | 447 | |
2cde9453 | 448 | realquickworld: _mtreetmp _obj _includes _libraries everything |
1397f94a MD |
449 | |
450 | crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools | |
451 | ||
984263bc | 452 | .ORDER: ${WMAKE_TGTS} |
9ce30817 | 453 | .ORDER: _obj _includes |
2cde9453 | 454 | .ORDER: _mtreetmp _obj |
61443441 | 455 | .ORDER: installcheck backupworld-auto |
984263bc MD |
456 | |
457 | # | |
458 | # installcheck | |
459 | # | |
c08b39fe | 460 | # Checks to be sure system is ready for installworld |
984263bc MD |
461 | # |
462 | installcheck: | |
463 | .if !defined(NO_SENDMAIL) | |
3da8e88f JM |
464 | @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false) |
465 | @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false) | |
984263bc | 466 | .endif |
3da8e88f JM |
467 | @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false) |
468 | @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false) | |
469 | @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; /usr/bin/false) | |
9b815a46 | 470 | .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/" |
3da8e88f | 471 | @case `uname -r` in 1.2*|1.3-*|1.3.*|1.4.*|1.5.0-*|1.5.1-*|1.5.2-*|1.5.3-*) echo "You must upgrade your kernel to at least 1.5.4 and reboot before you can safely installworld, due to libc/system call ABI changes" ; /usr/bin/false ; esac |
9b815a46 | 472 | .endif |
1516019b | 473 | |
984263bc MD |
474 | # |
475 | # installworld | |
476 | # | |
1516019b | 477 | # Backs up the current world if ${AUTO_BACKUP} is writable. |
984263bc | 478 | # Installs everything compiled by a 'buildworld'. |
1516019b MD |
479 | |
480 | installworld: installcheck | |
481 | -@mkdir -p ${AUTO_BACKUP} > /dev/null 2>&1 | |
482 | @cd ${.CURDIR}; \ | |
483 | (touch ${AUTO_BACKUP}/.updating > /dev/null 2>&1 && \ | |
484 | ${IMAKE} backupworld-auto) || \ | |
485 | echo "Cannot write to ${AUTO_BACKUP} - world not backed up" | |
486 | ||
984263bc | 487 | cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} |
ec6483ce | 488 | ${INSTALL} -o root -g wheel -m 644 ${.CURDIR}/Makefile_upgrade.inc ${DESTDIR}/etc/upgrade/ |
a93ddcbb | 489 | mkinitrd -b ${DESTDIR}/boot |
984263bc MD |
490 | |
491 | # | |
492 | # reinstall | |
493 | # | |
494 | # If you have a build server, you can NFS mount the source and obj directories | |
495 | # and do a 'make reinstall' on the *client* to install new binaries from the | |
496 | # most recent server build. | |
497 | # | |
498 | reinstall: | |
499 | @echo "--------------------------------------------------------------" | |
500 | @echo ">>> Making hierarchy" | |
501 | @echo "--------------------------------------------------------------" | |
f8a75064 | 502 | cd ${.CURDIR}; make -f Makefile.inc1 hierarchy |
984263bc MD |
503 | @echo |
504 | @echo "--------------------------------------------------------------" | |
505 | @echo ">>> Installing everything.." | |
506 | @echo "--------------------------------------------------------------" | |
f8a75064 | 507 | cd ${.CURDIR}; make -f Makefile.inc1 install |
984263bc | 508 | |
984263bc | 509 | # |
fc7aca3e | 510 | # buildkernel, nativekernel, quickkernel, and installkernel |
984263bc MD |
511 | # |
512 | # Which kernels to build and/or install is specified by setting | |
513 | # KERNCONF. If not defined a GENERIC kernel is built/installed. | |
514 | # Only the existing (depending TARGET) config files are used | |
515 | # for building kernels and only the first of these is designated | |
516 | # as the one being installed. | |
517 | # | |
c2c83759 MD |
518 | # You can specify INSTALLSTRIPPED=1 if you wish the installed |
519 | # kernel and modules to be stripped of its debug info (required | |
520 | # symbols are left intact). You can specify INSTALLSTRIPPEDMODULES | |
521 | # if you only want to strip the modules of their debug info. These | |
522 | # only apply if you have DEBUG=-g in your kernel config or make line. | |
523 | # | |
984263bc MD |
524 | # Note that we have to use TARGET instead of TARGET_ARCH when |
525 | # we're in kernel-land. Since only TARGET_ARCH is (expected) to | |
526 | # be set to cross-build, we have to make sure TARGET is set | |
527 | # properly. | |
528 | ||
529 | .if !defined(KERNCONF) && defined(KERNEL) | |
530 | KERNCONF= ${KERNEL} | |
531 | KERNWARN= yes | |
532 | .else | |
702a95cc SS |
533 | # XXX makeshift fix to build the right kernel for the (target) architecture |
534 | # We should configure this in the platform files somehow | |
535 | .if ${TARGET_ARCH} == "i386" | |
984263bc | 536 | KERNCONF?= GENERIC |
702a95cc | 537 | .else |
b2b3ffcd | 538 | KERNCONF?= X86_64_GENERIC |
702a95cc | 539 | .endif |
984263bc MD |
540 | .endif |
541 | INSTKERNNAME?= kernel | |
542 | ||
543 | KRNLSRCDIR= ${.CURDIR}/sys | |
4e54470f | 544 | KRNLCONFDIR= ${KRNLSRCDIR}/config |
984263bc MD |
545 | KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR} |
546 | KERNCONFDIR?= ${KRNLCONFDIR} | |
547 | ||
548 | BUILDKERNELS= | |
549 | INSTALLKERNEL= | |
550 | .for _kernel in ${KERNCONF} | |
551 | .if exists(${KERNCONFDIR}/${_kernel}) | |
552 | BUILDKERNELS+= ${_kernel} | |
553 | .if empty(INSTALLKERNEL) | |
554 | INSTALLKERNEL= ${_kernel} | |
555 | .endif | |
556 | .endif | |
557 | .endfor | |
558 | ||
9a359590 MD |
559 | # kernel version numbers survive rm -rf |
560 | # | |
561 | .for _kernel in ${BUILDKERNELS} | |
562 | .if exists(${KRNLOBJDIR}/${_kernel}/version) | |
563 | KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version | |
564 | .endif | |
565 | .endfor | |
566 | ||
984263bc MD |
567 | # |
568 | # buildkernel | |
569 | # | |
570 | # Builds all kernels defined by BUILDKERNELS. | |
571 | # | |
fc7aca3e | 572 | bk_tools: |
e05c8c84 MD |
573 | @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \ |
574 | echo "You must buildworld before buildkernel. If you wish"; \ | |
575 | echo "to build a kernel using native tools, config it manually"; \ | |
576 | echo "or use the nativekernel target if you are in a rush"; \ | |
3da8e88f | 577 | /usr/bin/false; \ |
c2c83759 MD |
578 | fi |
579 | ||
580 | maybe_bk_tools: | |
581 | .for _kernel in ${BUILDKERNELS} | |
582 | @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \ | |
583 | if [ ! -f ${WORLDDEST}/.libraries_done ]; then \ | |
584 | echo "The kernel was build using buildworld tools which no" ; \ | |
585 | echo "longer appear to exist, quickkernel failed!" ; \ | |
3da8e88f | 586 | /usr/bin/false; \ |
c2c83759 MD |
587 | fi; \ |
588 | fi | |
589 | .endfor | |
e05c8c84 | 590 | |
fc7aca3e | 591 | bk_build_list: |
984263bc MD |
592 | .if empty(BUILDKERNELS) |
593 | @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})." | |
603cdb58 | 594 | @echo ">>> Did you move your kernel configs from i386/conf to config/?" |
984263bc MD |
595 | @false |
596 | .endif | |
fc7aca3e MD |
597 | |
598 | bk_kernwarn: | |
984263bc MD |
599 | .if defined(KERNWARN) |
600 | @echo "--------------------------------------------------------------" | |
601 | @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" | |
602 | @echo "--------------------------------------------------------------" | |
603 | @sleep 3 | |
604 | .endif | |
605 | @echo | |
fc7aca3e MD |
606 | |
607 | # The buildkernel target rebuilds the specified kernels from scratch | |
608 | # using the crossbuild tools generated by the last buildworld. It is | |
609 | # the safest (but also the most time consuming) way to build a new kernel. | |
610 | # | |
611 | buildkernel: bk_tools bk_build_list bk_kernwarn | |
984263bc MD |
612 | .for _kernel in ${BUILDKERNELS} |
613 | @echo "--------------------------------------------------------------" | |
614 | @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" | |
615 | @echo "--------------------------------------------------------------" | |
616 | @echo "===> ${_kernel}" | |
fc7aca3e MD |
617 | .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) |
618 | rm -rf ${KRNLOBJDIR}/${_kernel} | |
619 | .else | |
e05c8c84 | 620 | @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \ |
fc7aca3e | 621 | echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \ |
e05c8c84 | 622 | rm -rf ${KRNLOBJDIR}/${_kernel}; fi |
fc7aca3e | 623 | .endif |
984263bc MD |
624 | mkdir -p ${KRNLOBJDIR} |
625 | .if !defined(NO_KERNELCONFIG) | |
626 | cd ${KRNLCONFDIR}; \ | |
1397f94a | 627 | PATH=${STRICTTMPPATH} \ |
f8a75064 | 628 | config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ |
984263bc | 629 | ${KERNCONFDIR}/${_kernel} |
9a359590 MD |
630 | .endif |
631 | .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel}) | |
632 | echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version | |
984263bc | 633 | .endif |
e05c8c84 | 634 | touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run |
984263bc MD |
635 | .if !defined(NO_KERNELDEPEND) |
636 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
f8a75064 | 637 | ${KMAKEENV} make KERNEL=${INSTKERNNAME} depend |
984263bc MD |
638 | .endif |
639 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
f8a75064 | 640 | ${KMAKEENV} make KERNEL=${INSTKERNNAME} all |
984263bc MD |
641 | @echo "--------------------------------------------------------------" |
642 | @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" | |
643 | @echo "--------------------------------------------------------------" | |
644 | .endfor | |
645 | ||
fc7aca3e | 646 | # The nativekernel target rebuilds the specified kernels from scratch |
114580ac | 647 | # using the system's standard compiler rather than using the crossbuild |
fc7aca3e MD |
648 | # tools generated by the last buildworld. This is fairly safe if your |
649 | # system is reasonable up-to-date. | |
e05c8c84 | 650 | # |
fc7aca3e | 651 | nativekernel: bk_build_list bk_kernwarn |
e05c8c84 MD |
652 | .for _kernel in ${BUILDKERNELS} |
653 | @echo "--------------------------------------------------------------" | |
654 | @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" | |
655 | @echo "--------------------------------------------------------------" | |
656 | @echo "===> ${_kernel}" | |
fc7aca3e MD |
657 | .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) |
658 | rm -rf ${KRNLOBJDIR}/${_kernel} | |
659 | .else | |
e05c8c84 | 660 | @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \ |
fc7aca3e | 661 | echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \ |
e05c8c84 | 662 | rm -rf ${KRNLOBJDIR}/${_kernel}; fi |
fc7aca3e | 663 | .endif |
e05c8c84 MD |
664 | mkdir -p ${KRNLOBJDIR} |
665 | .if !defined(NO_KERNELCONFIG) | |
666 | cd ${KRNLCONFDIR}; \ | |
667 | config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ | |
668 | ${KERNCONFDIR}/${_kernel} | |
9a359590 MD |
669 | .endif |
670 | .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel}) | |
671 | echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version | |
e05c8c84 MD |
672 | .endif |
673 | touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run | |
e05c8c84 MD |
674 | cd ${KRNLOBJDIR}/${_kernel}; \ |
675 | MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \ | |
f8a75064 | 676 | make -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile |
e05c8c84 MD |
677 | .if !defined(NO_KERNELDEPEND) |
678 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
f8a75064 | 679 | make KERNEL=${INSTKERNNAME} depend |
e05c8c84 MD |
680 | .endif |
681 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
f8a75064 | 682 | make KERNEL=${INSTKERNNAME} all |
e05c8c84 MD |
683 | @echo "--------------------------------------------------------------" |
684 | @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" | |
685 | @echo "--------------------------------------------------------------" | |
686 | .endfor | |
687 | ||
fc7aca3e MD |
688 | # The quickkernel target rebuilds the specified kernels as quickly |
689 | # as possible. It will use the native tools or the buildworld cross tools | |
690 | # based on whether the kernel was originally generated via buildkernel or | |
691 | # nativekernel. Config is rerun but the object hierarchy is not rebuilt, | |
692 | # nor is the make depend step run. | |
984263bc | 693 | # |
c2c83759 | 694 | quickkernel: maybe_bk_tools bk_build_list bk_kernwarn |
fc7aca3e MD |
695 | .for _kernel in ${BUILDKERNELS} |
696 | @echo "--------------------------------------------------------------" | |
697 | @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" | |
698 | @echo "--------------------------------------------------------------" | |
699 | @echo "===> ${_kernel}" | |
700 | .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run) | |
701 | .if !defined(NO_KERNELCONFIG) | |
702 | cd ${KRNLCONFDIR}; \ | |
703 | PATH=${STRICTTMPPATH} \ | |
f8a75064 | 704 | config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ |
fc7aca3e MD |
705 | ${KERNCONFDIR}/${_kernel} |
706 | .endif | |
707 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
f8a75064 | 708 | ${KMAKEENV} make KERNEL=${INSTKERNNAME} all |
fc7aca3e MD |
709 | .else |
710 | .if !defined(NO_KERNELCONFIG) | |
711 | cd ${KRNLCONFDIR}; \ | |
712 | config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ | |
713 | ${KERNCONFDIR}/${_kernel} | |
714 | .endif | |
715 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
f8a75064 | 716 | make KERNEL=${INSTKERNNAME} all |
fc7aca3e MD |
717 | .endif |
718 | @echo "--------------------------------------------------------------" | |
719 | @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" | |
720 | @echo "--------------------------------------------------------------" | |
721 | .endfor | |
722 | ||
723 | ||
984263bc MD |
724 | # installkernel |
725 | # | |
726 | # Install the kernel defined by INSTALLKERNEL | |
727 | # | |
728 | installkernel reinstallkernel: | |
982b0507 MD |
729 | @echo "--------------------------------------------------------------" |
730 | @echo ">>> Kernel install for ${INSTALLKERNEL} started on `LC_ALL=C date`" | |
731 | @echo "--------------------------------------------------------------" | |
732 | .if exists(${KRNLOBJDIR}/${INSTALLKERNEL}/.buildkernel_run) | |
984263bc | 733 | cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ |
f8a75064 | 734 | ${IMAKEENV} make KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//} |
c2c83759 MD |
735 | .else |
736 | cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ | |
f8a75064 | 737 | make KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//} |
c2c83759 | 738 | .endif |
984263bc | 739 | |
984263bc MD |
740 | # |
741 | # most | |
742 | # | |
743 | # Build most of the user binaries on the existing system libs and includes. | |
744 | # | |
745 | most: | |
746 | @echo "--------------------------------------------------------------" | |
747 | @echo ">>> Building programs only" | |
748 | @echo "--------------------------------------------------------------" | |
749 | .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin | |
f8a75064 | 750 | cd ${.CURDIR}/${_dir}; make DIRPRFX=${_dir}/ all |
984263bc MD |
751 | .endfor |
752 | ||
753 | # | |
754 | # installmost | |
755 | # | |
756 | # Install the binaries built by the 'most' target. This does not include | |
757 | # libraries or include files. | |
758 | # | |
759 | installmost: | |
760 | @echo "--------------------------------------------------------------" | |
761 | @echo ">>> Installing programs only" | |
762 | @echo "--------------------------------------------------------------" | |
763 | .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin | |
f8a75064 | 764 | cd ${.CURDIR}/${_dir}; make DIRPRFX=${_dir}/ install |
984263bc MD |
765 | .endfor |
766 | ||
767 | # | |
768 | # ------------------------------------------------------------------------ | |
769 | # | |
770 | # From here onwards are utility targets used by the 'make world' and | |
771 | # related targets. If your 'world' breaks, you may like to try to fix | |
772 | # the problem and manually run the following targets to attempt to | |
773 | # complete the build. Beware, this is *not* guaranteed to work, you | |
774 | # need to have a pretty good grip on the current state of the system | |
775 | # to attempt to manually finish it. If in doubt, 'make world' again. | |
776 | # | |
777 | ||
79aa78bc MD |
778 | # bootstrap-tools: Build all tools required to build all tools. Note that |
779 | # order is important in a number of cases and also note that the bootstrap | |
780 | # and build tools stages have access to earlier binaries they themselves | |
781 | # had generated. | |
984263bc | 782 | # |
79aa78bc MD |
783 | # patch: older patch's do not have -i. This program must be built |
784 | # first so other bootstrap tools that need to apply patches | |
785 | # can use it. | |
17030342 MD |
786 | # [x]install: dependancies on various new install features |
787 | # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH | |
788 | # envs are not compatible with older objformat binaries. | |
789 | # | |
cecff5c1 | 790 | .if exists(${.CURDIR}/games) && !defined(NO_GAMES) |
984263bc MD |
791 | _strfile= games/fortune/strfile |
792 | .endif | |
793 | ||
e92bae40 MD |
794 | # BSTRAPDIRS1 - must be built in strict order, no parallelism |
795 | # | |
f3dd7aaa MD |
796 | # order is very important. yacc before m4 before flex. flex exec's m4, |
797 | # m4's parser file needs the latest byacc (insanity!). | |
798 | # | |
e92bae40 | 799 | BSTRAPDIRS1= ${_strfile} \ |
d2e9c9d8 MD |
800 | usr.bin/patch \ |
801 | bin/chmod bin/cp bin/cpdup bin/dd bin/mkdir bin/rm bin/echo \ | |
802 | bin/test bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh \ | |
803 | bin/hostname bin/kill \ | |
f3dd7aaa MD |
804 | usr.bin/yacc usr.bin/m4 usr.bin/colldef \ |
805 | usr.bin/uudecode usr.bin/xinstall \ | |
806 | usr.bin/rpcgen usr.bin/bmake usr.bin/awk usr.bin/stat \ | |
e92bae40 MD |
807 | usr.bin/find usr.bin/flex |
808 | ||
809 | # BSTRAPDIRS2 - may built in parallel | |
810 | # | |
811 | BSTRAPDIRS2= \ | |
812 | usr.bin/sed usr.bin/uname usr.bin/touch \ | |
d2e9c9d8 MD |
813 | usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \ |
814 | usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \ | |
815 | usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \ | |
816 | usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \ | |
817 | usr.bin/cap_mkdb usr.bin/true usr.bin/false \ | |
818 | usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \ | |
8c4a123d | 819 | usr.bin/tail usr.bin/unifdef usr.bin/tic \ |
d2e9c9d8 MD |
820 | usr.sbin/chown usr.sbin/mtree usr.sbin/config \ |
821 | usr.sbin/btxld usr.sbin/zic usr.sbin/makewhatis \ | |
822 | gnu/usr.bin/texinfo gnu/usr.bin/grep usr.bin/sort \ | |
6fc6ffe8 FT |
823 | usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb \ |
824 | usr.bin/crunch | |
d2e9c9d8 | 825 | |
e92bae40 | 826 | bootstrap-tools: bootstrap-tools-before bootstrap-tools-targets1 bootstrap-tools-targets2 |
d2e9c9d8 MD |
827 | touch ${BTOOLSDEST}/.bootstrap_done |
828 | ||
829 | bootstrap-tools-before: | |
062db326 | 830 | ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date |
d2e9c9d8 | 831 | |
e92bae40 MD |
832 | bootstrap-tools-targets1: ${BSTRAPDIRS1:S/^/bstrap-/} |
833 | ||
834 | bootstrap-tools-targets2: ${BSTRAPDIRS2:S/^/bstrap-/} | |
835 | ||
836 | .ORDER: bootstrap-tools-before bootstrap-tools-targets1 bootstrap-tools-targets2 | |
d2e9c9d8 | 837 | |
e92bae40 | 838 | .ORDER: ${BSTRAPDIRS1:S/^/bstrap-/} |
d2e9c9d8 | 839 | |
e92bae40 | 840 | .for _tool in ${BSTRAPDIRS1} ${BSTRAPDIRS2} |
d2e9c9d8 | 841 | bstrap-${_tool}! |
1397f94a | 842 | ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \ |
984263bc | 843 | cd ${.CURDIR}/${_tool}; \ |
f8a75064 JM |
844 | make DIRPRFX=${_tool}/ obj; \ |
845 | make DIRPRFX=${_tool}/ depend; \ | |
846 | make DIRPRFX=${_tool}/ all; \ | |
847 | make DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install | |
984263bc MD |
848 | .endfor |
849 | ||
bceb727e | 850 | # build-tools: Build special purpose build tools. |
984263bc | 851 | # |
1397f94a MD |
852 | # XXX we may be able to remove or consolidate this into bootstrap-tools |
853 | # now that we have the native helper (.nx/.no) infrastructure. | |
854 | # | |
cecff5c1 | 855 | .if exists(${.CURDIR}/share) && !defined(NO_SHARE) |
984263bc MD |
856 | _share= share/syscons/scrnmaps |
857 | .endif | |
858 | ||
f0140465 | 859 | _gcc_common_cross= gnu/usr.bin/gmp gnu/usr.bin/mpfr |
6100d1de | 860 | .if !defined(NO_GCC44) |
f0140465 | 861 | _gcc44_cross= gnu/usr.bin/cc44 |
4f5ea479 | 862 | _gcc44_tools= gnu/usr.bin/cc44/cc_prep gnu/usr.bin/cc44/cc_tools |
6100d1de | 863 | .endif |
ce38cc15 | 864 | _gcc47_cross= lib/libz gnu/usr.bin/mpc gnu/usr.bin/cc47 |
f0140465 | 865 | _gcc47_tools= gnu/usr.bin/cc47/cc_prep gnu/usr.bin/cc47/cc_tools |
c97b9141 | 866 | _custom_cross= libexec/customcc |
123dec51 | 867 | _binutils= gnu/usr.bin/${WORLD_BINUTILSVER} |
17030342 | 868 | |
f0140465 | 869 | BTOOLSDIRS= ${_gcc44_tools} ${_gcc47_tools} ${_share} |
d2e9c9d8 MD |
870 | |
871 | build-tools: build-tools-targets | |
872 | touch ${BTOOLSDEST}/.build_done | |
873 | ||
874 | build-tools-targets: ${BTOOLSDIRS:S/^/btools-/} | |
875 | ||
9ba72882 | 876 | .ORDER: ${_gcc44_tools:S/^/btools-/} |
f0140465 | 877 | .ORDER: ${_gcc47_tools:S/^/btools-/} |
9ba72882 | 878 | |
d2e9c9d8 MD |
879 | .for _tool in ${BTOOLSDIRS} |
880 | btools-${_tool}! | |
1397f94a | 881 | ${ECHODIR} "===> ${_tool} (build-tools)"; \ |
984263bc | 882 | cd ${.CURDIR}/${_tool}; \ |
f8a75064 JM |
883 | make DIRPRFX=${_tool}/ obj; \ |
884 | make DIRPRFX=${_tool}/ depend; \ | |
885 | make DIRPRFX=${_tool}/ all; \ | |
886 | make DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install | |
984263bc MD |
887 | .endfor |
888 | ||
889 | # | |
890 | # cross-tools: Build cross-building tools | |
891 | # | |
984263bc MD |
892 | .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386" |
893 | _btxld= usr.sbin/btxld | |
894 | .endif | |
895 | ||
fc7e83fa FT |
896 | CTOOLSDIRS= ${_btxld} ${_binutils} \ |
897 | usr.bin/objformat usr.bin/crunch/crunchide \ | |
898 | ${_gcc_common_cross} \ | |
f0140465 | 899 | ${_gcc44_cross} ${_gcc47_cross} ${_custom_cross} |
d2e9c9d8 MD |
900 | |
901 | cross-tools: cross-tools-targets | |
902 | touch ${CTOOLSDEST}/.cross_done | |
903 | ||
904 | cross-tools-targets: ${CTOOLSDIRS:S/^/ctools-/} | |
905 | ||
906 | .for _tool in ${CTOOLSDIRS} | |
907 | ctools-${_tool}! | |
1397f94a | 908 | ${ECHODIR} "===> ${_tool} (cross-tools)"; \ |
984263bc | 909 | cd ${.CURDIR}/${_tool}; \ |
f8a75064 JM |
910 | make DIRPRFX=${_tool}/ obj; \ |
911 | make DIRPRFX=${_tool}/ depend; \ | |
912 | make DIRPRFX=${_tool}/ all; \ | |
913 | make DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install | |
984263bc MD |
914 | .endfor |
915 | ||
916 | # | |
917 | # hierarchy - ensure that all the needed directories are present | |
918 | # | |
919 | hierarchy: | |
f8a75064 | 920 | cd ${.CURDIR}/etc; make distrib-dirs |
984263bc MD |
921 | |
922 | # | |
923 | # libraries - build all libraries, and install them under ${DESTDIR}. | |
924 | # | |
925 | # The list of libraries with dependents (${_prebuild_libs}) and their | |
926 | # interdependencies (__L) are built automatically by the | |
927 | # ${.CURDIR}/tools/make_libdeps.sh script. | |
928 | # | |
5228fe46 MD |
929 | # .makeenv does not work when bootstrapping from 4.x, so we must be sure |
930 | # to specify the correct CCVER or 'cc' will not exec the correct compiler. | |
931 | # | |
984263bc | 932 | libraries: |
ddf7cc86 | 933 | cd ${.CURDIR}; \ |
f0140465 | 934 | HOST_CCVER=${HOST_CCVER} CCVER=gcc47 \ |
f8a75064 | 935 | make -f Makefile.inc1 _startup_libs47; |
6100d1de | 936 | .if !defined(NO_GCC44) |
4f5ea479 SS |
937 | cd ${.CURDIR}; \ |
938 | HOST_CCVER=${HOST_CCVER} CCVER=gcc44 \ | |
f8a75064 | 939 | make -f Makefile.inc1 _startup_libs44; |
6100d1de | 940 | .endif |
29d48e65 | 941 | cd ${.CURDIR}; \ |
f8a75064 JM |
942 | make -f Makefile.inc1 _startup_libs; \ |
943 | make -f Makefile.inc1 _prebuild_libs; \ | |
944 | make -f Makefile.inc1 _generic_libs; | |
e05c8c84 | 945 | touch ${WORLDDEST}/.libraries_done |
984263bc MD |
946 | |
947 | # These dependencies are not automatically generated: | |
948 | # | |
fd8b66cd | 949 | # gnu/lib/${CCVER}/libgcc and gnu/lib/${CCVER}/csu must be built before all |
4f5ea479 SS |
950 | # shared libraries for ELF. The target for _startup_libsXX is |
951 | # specifically built using gccXX. | |
984263bc | 952 | # |
64ed7155 JM |
953 | _startup_libs47= gnu/usr.bin/cc47/cc_prep \ |
954 | gnu/usr.bin/cc47/cc_tools \ | |
955 | gnu/lib/gcc47/csu \ | |
f0140465 JM |
956 | gnu/lib/gcc47/libgcc \ |
957 | gnu/lib/gcc47/libgcc_eh \ | |
958 | gnu/lib/gcc47/libgcc_pic | |
64ed7155 JM |
959 | _startup_libs44= gnu/usr.bin/cc44/cc_prep \ |
960 | gnu/usr.bin/cc44/cc_tools \ | |
961 | gnu/lib/gcc44/csu \ | |
962 | gnu/lib/gcc44/libgcc | |
e1da6819 | 963 | _startup_libs= lib/csu lib/libc lib/libc_rtld |
984263bc | 964 | |
59392a00 | 965 | _prebuild_libs= lib/libbz2 lib/liblzma lib/libz |
0b153c05 | 966 | _prebuild_libs+= lib/libutil |
984263bc MD |
967 | |
968 | _generic_libs= gnu/lib | |
969 | ||
984263bc | 970 | _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \ |
6d0e03f5 | 971 | lib/libncurses/libncurses lib/libopie |
984263bc MD |
972 | |
973 | lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L | |
984263bc MD |
974 | |
975 | _generic_libs+= lib | |
976 | ||
cecff5c1 | 977 | .if !defined(NO_CRYPT) |
984263bc MD |
978 | .if !defined(NO_OPENSSL) |
979 | _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl | |
980 | .if !defined(NO_OPENSSH) | |
981 | _prebuild_libs+= secure/lib/libssh | |
982 | secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L | |
983 | .endif | |
984 | .endif | |
985 | _generic_libs+= secure/lib | |
986 | .endif | |
987 | ||
6d0e03f5 MD |
988 | _prebuild_libs+= lib/libradius lib/libsbuf lib/libtacplus lib/libm \ |
989 | lib/libpam lib/libypclnt lib/lib${THREAD_LIB} \ | |
990 | lib/libpthread lib/libprop lib/libdevattr | |
991 | ||
f506e60d | 992 | _generic_libs+= usr.bin/flex/lib |
984263bc | 993 | |
f0140465 | 994 | .for _lib in ${_startup_libs44} ${_startup_libs47} \ |
4db2a28c | 995 | ${_startup_libs} ${_prebuild_libs} ${_generic_libs} |
984263bc MD |
996 | ${_lib}__L: .PHONY |
997 | .if exists(${.CURDIR}/${_lib}) | |
998 | ${ECHODIR} "===> ${_lib}"; \ | |
999 | cd ${.CURDIR}/${_lib}; \ | |
f8a75064 JM |
1000 | make DIRPRFX=${_lib}/ depend; \ |
1001 | make DIRPRFX=${_lib}/ all; \ | |
1002 | make DIRPRFX=${_lib}/ install | |
984263bc MD |
1003 | .endif |
1004 | .endfor | |
1005 | ||
1006 | _startup_libs: ${_startup_libs:S/$/__L/} | |
f0140465 | 1007 | _startup_libs47: ${_startup_libs47:S/$/__L/} |
4f5ea479 | 1008 | _startup_libs44: ${_startup_libs44:S/$/__L/} |
984263bc MD |
1009 | _prebuild_libs: ${_prebuild_libs:S/$/__L/} |
1010 | _generic_libs: ${_generic_libs:S/$/__L/} | |
1011 | ||
1397f94a MD |
1012 | # library targets must be ordered because there are inter-library |
1013 | # races (e.g. generation of tconfig.h) | |
1014 | # | |
f0140465 | 1015 | .ORDER: ${_startup_libs47:S/$/__L/} |
4f5ea479 | 1016 | .ORDER: ${_startup_libs44:S/$/__L/} |
1397f94a MD |
1017 | .ORDER: ${_startup_libs:S/$/__L/} |
1018 | .ORDER: ${_prebuild_libs:S/$/__L/} | |
1019 | .ORDER: ${_generic_libs:S/$/__L/} | |
1020 | ||
1021 | .for __target in clean cleandepend cleandir obj depend includes | |
984263bc MD |
1022 | .for entry in ${SUBDIR} |
1023 | ${entry}.${__target}__D: .PHONY | |
1024 | @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ | |
1025 | ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \ | |
1026 | edir=${entry}.${MACHINE_ARCH}; \ | |
1027 | cd ${.CURDIR}/$${edir}; \ | |
1028 | else \ | |
1029 | ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ | |
1030 | edir=${entry}; \ | |
1031 | cd ${.CURDIR}/$${edir}; \ | |
1032 | fi; \ | |
f8a75064 | 1033 | make ${__target} DIRPRFX=${DIRPRFX}$${edir}/ |
984263bc MD |
1034 | .endfor |
1035 | par-${__target}: ${SUBDIR:S/$/.${__target}__D/} | |
1397f94a | 1036 | .ORDER: ${SUBDIR:S/$/.${__target}__D/} |
984263bc | 1037 | .endfor |
1397f94a | 1038 | .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes |
984263bc | 1039 | |
cb0f1574 MD |
1040 | # The wmake target is used by /usr/bin/wmake to run make in a |
1041 | # world build environment. | |
1042 | # | |
1043 | wmake: | |
f8a75064 | 1044 | @echo '${WMAKEENV} make ${WMAKE_ARGS}' |
cb0f1574 | 1045 | |
5c7da0d7 MD |
1046 | wmakeenv: |
1047 | @echo '${WMAKEENV} /bin/sh' | |
1048 | ||
1397f94a | 1049 | bmake: |
f8a75064 | 1050 | @echo '${BMAKEENV} make ${BMAKE_ARGS}' |
1397f94a | 1051 | |
17030342 MD |
1052 | bmakeenv: |
1053 | @echo '${BMAKEENV} /bin/sh' | |
1054 | ||
1397f94a | 1055 | tmake: |
f8a75064 | 1056 | @echo '${TMAKEENV} make ${TMAKE_ARGS}' |
1397f94a | 1057 | |
17030342 MD |
1058 | tmakeenv: |
1059 | @echo '${TMAKEENV} /bin/sh' | |
1060 | ||
66834c05 | 1061 | xmake: |
f8a75064 | 1062 | @echo '${XMAKEENV} make ${XMAKE_ARGS}' |
66834c05 SS |
1063 | |
1064 | xmakeenv: | |
1065 | @echo '${XMAKEENV} /bin/sh' | |
1066 | ||
2decc9b9 | 1067 | backupworld: backup-clean |
7bee86c0 | 1068 | @mkdir -p ${WORLD_BACKUP} |
2decc9b9 JM |
1069 | .if (exists(${DESTDIR}/sbin) && exists(${DESTDIR}/bin) && \ |
1070 | exists(${DESTDIR}/usr/sbin) && exists(${DESTDIR}/usr/bin) && \ | |
1071 | exists(${DESTDIR}/usr/lib) && exists(${DESTDIR}/usr/libexec)) | |
1072 | tar -czf ${WORLD_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ \ | |
1073 | --options gzip:compression-level=1 \ | |
1074 | sbin bin usr/sbin usr/bin usr/lib usr/libexec | |
1075 | .endif | |
61443441 JM |
1076 | |
1077 | backupworld-auto: | |
2decc9b9 JM |
1078 | .if !defined(NO_BACKUP) |
1079 | rm -f ${AUTO_BACKUP}/binaries.tar.gz | |
61443441 | 1080 | @mkdir -p ${AUTO_BACKUP} |
2decc9b9 JM |
1081 | .if (exists(${DESTDIR}/sbin) && exists(${DESTDIR}/bin) && \ |
1082 | exists(${DESTDIR}/usr/sbin) && exists(${DESTDIR}/usr/bin) && \ | |
1083 | exists(${DESTDIR}/usr/lib) && exists(${DESTDIR}/usr/libexec)) | |
1084 | tar -czf ${AUTO_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ \ | |
1085 | --options gzip:compression-level=1 \ | |
1086 | sbin bin usr/sbin usr/bin usr/lib usr/libexec | |
1087 | .endif | |
aaae54f7 | 1088 | .endif |
7bee86c0 | 1089 | |
2decc9b9 JM |
1090 | backup-auto-clean: |
1091 | rm -f ${AUTO_BACKUP}/binaries.tar.gz | |
1092 | ||
1093 | backup-clean: | |
1094 | rm -f ${WORLD_BACKUP}/binaries.tar.gz | |
1095 | ||
7bee86c0 | 1096 | restoreworld: |
2decc9b9 | 1097 | .if !exists(${WORLD_BACKUP}/binaries.tar.gz) |
7bee86c0 JM |
1098 | @echo "There does not seem to be a valid archive present." |
1099 | .else | |
61443441 | 1100 | @echo "Restoring system binaries from manual backup archive..." |
2decc9b9 JM |
1101 | @chflags -R noschg ${DESTDIR}/sbin ${DESTDIR}/bin \ |
1102 | ${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin \ | |
1103 | ${DESTDIR}/usr/lib ${DESTDIR}/usr/libexec | |
1104 | tar -xzf ${WORLD_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ | |
7bee86c0 JM |
1105 | .endif |
1106 | ||
61443441 | 1107 | restoreworld-auto: |
2decc9b9 | 1108 | .if !exists(${AUTO_BACKUP}/binaries.tar.gz) |
61443441 JM |
1109 | @echo "There does not seem to be a valid archive present." |
1110 | .else | |
1111 | @echo "Restoring system binaries from auto-backup archive..." | |
2decc9b9 JM |
1112 | @chflags -R noschg ${DESTDIR}/sbin ${DESTDIR}/bin \ |
1113 | ${DESTDIR}/usr/sbin ${DESTDIR}/usr/bin \ | |
1114 | ${DESTDIR}/usr/lib ${DESTDIR}/usr/libexec | |
1115 | tar -xzf ${AUTO_BACKUP}/binaries.tar.gz -C ${DESTDIR}/ | |
61443441 JM |
1116 | .endif |
1117 | ||
3da8e88f JM |
1118 | # Take advantage of bmake error response |
1119 | # | |
1120 | MAKE_PRINT_VAR_ON_ERROR= \ | |
1121 | .CURDIR \ | |
1122 | .OBJDIR \ | |
3da8e88f JM |
1123 | LD_LIBRARY_PATH \ |
1124 | MACHINE_ARCH \ | |
1125 | MACHINE \ | |
1126 | MAKEFILE \ | |
1127 | .TARGETS \ | |
1128 | .ERROR_TARGET \ | |
61443441 | 1129 | .MAKE.LEVEL |
3da8e88f | 1130 | |
984263bc | 1131 | .include <bsd.subdir.mk> |