1 |
# |
2 |
# $FreeBSD: src/Makefile.inc1,v 1.499.2.7 2006/01/07 19:40:08 netchild Exp $ |
3 |
# $MidnightBSD: src/Makefile.inc1,v 1.8 2008/04/29 00:23:55 laffer1 Exp $ |
4 |
# |
5 |
# Make command line options: |
6 |
# -DNO_DYNAMICROOT do not link /bin and /sbin dynamically |
7 |
# -DNO_KERBEROS Do not build Heimdal (Kerberos 5) |
8 |
# -DNO_RESCUE do not build rescue binaries |
9 |
# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir |
10 |
# -DNO_CLEAN do not clean at all |
11 |
# -DNO_CRYPT will prevent building of crypt versions |
12 |
# -DNO_MAN do not build the manual pages |
13 |
# -DNO_NLS do not build Native Language Support files |
14 |
# -DNO_PROFILE do not build profiled libraries |
15 |
# -DNO_GAMES do not go into games subdir |
16 |
# -DNO_SHARE do not go into share subdir |
17 |
# -DNO_INFO do not make or install info files |
18 |
# -DNO_LIBC_R do not build libc_r. |
19 |
# -DNO_FORTRAN do not build g77 and related libraries. |
20 |
# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel |
21 |
# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel |
22 |
# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel |
23 |
# -DNO_PORTSUPDATE do not update ports in ${MAKE} update |
24 |
# -DNO_DOCUPDATE do not update doc in ${MAKE} update |
25 |
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list |
26 |
# TARGET_ARCH="arch" to crossbuild world to a different arch |
27 |
|
28 |
# |
29 |
# The intended user-driven targets are: |
30 |
# buildworld - rebuild *everything*, including glue to help do upgrades |
31 |
# installworld- install everything built by "buildworld" |
32 |
# update - convenient way to update your source tree (eg: cvsup/cvs) |
33 |
# |
34 |
# Standard targets (not defined here) are documented in the makefiles in |
35 |
# /usr/share/mk. These include: |
36 |
# obj depend all install clean cleandepend cleanobj |
37 |
|
38 |
# We must do share/info early so that installation of info `dir' |
39 |
# entries works correctly. Do it first since it is less likely to |
40 |
# grow dependencies on include and lib than vice versa. |
41 |
# |
42 |
# We must do lib and libexec before bin, because if installworld |
43 |
# installs a new /bin/sh, the 'make' command will *immediately* |
44 |
# use that new version. And the new (dynamically-linked) /bin/sh |
45 |
# will expect to find appropriate libraries in /lib and /libexec. |
46 |
# |
47 |
# We must do etc last for install/distribute to work. |
48 |
# |
49 |
SUBDIR= share/info include lib libexec bin |
50 |
.if !defined(NO_GAMES) |
51 |
SUBDIR+=games |
52 |
.endif |
53 |
SUBDIR+=gnu |
54 |
.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) |
55 |
SUBDIR+=kerberos5 |
56 |
.endif |
57 |
.if !defined(NO_RESCUE) |
58 |
SUBDIR+=rescue |
59 |
.endif |
60 |
SUBDIR+=sbin |
61 |
.if !defined(NO_CRYPT) |
62 |
SUBDIR+=secure |
63 |
.endif |
64 |
.if !defined(NO_SHARE) |
65 |
SUBDIR+=share |
66 |
.endif |
67 |
SUBDIR+=sys usr.bin usr.sbin etc |
68 |
|
69 |
# These are last, since it is nice to at least get the base system |
70 |
# rebuilt before you do them. |
71 |
.for _DIR in ${LOCAL_DIRS} |
72 |
.if exists(${.CURDIR}/${_DIR}/Makefile) |
73 |
SUBDIR+= ${_DIR} |
74 |
.endif |
75 |
.endfor |
76 |
|
77 |
.if defined(SUBDIR_OVERRIDE) |
78 |
SUBDIR= ${SUBDIR_OVERRIDE} |
79 |
.endif |
80 |
|
81 |
.if defined(NOCLEAN) |
82 |
NO_CLEAN= ${NOCLEAN} |
83 |
.endif |
84 |
.if defined(NO_CLEANDIR) |
85 |
CLEANDIR= clean cleandepend |
86 |
.else |
87 |
CLEANDIR= cleandir |
88 |
.endif |
89 |
|
90 |
CVS?= cvs |
91 |
CVSFLAGS?= -r . -P -d -I! |
92 |
SUP?= /usr/bin/csup |
93 |
SUPFLAGS?= -g -L 2 |
94 |
.if defined(SUPHOST) |
95 |
SUPFLAGS+= -h ${SUPHOST} |
96 |
.endif |
97 |
|
98 |
MAKEOBJDIRPREFIX?= /usr/obj |
99 |
.if !defined(OSRELDATE) |
100 |
.if exists(/usr/include/osreldate.h) |
101 |
OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ |
102 |
/usr/include/osreldate.h |
103 |
.else |
104 |
OSRELDATE= 0 |
105 |
.endif |
106 |
.endif |
107 |
TARGET_ARCH?= ${MACHINE_ARCH} |
108 |
.if ${TARGET_ARCH} == ${MACHINE_ARCH} |
109 |
TARGET?= ${MACHINE} |
110 |
TARGET_CPUTYPE?=${CPUTYPE} |
111 |
.else |
112 |
TARGET?= ${TARGET_ARCH} |
113 |
TARGET_CPUTYPE?= |
114 |
.endif |
115 |
.if !empty(TARGET_CPUTYPE) |
116 |
_TARGET_CPUTYPE=${TARGET_CPUTYPE} |
117 |
.else |
118 |
_TARGET_CPUTYPE=dummy |
119 |
.endif |
120 |
_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ |
121 |
-f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE |
122 |
.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} |
123 |
.error CPUTYPE global should be set with ?=. |
124 |
.endif |
125 |
.if make(buildworld) |
126 |
BUILD_ARCH!= sysctl -n hw.machine_arch |
127 |
.if ${MACHINE_ARCH} != ${BUILD_ARCH} |
128 |
.error To cross-build, set TARGET_ARCH. |
129 |
.endif |
130 |
.endif |
131 |
.if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING) |
132 |
OBJTREE= ${MAKEOBJDIRPREFIX} |
133 |
.else |
134 |
OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET} |
135 |
.endif |
136 |
WORLDTMP= ${OBJTREE}${.CURDIR}/tmp |
137 |
# /usr/games added for fortune which depend on strfile |
138 |
BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games |
139 |
XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games |
140 |
STRICTTMPPATH= ${BPATH}:${XPATH} |
141 |
TMPPATH= ${STRICTTMPPATH}:${PATH} |
142 |
|
143 |
INSTALLTMP!= /usr/bin/mktemp -d -u -t install |
144 |
|
145 |
# |
146 |
# Building a world goes through the following stages |
147 |
# |
148 |
# 1. legacy stage [BMAKE] |
149 |
# This stage is responsible for creating compatibility |
150 |
# shims that are needed by the bootstrap-tools, |
151 |
# build-tools and cross-tools stages. |
152 |
# 1. bootstrap-tools stage [BMAKE] |
153 |
# This stage is responsible for creating programs that |
154 |
# are needed for backward compatibility reasons. They |
155 |
# are not built as cross-tools. |
156 |
# 2. build-tools stage [TMAKE] |
157 |
# This stage is responsible for creating the object |
158 |
# tree and building any tools that are needed during |
159 |
# the build process. |
160 |
# 3. cross-tools stage [XMAKE] |
161 |
# This stage is responsible for creating any tools that |
162 |
# are needed for cross-builds. A cross-compiler is one |
163 |
# of them. |
164 |
# 4. world stage [WMAKE] |
165 |
# This stage actually builds the world. |
166 |
# 5. install stage (optional) [IMAKE] |
167 |
# This stage installs a previously built world. |
168 |
# |
169 |
|
170 |
BOOTSTRAPPING?= 0 |
171 |
|
172 |
# Common environment for world related stages |
173 |
CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ |
174 |
MACHINE_ARCH=${TARGET_ARCH} \ |
175 |
MACHINE=${TARGET} \ |
176 |
CPUTYPE=${TARGET_CPUTYPE} \ |
177 |
GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ |
178 |
GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ |
179 |
GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac |
180 |
|
181 |
# bootstrap-tools stage |
182 |
BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
183 |
PATH=${BPATH}:${PATH} \ |
184 |
WORLDTMP=${WORLDTMP} \ |
185 |
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" |
186 |
BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ |
187 |
${BMAKEENV} ${MAKE} -f Makefile.inc1 \ |
188 |
DESTDIR= \ |
189 |
BOOTSTRAPPING=${OSRELDATE} \ |
190 |
-DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN -DNO_NLS -DNO_PIC \ |
191 |
-DNO_PROFILE -DNO_SHARED -DNO_CPU_CFLAGS -DNO_WARNS |
192 |
|
193 |
# build-tools stage |
194 |
TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ |
195 |
${BMAKEENV} ${MAKE} -f Makefile.inc1 \ |
196 |
DESTDIR= \ |
197 |
BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS |
198 |
|
199 |
# cross-tools stage |
200 |
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB |
201 |
|
202 |
# world stage |
203 |
WMAKEENV= ${CROSSENV} \ |
204 |
_SHLIBDIRPREFIX=${WORLDTMP} \ |
205 |
INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
206 |
PATH=${TMPPATH} |
207 |
WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} |
208 |
|
209 |
.if ${TARGET_ARCH} == "amd64" |
210 |
# 32 bit world |
211 |
LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 |
212 |
|
213 |
LIB32PREFLAGS= -m32 -march=athlon-xp -msse2 -mfancy-math-387 -DCOMPAT_32BIT |
214 |
LIB32POSTFLAGS= -I${LIB32TMP}/usr/include \ |
215 |
-L${LIB32TMP}/usr/lib32 \ |
216 |
-B${LIB32TMP}/usr/lib32 |
217 |
LIB32CC= ${LIB32PREFLAGS} \ |
218 |
${LIB32POSTFLAGS} |
219 |
LIB32CXX= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/c++/3.4 \ |
220 |
${LIB32POSTFLAGS} |
221 |
LIB32OBJC= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/objc \ |
222 |
${LIB32POSTFLAGS} |
223 |
|
224 |
# Yes, the flags are redundant. |
225 |
LIB32MAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ |
226 |
_SHLIBDIRPREFIX=${LIB32TMP} \ |
227 |
MACHINE=i386 \ |
228 |
MACHINE_ARCH=i386 \ |
229 |
INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
230 |
PATH=${TMPPATH} \ |
231 |
CC="${CC} ${LIB32CC}" \ |
232 |
CXX="${CXX} ${LIB32CXX}" \ |
233 |
OBJC="${OBJC} ${LIB32OBJC}" \ |
234 |
LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ |
235 |
AS="${AS} --32" \ |
236 |
LIBDIR=/usr/lib32 \ |
237 |
SHLIBDIR=/usr/lib32 |
238 |
|
239 |
LIB32MAKE= ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ |
240 |
-DNO_BIND -DNO_MAN -DNO_NLS -DNO_INFO -DNO_HTML |
241 |
LIB32IMAKE= ${LIB32MAKE:NINSTALL=*} -DNO_INCS |
242 |
.endif |
243 |
|
244 |
# install stage |
245 |
.if empty(.MAKEFLAGS:M-n) |
246 |
IMAKEENV= ${CROSSENV} \ |
247 |
PATH=${STRICTTMPPATH}:${INSTALLTMP} |
248 |
.else |
249 |
IMAKEENV= ${CROSSENV} \ |
250 |
PATH=${TMPPATH}:${INSTALLTMP} |
251 |
.endif |
252 |
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 |
253 |
|
254 |
# kernel stage |
255 |
KMAKEENV= ${WMAKEENV} |
256 |
|
257 |
# |
258 |
# buildworld |
259 |
# |
260 |
# Attempt to rebuild the entire system, with reasonable chance of |
261 |
# success, regardless of how old your existing system is. |
262 |
# |
263 |
_worldtmp: |
264 |
.if ${.CURDIR:C/[^,]//g} != "" |
265 |
# The m4 build of sendmail files doesn't like it if ',' is used |
266 |
# anywhere in the path of it's files. |
267 |
@echo |
268 |
@echo "*** Error: path to source tree contains a comma ','" |
269 |
@echo |
270 |
false |
271 |
.endif |
272 |
@echo |
273 |
@echo "--------------------------------------------------------------" |
274 |
@echo ">>> Rebuilding the temporary build tree" |
275 |
@echo "--------------------------------------------------------------" |
276 |
.if !defined(NO_CLEAN) |
277 |
rm -rf ${WORLDTMP} |
278 |
.if ${TARGET_ARCH} == "amd64" |
279 |
rm -rf ${LIB32TMP} |
280 |
.endif |
281 |
.else |
282 |
rm -rf ${WORLDTMP}/legacy/usr/include |
283 |
# XXX - These two can depend on any header file. |
284 |
rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c |
285 |
rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c |
286 |
.endif |
287 |
.for _dir in \ |
288 |
usr/bin usr/games usr/include/c++/3.4 usr/include/sys usr/lib \ |
289 |
usr/libexec usr/sbin usr/share/dict \ |
290 |
usr/share/groff_font/devX100 \ |
291 |
usr/share/groff_font/devX100-12 \ |
292 |
usr/share/groff_font/devX75 \ |
293 |
usr/share/groff_font/devX75-12 \ |
294 |
usr/share/groff_font/devascii \ |
295 |
usr/share/groff_font/devcp1047 \ |
296 |
usr/share/groff_font/devdvi \ |
297 |
usr/share/groff_font/devhtml \ |
298 |
usr/share/groff_font/devkoi8-r \ |
299 |
usr/share/groff_font/devlatin1 \ |
300 |
usr/share/groff_font/devlbp \ |
301 |
usr/share/groff_font/devlj4 \ |
302 |
usr/share/groff_font/devps \ |
303 |
usr/share/groff_font/devutf8 \ |
304 |
usr/share/tmac/mdoc usr/share/tmac/mm |
305 |
mkdir -p ${WORLDTMP}/legacy/${_dir} |
306 |
.endfor |
307 |
.for _dir in \ |
308 |
lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \ |
309 |
usr/libexec usr/sbin usr/share/misc |
310 |
mkdir -p ${WORLDTMP}/${_dir} |
311 |
.endfor |
312 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ |
313 |
-p ${WORLDTMP}/usr/include >/dev/null |
314 |
ln -sf ${.CURDIR}/sys ${WORLDTMP} |
315 |
.if defined(WITH_BIND_LIBS) && !defined(NO_BIND) |
316 |
mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ |
317 |
-p ${WORLDTMP}/usr/include >/dev/null |
318 |
.endif |
319 |
_legacy: |
320 |
@echo |
321 |
@echo "--------------------------------------------------------------" |
322 |
@echo ">>> stage 1.1: legacy release compatibility shims" |
323 |
@echo "--------------------------------------------------------------" |
324 |
${_+_}cd ${.CURDIR}; ${BMAKE} legacy |
325 |
_bootstrap-tools: |
326 |
@echo |
327 |
@echo "--------------------------------------------------------------" |
328 |
@echo ">>> stage 1.2: bootstrap tools" |
329 |
@echo "--------------------------------------------------------------" |
330 |
${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools |
331 |
_cleanobj: |
332 |
.if !defined(NO_CLEAN) |
333 |
@echo |
334 |
@echo "--------------------------------------------------------------" |
335 |
@echo ">>> stage 2.1: cleaning up the object tree" |
336 |
@echo "--------------------------------------------------------------" |
337 |
${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} |
338 |
.if ${TARGET_ARCH} == "amd64" |
339 |
rm -rf ${OBJTREE}/lib32 |
340 |
.endif |
341 |
.endif |
342 |
_obj: |
343 |
@echo |
344 |
@echo "--------------------------------------------------------------" |
345 |
@echo ">>> stage 2.2: rebuilding the object tree" |
346 |
@echo "--------------------------------------------------------------" |
347 |
${_+_}cd ${.CURDIR}; ${WMAKE} par-obj |
348 |
_build-tools: |
349 |
@echo |
350 |
@echo "--------------------------------------------------------------" |
351 |
@echo ">>> stage 2.3: build tools" |
352 |
@echo "--------------------------------------------------------------" |
353 |
${_+_}cd ${.CURDIR}; ${TMAKE} build-tools |
354 |
_cross-tools: |
355 |
@echo |
356 |
@echo "--------------------------------------------------------------" |
357 |
@echo ">>> stage 3: cross tools" |
358 |
@echo "--------------------------------------------------------------" |
359 |
${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools |
360 |
_includes: |
361 |
@echo |
362 |
@echo "--------------------------------------------------------------" |
363 |
@echo ">>> stage 4.1: building includes" |
364 |
@echo "--------------------------------------------------------------" |
365 |
${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes |
366 |
_libraries: |
367 |
@echo |
368 |
@echo "--------------------------------------------------------------" |
369 |
@echo ">>> stage 4.2: building libraries" |
370 |
@echo "--------------------------------------------------------------" |
371 |
${_+_}cd ${.CURDIR}; \ |
372 |
${WMAKE} -DNO_FSCHG -DNO_HTML -DNO_INFO -DNO_LINT -DNO_MAN \ |
373 |
-DNO_NLS -DNO_PROFILE libraries |
374 |
_depend: |
375 |
@echo |
376 |
@echo "--------------------------------------------------------------" |
377 |
@echo ">>> stage 4.3: make dependencies" |
378 |
@echo "--------------------------------------------------------------" |
379 |
${_+_}cd ${.CURDIR}; ${WMAKE} par-depend |
380 |
everything: |
381 |
@echo |
382 |
@echo "--------------------------------------------------------------" |
383 |
@echo ">>> stage 4.4: building everything" |
384 |
@echo "--------------------------------------------------------------" |
385 |
${_+_}cd ${.CURDIR}; ${WMAKE} par-all |
386 |
.if ${TARGET_ARCH} == "amd64" |
387 |
build32: |
388 |
@echo |
389 |
@echo "--------------------------------------------------------------" |
390 |
@echo ">>> stage 5.1: building 32 bit shim libraries" |
391 |
@echo "--------------------------------------------------------------" |
392 |
.for _dir in \ |
393 |
lib32 usr/include usr/lib32 \ |
394 |
usr/share/misc |
395 |
mkdir -p ${LIB32TMP}/${_dir} |
396 |
.endfor |
397 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ |
398 |
-p ${LIB32TMP}/usr/include >/dev/null |
399 |
mkdir -p ${WORLDTMP} |
400 |
ln -sf ${.CURDIR}/sys ${WORLDTMP} |
401 |
.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) |
402 |
.for _t in obj depend all |
403 |
cd ${.CURDIR}/kerberos5/tools; \ |
404 |
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t} |
405 |
.endfor |
406 |
.endif |
407 |
.for _t in obj includes |
408 |
cd ${.CURDIR}/include; \ |
409 |
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} |
410 |
cd ${.CURDIR}/lib; \ |
411 |
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} |
412 |
cd ${.CURDIR}/gnu/lib; \ |
413 |
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} |
414 |
.if !defined(NO_CRYPT) |
415 |
cd ${.CURDIR}/secure/lib; \ |
416 |
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} |
417 |
.endif |
418 |
.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) |
419 |
cd ${.CURDIR}/kerberos5/lib; \ |
420 |
${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} |
421 |
.endif |
422 |
.endfor |
423 |
.for _dir in usr.bin/lex/lib |
424 |
cd ${.CURDIR}/${_dir}; \ |
425 |
${LIB32MAKE} DESTDIR=${LIB32TMP} obj |
426 |
.endfor |
427 |
.for _dir in lib/libncurses lib/libmagic |
428 |
cd ${.CURDIR}/${_dir}; \ |
429 |
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools |
430 |
.endfor |
431 |
cd ${.CURDIR}; \ |
432 |
${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries |
433 |
.for _t in obj depend all |
434 |
cd ${.CURDIR}/libexec/rtld-elf; \ |
435 |
PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t} |
436 |
.endfor |
437 |
|
438 |
distribute32 install32: |
439 |
.if make(distribute32) |
440 |
mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree |
441 |
.else |
442 |
mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree |
443 |
.endif |
444 |
cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} |
445 |
cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} |
446 |
.if !defined(NO_CRYPT) |
447 |
cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} |
448 |
.endif |
449 |
cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} |
450 |
.endif |
451 |
|
452 |
|
453 |
WMAKE_TGTS= |
454 |
.if !defined(SUBDIR_OVERRIDE) |
455 |
WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools |
456 |
.endif |
457 |
WMAKE_TGTS+= _cleanobj _obj _build-tools |
458 |
.if !defined(SUBDIR_OVERRIDE) |
459 |
WMAKE_TGTS+= _cross-tools |
460 |
.endif |
461 |
WMAKE_TGTS+= _includes _libraries _depend everything |
462 |
.if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32) |
463 |
WMAKE_TGTS+= build32 |
464 |
.endif |
465 |
|
466 |
buildworld: ${WMAKE_TGTS} |
467 |
.ORDER: ${WMAKE_TGTS} |
468 |
|
469 |
buildenv: |
470 |
@echo Entering world for ${TARGET_ARCH}:${TARGET} |
471 |
@cd ${.CURDIR} && env ${WMAKEENV} sh || true |
472 |
|
473 |
TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} |
474 |
toolchain: ${TOOLCHAIN_TGTS} |
475 |
kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} |
476 |
|
477 |
# |
478 |
# Use this to add checks to installworld/installkernel targets. |
479 |
# |
480 |
SPECIAL_INSTALLCHECKS= |
481 |
|
482 |
# |
483 |
# Require DESTDIR to be set if installing for a different architecture. |
484 |
# |
485 |
.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} |
486 |
.if !make(distributeworld) |
487 |
SPECIAL_INSTALLCHECKS+= installcheck_DESTDIR |
488 |
installcheck_DESTDIR: |
489 |
.if !defined(DESTDIR) || empty(DESTDIR) |
490 |
@echo "ERROR: Please set DESTDIR!"; \ |
491 |
false |
492 |
.endif |
493 |
.endif |
494 |
.endif |
495 |
|
496 |
# |
497 |
# installcheck |
498 |
# |
499 |
# Checks to be sure system is ready for installworld |
500 |
# |
501 |
CHECK_UIDS= |
502 |
CHECK_GIDS= audit |
503 |
.if !defined(NO_SENDMAIL) |
504 |
CHECK_UIDS+= smmsp |
505 |
CHECK_GIDS+= smmsp |
506 |
.endif |
507 |
.if !defined(NO_PF) |
508 |
CHECK_UIDS+= proxy |
509 |
CHECK_GIDS+= proxy authpf |
510 |
.endif |
511 |
installcheck: ${SPECIAL_INSTALLCHECKS} |
512 |
.for uid in ${CHECK_UIDS} |
513 |
@if ! `id -u ${uid} >/dev/null 2>&1`; then \ |
514 |
echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ |
515 |
false; \ |
516 |
fi |
517 |
.endfor |
518 |
.for gid in ${CHECK_GIDS} |
519 |
@if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ |
520 |
echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ |
521 |
false; \ |
522 |
fi |
523 |
.endfor |
524 |
|
525 |
# |
526 |
# distributeworld |
527 |
# |
528 |
# Distributes everything compiled by a `buildworld'. |
529 |
# |
530 |
# installworld |
531 |
# |
532 |
# Installs everything compiled by a 'buildworld'. |
533 |
# |
534 |
distributeworld installworld: installcheck |
535 |
mkdir -p ${INSTALLTMP} |
536 |
for prog in [ awk cap_mkdb cat chflags chmod chown \ |
537 |
date echo egrep find grep install-info \ |
538 |
ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ |
539 |
test true uname wc zic; do \ |
540 |
cp `which $$prog` ${INSTALLTMP}; \ |
541 |
done |
542 |
${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} |
543 |
rm -rf ${INSTALLTMP} |
544 |
|
545 |
# |
546 |
# reinstall |
547 |
# |
548 |
# If you have a build server, you can NFS mount the source and obj directories |
549 |
# and do a 'make reinstall' on the *client* to install new binaries from the |
550 |
# most recent server build. |
551 |
# |
552 |
reinstall: ${SPECIAL_INSTALLCHECKS} |
553 |
@echo "--------------------------------------------------------------" |
554 |
@echo ">>> Making hierarchy" |
555 |
@echo "--------------------------------------------------------------" |
556 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy |
557 |
@echo |
558 |
@echo "--------------------------------------------------------------" |
559 |
@echo ">>> Installing everything" |
560 |
@echo "--------------------------------------------------------------" |
561 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install |
562 |
.if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32) |
563 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 |
564 |
.endif |
565 |
|
566 |
redistribute: |
567 |
@echo "--------------------------------------------------------------" |
568 |
@echo ">>> Distributing everything" |
569 |
@echo "--------------------------------------------------------------" |
570 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute |
571 |
.if ${TARGET_ARCH} == "amd64" && !defined(NO_LIB32) |
572 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32 |
573 |
.endif |
574 |
|
575 |
distrib-dirs distribution: |
576 |
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} |
577 |
|
578 |
# |
579 |
# buildkernel and installkernel |
580 |
# |
581 |
# Which kernels to build and/or install is specified by setting |
582 |
# KERNCONF. If not defined a GENERIC kernel is built/installed. |
583 |
# Only the existing (depending TARGET) config files are used |
584 |
# for building kernels and only the first of these is designated |
585 |
# as the one being installed. |
586 |
# |
587 |
# Note that we have to use TARGET instead of TARGET_ARCH when |
588 |
# we're in kernel-land. Since only TARGET_ARCH is (expected) to |
589 |
# be set to cross-build, we have to make sure TARGET is set |
590 |
# properly. |
591 |
|
592 |
.if !defined(KERNCONF) && defined(KERNEL) |
593 |
KERNCONF= ${KERNEL} |
594 |
KERNWARN= |
595 |
.else |
596 |
KERNCONF?= GENERIC |
597 |
.endif |
598 |
INSTKERNNAME?= kernel |
599 |
|
600 |
KERNSRCDIR?= ${.CURDIR}/sys |
601 |
KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf |
602 |
KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} |
603 |
KERNCONFDIR?= ${KRNLCONFDIR} |
604 |
|
605 |
BUILDKERNELS= |
606 |
INSTALLKERNEL= |
607 |
.for _kernel in ${KERNCONF} |
608 |
.if exists(${KERNCONFDIR}/${_kernel}) |
609 |
BUILDKERNELS+= ${_kernel} |
610 |
.if empty(INSTALLKERNEL) |
611 |
INSTALLKERNEL= ${_kernel} |
612 |
.endif |
613 |
.endif |
614 |
.endfor |
615 |
|
616 |
# |
617 |
# buildkernel |
618 |
# |
619 |
# Builds all kernels defined by BUILDKERNELS. |
620 |
# |
621 |
buildkernel: |
622 |
.if empty(BUILDKERNELS) |
623 |
@echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ |
624 |
false |
625 |
.endif |
626 |
.if defined(KERNWARN) |
627 |
@echo "--------------------------------------------------------------" |
628 |
@echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" |
629 |
@echo "--------------------------------------------------------------" |
630 |
@sleep 3 |
631 |
.endif |
632 |
@echo |
633 |
.for _kernel in ${BUILDKERNELS} |
634 |
@echo "--------------------------------------------------------------" |
635 |
@echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" |
636 |
@echo "--------------------------------------------------------------" |
637 |
@echo "===> ${_kernel}" |
638 |
mkdir -p ${KRNLOBJDIR} |
639 |
.if !defined(NO_KERNELCONFIG) |
640 |
@echo |
641 |
@echo "--------------------------------------------------------------" |
642 |
@echo ">>> stage 1: configuring the kernel" |
643 |
@echo "--------------------------------------------------------------" |
644 |
cd ${KRNLCONFDIR}; \ |
645 |
PATH=${TMPPATH} \ |
646 |
config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ |
647 |
${KERNCONFDIR}/${_kernel} |
648 |
.endif |
649 |
.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) |
650 |
@echo |
651 |
@echo "--------------------------------------------------------------" |
652 |
@echo ">>> stage 2.1: cleaning up the object tree" |
653 |
@echo "--------------------------------------------------------------" |
654 |
cd ${KRNLOBJDIR}/${_kernel}; \ |
655 |
${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR} |
656 |
.endif |
657 |
@echo |
658 |
@echo "--------------------------------------------------------------" |
659 |
@echo ">>> stage 2.2: rebuilding the object tree" |
660 |
@echo "--------------------------------------------------------------" |
661 |
cd ${KRNLOBJDIR}/${_kernel}; \ |
662 |
${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj |
663 |
@echo |
664 |
@echo "--------------------------------------------------------------" |
665 |
@echo ">>> stage 2.3: build tools" |
666 |
@echo "--------------------------------------------------------------" |
667 |
cd ${KRNLOBJDIR}/${_kernel}; \ |
668 |
MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ |
669 |
${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile |
670 |
# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. |
671 |
.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) |
672 |
.for target in obj depend all |
673 |
cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ |
674 |
MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ |
675 |
${MAKE} -DNO_CPU_CFLAGS ${target} |
676 |
.endfor |
677 |
.endif |
678 |
.if !defined(NO_KERNELDEPEND) |
679 |
@echo |
680 |
@echo "--------------------------------------------------------------" |
681 |
@echo ">>> stage 3.1: making dependencies" |
682 |
@echo "--------------------------------------------------------------" |
683 |
cd ${KRNLOBJDIR}/${_kernel}; \ |
684 |
${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ |
685 |
.endif |
686 |
@echo |
687 |
@echo "--------------------------------------------------------------" |
688 |
@echo ">>> stage 3.2: building everything" |
689 |
@echo "--------------------------------------------------------------" |
690 |
cd ${KRNLOBJDIR}/${_kernel}; \ |
691 |
${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ |
692 |
@echo "--------------------------------------------------------------" |
693 |
@echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" |
694 |
@echo "--------------------------------------------------------------" |
695 |
.endfor |
696 |
|
697 |
# |
698 |
# installkernel, etc. |
699 |
# |
700 |
# Install the kernel defined by INSTALLKERNEL |
701 |
# |
702 |
installkernel installkernel.debug \ |
703 |
reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS} |
704 |
.if empty(INSTALLKERNEL) |
705 |
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ |
706 |
false |
707 |
.endif |
708 |
@echo "--------------------------------------------------------------" |
709 |
@echo ">>> Installing kernel" |
710 |
@echo "--------------------------------------------------------------" |
711 |
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ |
712 |
${CROSSENV} PATH=${TMPPATH} \ |
713 |
${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} |
714 |
|
715 |
# |
716 |
# update |
717 |
# |
718 |
# Update the source tree, by running cvsup and/or running cvs to update to the |
719 |
# latest copy. |
720 |
# |
721 |
update: |
722 |
.if defined(SUP_UPDATE) |
723 |
@echo "--------------------------------------------------------------" |
724 |
@echo ">>> Running ${SUP}" |
725 |
@echo "--------------------------------------------------------------" |
726 |
.if defined(SUPFILE) |
727 |
@${SUP} ${SUPFLAGS} ${SUPFILE} |
728 |
.endif |
729 |
.if defined(SUPFILE1) |
730 |
@${SUP} ${SUPFLAGS} ${SUPFILE1} |
731 |
.endif |
732 |
.if defined(SUPFILE2) |
733 |
@${SUP} ${SUPFLAGS} ${SUPFILE2} |
734 |
.endif |
735 |
.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) |
736 |
@${SUP} ${SUPFLAGS} ${PORTSSUPFILE} |
737 |
.endif |
738 |
.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) |
739 |
@${SUP} ${SUPFLAGS} ${DOCSUPFILE} |
740 |
.endif |
741 |
.endif |
742 |
.if defined(CVS_UPDATE) |
743 |
@echo "--------------------------------------------------------------" |
744 |
@echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} |
745 |
@echo "--------------------------------------------------------------" |
746 |
cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS} |
747 |
.endif |
748 |
|
749 |
# |
750 |
# ------------------------------------------------------------------------ |
751 |
# |
752 |
# From here onwards are utility targets used by the 'make world' and |
753 |
# related targets. If your 'world' breaks, you may like to try to fix |
754 |
# the problem and manually run the following targets to attempt to |
755 |
# complete the build. Beware, this is *not* guaranteed to work, you |
756 |
# need to have a pretty good grip on the current state of the system |
757 |
# to attempt to manually finish it. If in doubt, 'make world' again. |
758 |
# |
759 |
|
760 |
# |
761 |
# legacy: Build compatibility shims for the next three targets |
762 |
# |
763 |
legacy: |
764 |
.if ${BOOTSTRAPPING} < 503000 |
765 |
@echo "ERROR: Source upgrades from versions prior to 5.3 not supported."; \ |
766 |
false |
767 |
.endif |
768 |
.for _tool in tools/build |
769 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ |
770 |
cd ${.CURDIR}/${_tool}; \ |
771 |
${MAKE} DIRPRFX=${_tool}/ obj; \ |
772 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \ |
773 |
${MAKE} DIRPRFX=${_tool}/ depend; \ |
774 |
${MAKE} DIRPRFX=${_tool}/ all; \ |
775 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install |
776 |
.endfor |
777 |
|
778 |
# |
779 |
# bootstrap-tools: Build tools needed for compatibility |
780 |
# |
781 |
.if !defined(NO_GAMES) |
782 |
_strfile= games/fortune/strfile |
783 |
.endif |
784 |
|
785 |
.if !defined(NO_CXX) |
786 |
_gperf= gnu/usr.bin/gperf |
787 |
.if ${BOOTSTRAPPING} < 600101 |
788 |
_groff= gnu/usr.bin/groff |
789 |
.else |
790 |
_groff= gnu/usr.bin/groff/tmac |
791 |
.endif |
792 |
.endif |
793 |
|
794 |
.if ${BOOTSTRAPPING} < 600029 |
795 |
_texinfo= gnu/usr.bin/texinfo |
796 |
.endif |
797 |
|
798 |
.if ${BOOTSTRAPPING} < 600015 |
799 |
_cap_mkdb= usr.bin/cap_mkdb |
800 |
.endif |
801 |
|
802 |
.if ${BOOTSTRAPPING} < 600018 |
803 |
_colldef= usr.bin/colldef |
804 |
.endif |
805 |
|
806 |
.if ${BOOTSTRAPPING} < 600017 |
807 |
_gencat= usr.bin/gencat |
808 |
.endif |
809 |
|
810 |
.if ${BOOTSTRAPPING} < 600016 |
811 |
_mklocale= usr.bin/mklocale |
812 |
.endif |
813 |
|
814 |
.if ${BOOTSTRAPPING} < 600106 |
815 |
_gensnmptree= usr.sbin/bsnmpd/gensnmptree |
816 |
.endif |
817 |
|
818 |
.if !defined(NO_RESCUE) && \ |
819 |
${BOOTSTRAPPING} < 600008 |
820 |
_crunchgen= usr.sbin/crunch/crunchgen |
821 |
.endif |
822 |
|
823 |
.if ${BOOTSTRAPPING} < 600020 |
824 |
_pwd_mkdb= usr.sbin/pwd_mkdb |
825 |
.endif |
826 |
|
827 |
bootstrap-tools: |
828 |
.for _tool in \ |
829 |
${_strfile} \ |
830 |
${_gperf} \ |
831 |
${_groff} \ |
832 |
${_texinfo} \ |
833 |
${_cap_mkdb} \ |
834 |
${_colldef} \ |
835 |
${_gencat} \ |
836 |
usr.bin/lorder \ |
837 |
usr.bin/makewhatis \ |
838 |
${_mklocale} \ |
839 |
usr.bin/rpcgen \ |
840 |
${_gensnmptree} \ |
841 |
usr.bin/xinstall \ |
842 |
usr.sbin/config \ |
843 |
${_crunchgen} \ |
844 |
${_pwd_mkdb} |
845 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ |
846 |
cd ${.CURDIR}/${_tool}; \ |
847 |
${MAKE} DIRPRFX=${_tool}/ obj; \ |
848 |
${MAKE} DIRPRFX=${_tool}/ depend; \ |
849 |
${MAKE} DIRPRFX=${_tool}/ all; \ |
850 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install |
851 |
.endfor |
852 |
|
853 |
# |
854 |
# build-tools: Build special purpose build tools |
855 |
# |
856 |
.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) |
857 |
_aicasm= sys/modules/aic7xxx/aicasm |
858 |
.endif |
859 |
|
860 |
.if !defined(NO_SHARE) |
861 |
_share= share/syscons/scrnmaps |
862 |
.endif |
863 |
|
864 |
.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) |
865 |
_kerberos5_tools= kerberos5/tools |
866 |
.endif |
867 |
|
868 |
.if !defined(NO_RESCUE) |
869 |
_rescue= rescue/rescue |
870 |
.endif |
871 |
|
872 |
build-tools: |
873 |
.for _tool in \ |
874 |
bin/csh \ |
875 |
bin/sh \ |
876 |
${_rescue} \ |
877 |
lib/libncurses \ |
878 |
${_share} \ |
879 |
${_aicasm} \ |
880 |
usr.bin/awk \ |
881 |
lib/libmagic \ |
882 |
usr.sbin/sysinstall |
883 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ |
884 |
cd ${.CURDIR}/${_tool}; \ |
885 |
${MAKE} DIRPRFX=${_tool}/ obj; \ |
886 |
${MAKE} DIRPRFX=${_tool}/ build-tools |
887 |
.endfor |
888 |
.for _tool in \ |
889 |
gnu/usr.bin/cc/cc_tools \ |
890 |
${_kerberos5_tools} |
891 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \ |
892 |
cd ${.CURDIR}/${_tool}; \ |
893 |
${MAKE} DIRPRFX=${_tool}/ obj; \ |
894 |
${MAKE} DIRPRFX=${_tool}/ depend; \ |
895 |
${MAKE} DIRPRFX=${_tool}/ all |
896 |
.endfor |
897 |
|
898 |
# |
899 |
# cross-tools: Build cross-building tools |
900 |
# |
901 |
.if (${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386") && \ |
902 |
${TARGET_ARCH} != ${MACHINE_ARCH} |
903 |
_btxld= usr.sbin/btxld |
904 |
.endif |
905 |
|
906 |
.if (!defined(NO_RESCUE) || defined(RELEASEDIR)) && \ |
907 |
${TARGET_ARCH} != ${MACHINE_ARCH} |
908 |
_crunchide= usr.sbin/crunch/crunchide |
909 |
.endif |
910 |
|
911 |
.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \ |
912 |
defined(RELEASEDIR) |
913 |
_kgzip= usr.sbin/kgzip |
914 |
.endif |
915 |
|
916 |
cross-tools: |
917 |
.for _tool in \ |
918 |
gnu/usr.bin/binutils \ |
919 |
gnu/usr.bin/cc \ |
920 |
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ |
921 |
${_btxld} \ |
922 |
${_crunchide} \ |
923 |
${_kgzip} |
924 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ |
925 |
cd ${.CURDIR}/${_tool}; \ |
926 |
${MAKE} DIRPRFX=${_tool}/ obj; \ |
927 |
${MAKE} DIRPRFX=${_tool}/ depend; \ |
928 |
${MAKE} DIRPRFX=${_tool}/ all; \ |
929 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install |
930 |
.endfor |
931 |
|
932 |
# |
933 |
# hierarchy - ensure that all the needed directories are present |
934 |
# |
935 |
hierarchy: |
936 |
cd ${.CURDIR}/etc; ${MAKE} distrib-dirs |
937 |
|
938 |
# |
939 |
# libraries - build all libraries, and install them under ${DESTDIR}. |
940 |
# |
941 |
# The list of libraries with dependents (${_prebuild_libs}) and their |
942 |
# interdependencies (__L) are built automatically by the |
943 |
# ${.CURDIR}/tools/make_libdeps.sh script. |
944 |
# |
945 |
libraries: |
946 |
cd ${.CURDIR}; \ |
947 |
${MAKE} -f Makefile.inc1 _startup_libs; \ |
948 |
${MAKE} -f Makefile.inc1 _prebuild_libs; \ |
949 |
${MAKE} -f Makefile.inc1 _generic_libs; |
950 |
|
951 |
# These dependencies are not automatically generated: |
952 |
# |
953 |
# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all |
954 |
# shared libraries for ELF. |
955 |
# |
956 |
_startup_libs= gnu/lib/csu gnu/lib/libgcc |
957 |
.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) |
958 |
_startup_libs+= lib/csu/${MACHINE_ARCH}-elf |
959 |
.else |
960 |
_startup_libs+= lib/csu/${MACHINE_ARCH} |
961 |
.endif |
962 |
|
963 |
_prebuild_libs= |
964 |
|
965 |
_generic_libs= gnu/lib |
966 |
|
967 |
.if !defined(NO_KERBEROS) && !defined(NO_CRYPT) && !defined(NO_OPENSSL) |
968 |
_prebuild_libs+= kerberos5/lib/libasn1 |
969 |
_prebuild_libs+= kerberos5/lib/libgssapi |
970 |
_prebuild_libs+= kerberos5/lib/libkrb5 |
971 |
_prebuild_libs+= kerberos5/lib/libroken |
972 |
_generic_libs+= kerberos5/lib |
973 |
.endif |
974 |
|
975 |
_prebuild_libs+= lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \ |
976 |
lib/libkvm lib/libmd \ |
977 |
lib/libncurses \ |
978 |
lib/libnetgraph lib/libopie lib/libpam \ |
979 |
lib/libpthread lib/libthr lib/libradius \ |
980 |
lib/libsbuf lib/libtacplus lib/libutil \ |
981 |
lib/libz lib/msun |
982 |
|
983 |
lib/libopie__L lib/libtacplus__L: lib/libmd__L |
984 |
|
985 |
_generic_libs+= lib |
986 |
|
987 |
.if !defined(NO_CRYPT) |
988 |
.if !defined(NO_OPENSSL) |
989 |
_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl |
990 |
lib/libradius__L: secure/lib/libssl__L |
991 |
secure/lib/libssl__L: secure/lib/libcrypto__L |
992 |
.if !defined(NO_OPENSSH) |
993 |
_prebuild_libs+= secure/lib/libssh |
994 |
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L \ |
995 |
lib/libmd__L |
996 |
.if !defined(NO_KERBEROS) |
997 |
secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \ |
998 |
kerberos5/lib/libasn1__L lib/libcom_err__L \ |
999 |
kerberos5/lib/libroken__L |
1000 |
.endif |
1001 |
.endif |
1002 |
.endif |
1003 |
_generic_libs+= secure/lib |
1004 |
.endif |
1005 |
|
1006 |
.if defined(NO_CRYPT) || defined(NO_OPENSSL) |
1007 |
lib/libradius__L: lib/libmd__L |
1008 |
.endif |
1009 |
|
1010 |
.if !defined(NO_NIS) |
1011 |
_prebuild_libs+= lib/libypclnt |
1012 |
.endif |
1013 |
|
1014 |
_generic_libs+= usr.bin/lex/lib |
1015 |
|
1016 |
.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} |
1017 |
${_lib}__L: .PHONY |
1018 |
.if exists(${.CURDIR}/${_lib}) |
1019 |
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ |
1020 |
cd ${.CURDIR}/${_lib}; \ |
1021 |
${MAKE} DIRPRFX=${_lib}/ obj; \ |
1022 |
${MAKE} DIRPRFX=${_lib}/ depend; \ |
1023 |
${MAKE} DIRPRFX=${_lib}/ all; \ |
1024 |
${MAKE} DIRPRFX=${_lib}/ install |
1025 |
.endif |
1026 |
.endfor |
1027 |
|
1028 |
# libpam is special: we need to build static PAM modules before |
1029 |
# static PAM library, and dynamic PAM library before dynamic PAM |
1030 |
# modules. |
1031 |
lib/libpam__L: .PHONY |
1032 |
${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ |
1033 |
cd ${.CURDIR}/lib/libpam; \ |
1034 |
${MAKE} DIRPRFX=lib/libpam/ obj; \ |
1035 |
${MAKE} DIRPRFX=lib/libpam/ depend; \ |
1036 |
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ |
1037 |
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install |
1038 |
|
1039 |
_startup_libs: ${_startup_libs:S/$/__L/} |
1040 |
_prebuild_libs: ${_prebuild_libs:S/$/__L/} |
1041 |
_generic_libs: ${_generic_libs:S/$/__L/} |
1042 |
|
1043 |
.for __target in all clean cleandepend cleandir depend includes obj |
1044 |
.for entry in ${SUBDIR} |
1045 |
${entry}.${__target}__D: .PHONY |
1046 |
${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ |
1047 |
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ |
1048 |
edir=${entry}.${MACHINE_ARCH}; \ |
1049 |
cd ${.CURDIR}/$${edir}; \ |
1050 |
else \ |
1051 |
${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ |
1052 |
edir=${entry}; \ |
1053 |
cd ${.CURDIR}/$${edir}; \ |
1054 |
fi; \ |
1055 |
${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ |
1056 |
.endfor |
1057 |
par-${__target}: ${SUBDIR:S/$/.${__target}__D/} |
1058 |
.endfor |
1059 |
|
1060 |
.include <bsd.subdir.mk> |
1061 |
|
1062 |
.if make(delete-old) || make(delete-old-libs) || make(check-old) |
1063 |
|
1064 |
# |
1065 |
# check for / delete old files section |
1066 |
# |
1067 |
|
1068 |
.include "ObsoleteFiles.inc" |
1069 |
|
1070 |
OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ |
1071 |
else you can not start such an application. Consult UPDATING for more \ |
1072 |
information regarding how to cope with the removal/revision bump of a \ |
1073 |
specific library." |
1074 |
|
1075 |
.if !defined(BATCH_DELETE_OLD_FILES) |
1076 |
RM_I=-i |
1077 |
.else |
1078 |
RM_I=-v |
1079 |
.endif |
1080 |
|
1081 |
delete-old-files: |
1082 |
@echo ">>> Removing old files (only deletes safe to delete libs)" |
1083 |
.for file in ${OLD_FILES} |
1084 |
# Ask for every old file if the user really wants to remove it. |
1085 |
# It's annoying, but better safe than sorry. |
1086 |
@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \ |
1087 |
|| ([ -f "${DESTDIR}/${file}" ] \ |
1088 |
&& echo "Removing schg flag on ${DESTDIR}/${file}" \ |
1089 |
&& chflags noschg "${DESTDIR}/${file}" \ |
1090 |
&& rm ${RM_I} "${DESTDIR}/${file}")) |
1091 |
.endfor |
1092 |
# Remove catpages without corresponding manpages. |
1093 |
@3<&0; \ |
1094 |
find ${DESTDIR}/usr/share/man/cat* ! -type d | \ |
1095 |
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ |
1096 |
while read catpage; do \ |
1097 |
read manpage; \ |
1098 |
if [ ! -e "$${manpage}" ]; then \ |
1099 |
rm ${RM_I} $${catpage} <&3 ; \ |
1100 |
fi; \ |
1101 |
done |
1102 |
@echo ">>> Old files removed" |
1103 |
|
1104 |
check-old-files: |
1105 |
@echo ">>> Checking for old files" |
1106 |
.for file in ${OLD_FILES} |
1107 |
@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}" |
1108 |
.endfor |
1109 |
# Check for catpages without corresponding manpages. |
1110 |
@find ${DESTDIR}/usr/share/man/cat* ! -type d | \ |
1111 |
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ |
1112 |
while read catpage; do \ |
1113 |
read manpage; \ |
1114 |
if [ ! -e "$${manpage}" ]; then \ |
1115 |
echo $${catpage} ; \ |
1116 |
fi; \ |
1117 |
done |
1118 |
|
1119 |
delete-old-libs: |
1120 |
@echo ">>> Removing old libraries" |
1121 |
@echo "${OLD_LIBS_MESSAGE}" | fmt |
1122 |
.for file in ${OLD_LIBS} |
1123 |
@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \ |
1124 |
|| ([ -f "${DESTDIR}/${file}" ] \ |
1125 |
&& echo "Removing schg flag on ${DESTDIR}/${file}" \ |
1126 |
&& chflags noschg "${DESTDIR}/${file}" \ |
1127 |
&& rm ${RM_I} "${DESTDIR}/${file}")) |
1128 |
.endfor |
1129 |
@echo ">>> Old libraries removed" |
1130 |
|
1131 |
check-old-libs: |
1132 |
@echo ">>> Checking for old libraries" |
1133 |
.for file in ${OLD_LIBS} |
1134 |
@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}" |
1135 |
.endfor |
1136 |
|
1137 |
delete-old-dirs: |
1138 |
@echo ">>> Removing old directories" |
1139 |
.for dir in ${OLD_DIRS} |
1140 |
# Don't fail if an old directory isn't empty. |
1141 |
@[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true) |
1142 |
.endfor |
1143 |
@echo ">>> Old directories removed" |
1144 |
|
1145 |
check-old-dirs: |
1146 |
@echo ">>> Checking for old directories" |
1147 |
.for dir in ${OLD_DIRS} |
1148 |
@[ ! -d "${DESTDIR}/${dir}" ] || echo "${DESTDIR}/${dir}" |
1149 |
.endfor |
1150 |
|
1151 |
delete-old: delete-old-files delete-old-dirs |
1152 |
@echo "To remove old libraries run '${MAKE} delete-old-libs'." |
1153 |
|
1154 |
check-old: check-old-files check-old-libs check-old-dirs |
1155 |
@echo "To remove old files and directories run '${MAKE} delete-old'." |
1156 |
@echo "To remove old libraries run '${MAKE} delete-old-libs'." |
1157 |
|
1158 |
.endif |
1159 |
|