1 |
# |
2 |
# $MidnightBSD$ |
3 |
# |
4 |
# Make command line options: |
5 |
# -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir |
6 |
# -DNO_CLEAN do not clean at all |
7 |
# -DNO_SHARE do not go into share subdir |
8 |
# -DKERNFAST define NO_KERNEL{CONFIG,CLEAN,DEPEND,OBJ} |
9 |
# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel |
10 |
# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel |
11 |
# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel |
12 |
# -DNO_KERNELOBJ do not run ${MAKE} obj in ${MAKE} buildkernel |
13 |
# -DNO_PORTSUPDATE do not update ports in ${MAKE} update |
14 |
# -DNO_DOCUPDATE do not update doc in ${MAKE} update |
15 |
# -DNO_CTF do not run the DTrace CTF conversion tools on built objects |
16 |
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list |
17 |
# TARGET="machine" to crossbuild world for a different machine type |
18 |
# TARGET_ARCH= may be required when a TARGET supports multiple endians |
19 |
|
20 |
# |
21 |
# The intended user-driven targets are: |
22 |
# buildworld - rebuild *everything*, including glue to help do upgrades |
23 |
# installworld- install everything built by "buildworld" |
24 |
# doxygen - build API documentation of the kernel |
25 |
# update - convenient way to update your source tree (eg: cvsup/cvs) |
26 |
# |
27 |
# Standard targets (not defined here) are documented in the makefiles in |
28 |
# /usr/share/mk. These include: |
29 |
# obj depend all install clean cleandepend cleanobj |
30 |
|
31 |
# You are supposed to define both of these when calling Makefile.inc1 |
32 |
# directly. However, some old scripts don't. Cope for the moment, but |
33 |
# issue a new warning for a transition period. |
34 |
.if defined(TARGET) && !defined(TARGET_ARCH) |
35 |
.warning "You must pass both TARGET and TARGET_ARCH to Makefile.inc1. Setting TARGET_ARCH=${TARGET}." |
36 |
TARGET_ARCH=${TARGET} |
37 |
.endif |
38 |
.if !defined(TARGET) || !defined(TARGET_ARCH) |
39 |
.error "Both TARGET and TARGET_ARCH must be defined." |
40 |
.endif |
41 |
|
42 |
.include <bsd.own.mk> |
43 |
.include <bsd.arch.inc.mk> |
44 |
.include <bsd.compiler.mk> |
45 |
|
46 |
# We must do share/info early so that installation of info `dir' |
47 |
# entries works correctly. Do it first since it is less likely to |
48 |
# grow dependencies on include and lib than vice versa. |
49 |
# |
50 |
# We must do lib/ and libexec/ before bin/, because if installworld |
51 |
# installs a new /bin/sh, the 'make' command will *immediately* |
52 |
# use that new version. And the new (dynamically-linked) /bin/sh |
53 |
# will expect to find appropriate libraries in /lib and /libexec. |
54 |
# |
55 |
SUBDIR= share/info lib libexec |
56 |
SUBDIR+=bin |
57 |
.if ${MK_APACHE} != "no" |
58 |
SUBDIR+=apache |
59 |
.endif |
60 |
.if ${MK_GAMES} != "no" |
61 |
SUBDIR+=games |
62 |
.endif |
63 |
.if ${MK_CDDL} != "no" |
64 |
SUBDIR+=cddl |
65 |
.else |
66 |
NO_CTF=1 |
67 |
.endif |
68 |
SUBDIR+=gnu include |
69 |
.if ${MK_KERBEROS} != "no" |
70 |
SUBDIR+=kerberos5 |
71 |
.endif |
72 |
.if ${MK_RESCUE} != "no" |
73 |
SUBDIR+=rescue |
74 |
.endif |
75 |
SUBDIR+=sbin |
76 |
.if ${MK_CRYPT} != "no" |
77 |
SUBDIR+=secure |
78 |
.endif |
79 |
.if !defined(NO_SHARE) |
80 |
SUBDIR+=share |
81 |
.endif |
82 |
SUBDIR+=sys usr.bin usr.sbin |
83 |
.if ${MK_OFED} != "no" |
84 |
SUBDIR+=contrib/ofed |
85 |
.endif |
86 |
# |
87 |
# We must do etc/ last for install/distribute to work. |
88 |
# |
89 |
SUBDIR+=etc |
90 |
|
91 |
# These are last, since it is nice to at least get the base system |
92 |
# rebuilt before you do them. |
93 |
.for _DIR in ${LOCAL_DIRS} |
94 |
.if exists(${.CURDIR}/${_DIR}/Makefile) |
95 |
SUBDIR+= ${_DIR} |
96 |
.endif |
97 |
.endfor |
98 |
|
99 |
.if defined(SUBDIR_OVERRIDE) |
100 |
SUBDIR= ${SUBDIR_OVERRIDE} |
101 |
.endif |
102 |
|
103 |
.if defined(NOCLEAN) |
104 |
NO_CLEAN= ${NOCLEAN} |
105 |
.endif |
106 |
.if defined(NO_CLEANDIR) |
107 |
CLEANDIR= clean cleandepend |
108 |
.else |
109 |
CLEANDIR= cleandir |
110 |
.endif |
111 |
|
112 |
SVN?= /usr/local/bin/svn |
113 |
SVNFLAGS?= -r HEAD |
114 |
|
115 |
MAKEOBJDIRPREFIX?= /usr/obj |
116 |
.if !defined(OSRELDATE) |
117 |
.if exists(/usr/include/osreldate.h) |
118 |
OSRELDATE!= awk '/^\#define[[:space:]]*__MidnightBSD_version/ { print $$3 }' \ |
119 |
/usr/include/osreldate.h |
120 |
.else |
121 |
OSRELDATE= 0 |
122 |
.endif |
123 |
.endif |
124 |
|
125 |
.if !defined(VERSION) |
126 |
VERSION!= uname -srp |
127 |
VERSION+= ${OSRELDATE} |
128 |
.endif |
129 |
|
130 |
|
131 |
KNOWN_ARCHES?= amd64 i386 |
132 |
.if ${TARGET} == ${TARGET_ARCH} |
133 |
_t= ${TARGET} |
134 |
.else |
135 |
_t= ${TARGET_ARCH}/${TARGET} |
136 |
.endif |
137 |
.for _t in ${_t} |
138 |
.if empty(KNOWN_ARCHES:M${_t}) |
139 |
.error Unknown target ${TARGET_ARCH}:${TARGET}. |
140 |
.endif |
141 |
.endfor |
142 |
|
143 |
.if ${TARGET} == ${MACHINE} |
144 |
TARGET_CPUTYPE?=${CPUTYPE} |
145 |
.else |
146 |
TARGET_CPUTYPE?= |
147 |
.endif |
148 |
|
149 |
.if !empty(TARGET_CPUTYPE) |
150 |
_TARGET_CPUTYPE=${TARGET_CPUTYPE} |
151 |
.else |
152 |
_TARGET_CPUTYPE=dummy |
153 |
.endif |
154 |
_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \ |
155 |
-f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE |
156 |
.if ${_CPUTYPE} != ${_TARGET_CPUTYPE} |
157 |
.error CPUTYPE global should be set with ?=. |
158 |
.endif |
159 |
.if make(buildworld) |
160 |
BUILD_ARCH!= uname -p |
161 |
.if ${MACHINE_ARCH} != ${BUILD_ARCH} |
162 |
.error To cross-build, set TARGET_ARCH. |
163 |
.endif |
164 |
.endif |
165 |
.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) |
166 |
OBJTREE= ${MAKEOBJDIRPREFIX} |
167 |
.else |
168 |
OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} |
169 |
.endif |
170 |
WORLDTMP= ${OBJTREE}${.CURDIR}/tmp |
171 |
# /usr/games added for fortune which depend on strfile |
172 |
BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games |
173 |
XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games |
174 |
STRICTTMPPATH= ${BPATH}:${XPATH} |
175 |
TMPPATH= ${STRICTTMPPATH}:${PATH} |
176 |
|
177 |
# |
178 |
# Avoid running mktemp(1) unless actually needed. |
179 |
# It may not be functional, e.g., due to new ABI |
180 |
# when in the middle of installing over this system. |
181 |
# |
182 |
.if make(distributeworld) || make(installworld) |
183 |
INSTALLTMP!= /usr/bin/mktemp -d -u -t install |
184 |
.endif |
185 |
|
186 |
# |
187 |
# Building a world goes through the following stages |
188 |
# |
189 |
# 1. legacy stage [BMAKE] |
190 |
# This stage is responsible for creating compatibility |
191 |
# shims that are needed by the bootstrap-tools, |
192 |
# build-tools and cross-tools stages. |
193 |
# 1. bootstrap-tools stage [BMAKE] |
194 |
# This stage is responsible for creating programs that |
195 |
# are needed for backward compatibility reasons. They |
196 |
# are not built as cross-tools. |
197 |
# 2. build-tools stage [TMAKE] |
198 |
# This stage is responsible for creating the object |
199 |
# tree and building any tools that are needed during |
200 |
# the build process. |
201 |
# 3. cross-tools stage [XMAKE] |
202 |
# This stage is responsible for creating any tools that |
203 |
# are needed for cross-builds. A cross-compiler is one |
204 |
# of them. |
205 |
# 4. world stage [WMAKE] |
206 |
# This stage actually builds the world. |
207 |
# 5. install stage (optional) [IMAKE] |
208 |
# This stage installs a previously built world. |
209 |
# |
210 |
|
211 |
BOOTSTRAPPING?= 0 |
212 |
|
213 |
# Common environment for world related stages |
214 |
CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \ |
215 |
MACHINE_ARCH=${TARGET_ARCH} \ |
216 |
MACHINE=${TARGET} \ |
217 |
CPUTYPE=${TARGET_CPUTYPE} |
218 |
.if ${OSRELDATE} < 4015 |
219 |
CROSSENV+= AR=gnu-ar RANLIB=gnu-ranlib |
220 |
.endif |
221 |
.if ${MK_GROFF} != "no" |
222 |
CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ |
223 |
GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \ |
224 |
GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac |
225 |
.endif |
226 |
|
227 |
# bootstrap-tools stage |
228 |
BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
229 |
PATH=${BPATH}:${PATH} \ |
230 |
WORLDTMP=${WORLDTMP} \ |
231 |
VERSION="${VERSION}" \ |
232 |
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ |
233 |
COMPILER_TYPE=${COMPILER_TYPE} |
234 |
BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ |
235 |
${BMAKEENV} ${MAKE} -f Makefile.inc1 \ |
236 |
DESTDIR= \ |
237 |
BOOTSTRAPPING=${OSRELDATE} \ |
238 |
SSP_CFLAGS= \ |
239 |
-DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ |
240 |
-DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \ |
241 |
-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD |
242 |
|
243 |
# build-tools stage |
244 |
TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ |
245 |
${BMAKEENV} ${MAKE} -f Makefile.inc1 \ |
246 |
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ |
247 |
DESTDIR= \ |
248 |
BOOTSTRAPPING=${OSRELDATE} \ |
249 |
SSP_CFLAGS= \ |
250 |
-DNO_LINT \ |
251 |
-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD |
252 |
|
253 |
# cross-tools stage |
254 |
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ |
255 |
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ |
256 |
-DWITHOUT_GDB |
257 |
|
258 |
# world stage |
259 |
WMAKEENV= ${CROSSENV} \ |
260 |
_SHLIBDIRPREFIX=${WORLDTMP} \ |
261 |
_LDSCRIPTROOT= \ |
262 |
VERSION="${VERSION}" \ |
263 |
INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
264 |
PATH=${TMPPATH} |
265 |
.if ${MK_CDDL} == "no" |
266 |
WMAKEENV+= NO_CTF=1 |
267 |
.endif |
268 |
.if ${CC:T:Mgcc} == "gcc" |
269 |
WMAKE_COMPILER_TYPE= gcc |
270 |
.elif ${CC:T:Mclang} == "clang" |
271 |
WMAKE_COMPILER_TYPE= clang |
272 |
.elif ${MK_CLANG_IS_CC} == "no" |
273 |
WMAKE_COMPILER_TYPE= gcc |
274 |
.else |
275 |
WMAKE_COMPILER_TYPE= clang |
276 |
.endif |
277 |
WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} |
278 |
WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} |
279 |
|
280 |
.if ${TARGET_ARCH} == "amd64" |
281 |
# 32 bit world |
282 |
LIB32TMP= ${OBJTREE}${.CURDIR}/lib32 |
283 |
|
284 |
.if ${TARGET_ARCH} == "amd64" |
285 |
.if empty(TARGET_CPUTYPE) |
286 |
LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 |
287 |
.else |
288 |
LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} |
289 |
.endif |
290 |
LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ |
291 |
MACHINE_CPU="i686 mmx sse sse2" \ |
292 |
LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ |
293 |
AS="${AS} --32" |
294 |
.endif |
295 |
|
296 |
|
297 |
LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMPAT_32BIT \ |
298 |
-isystem ${LIB32TMP}/usr/include/ \ |
299 |
-L${LIB32TMP}/usr/lib32 \ |
300 |
-B${LIB32TMP}/usr/lib32 |
301 |
|
302 |
# Yes, the flags are redundant. |
303 |
LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ |
304 |
_SHLIBDIRPREFIX=${LIB32TMP} \ |
305 |
_LDSCRIPTROOT=${LIB32TMP} \ |
306 |
VERSION="${VERSION}" \ |
307 |
INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
308 |
PATH=${TMPPATH} \ |
309 |
CC="${CC} ${LIB32FLAGS}" \ |
310 |
CXX="${CXX} ${LIB32FLAGS}" \ |
311 |
LIBDIR=/usr/lib32 \ |
312 |
SHLIBDIR=/usr/lib32 \ |
313 |
COMPILER_TYPE=${WMAKE_COMPILER_TYPE} |
314 |
|
315 |
LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ |
316 |
-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \ |
317 |
-DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \ |
318 |
DESTDIR=${LIB32TMP} |
319 |
LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS |
320 |
.endif |
321 |
|
322 |
# install stage |
323 |
IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} |
324 |
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 |
325 |
.if empty(.MAKEFLAGS:M-n) |
326 |
IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ |
327 |
LD_LIBRARY_PATH=${INSTALLTMP} \ |
328 |
PATH_LOCALE=${INSTALLTMP}/locale |
329 |
IMAKE+= __MAKE_SHELL=${INSTALLTMP}/sh |
330 |
.else |
331 |
IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP} |
332 |
.endif |
333 |
|
334 |
# kernel stage |
335 |
KMAKEENV= ${WMAKEENV} |
336 |
KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} |
337 |
|
338 |
# |
339 |
# buildworld |
340 |
# |
341 |
# Attempt to rebuild the entire system, with reasonable chance of |
342 |
# success, regardless of how old your existing system is. |
343 |
# |
344 |
_worldtmp: |
345 |
.if ${.CURDIR:C/[^,]//g} != "" |
346 |
# The m4 build of sendmail files doesn't like it if ',' is used |
347 |
# anywhere in the path of it's files. |
348 |
@echo |
349 |
@echo "*** Error: path to source tree contains a comma ','" |
350 |
@echo |
351 |
false |
352 |
.endif |
353 |
@echo |
354 |
@echo "--------------------------------------------------------------" |
355 |
@echo ">>> Rebuilding the temporary build tree" |
356 |
@echo "--------------------------------------------------------------" |
357 |
.if !defined(NO_CLEAN) |
358 |
rm -rf ${WORLDTMP} |
359 |
.if defined(LIB32TMP) |
360 |
rm -rf ${LIB32TMP} |
361 |
.endif |
362 |
.else |
363 |
rm -rf ${WORLDTMP}/legacy/usr/include |
364 |
# XXX - These three can depend on any header file. |
365 |
rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c |
366 |
rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/kdump_subr.c |
367 |
rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c |
368 |
.endif |
369 |
.for _dir in \ |
370 |
lib usr legacy/usr legacy/usr/bin legacy/usr/sbin |
371 |
mkdir -p ${WORLDTMP}/${_dir} |
372 |
.endfor |
373 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ |
374 |
-p ${WORLDTMP}/legacy/usr >/dev/null |
375 |
.if ${MK_GROFF} != "no" |
376 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.groff.dist \ |
377 |
-p ${WORLDTMP}/legacy/usr >/dev/null |
378 |
.endif |
379 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ |
380 |
-p ${WORLDTMP}/usr >/dev/null |
381 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ |
382 |
-p ${WORLDTMP}/usr/include >/dev/null |
383 |
ln -sf ${.CURDIR}/sys ${WORLDTMP} |
384 |
.if ${MK_BIND_LIBS} != "no" |
385 |
mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \ |
386 |
-p ${WORLDTMP}/usr/include >/dev/null |
387 |
.endif |
388 |
_legacy: |
389 |
@echo |
390 |
@echo "--------------------------------------------------------------" |
391 |
@echo ">>> stage 1.1: legacy release compatibility shims" |
392 |
@echo "--------------------------------------------------------------" |
393 |
${_+_}cd ${.CURDIR}; ${BMAKE} legacy |
394 |
_bootstrap-tools: |
395 |
@echo |
396 |
@echo "--------------------------------------------------------------" |
397 |
@echo ">>> stage 1.2: bootstrap tools" |
398 |
@echo "--------------------------------------------------------------" |
399 |
${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools |
400 |
_cleanobj: |
401 |
.if !defined(NO_CLEAN) |
402 |
@echo |
403 |
@echo "--------------------------------------------------------------" |
404 |
@echo ">>> stage 2.1: cleaning up the object tree" |
405 |
@echo "--------------------------------------------------------------" |
406 |
${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} |
407 |
.if defined(LIB32TMP) |
408 |
${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} |
409 |
.endif |
410 |
.endif |
411 |
_obj: |
412 |
@echo |
413 |
@echo "--------------------------------------------------------------" |
414 |
@echo ">>> stage 2.2: rebuilding the object tree" |
415 |
@echo "--------------------------------------------------------------" |
416 |
${_+_}cd ${.CURDIR}; ${WMAKE} par-obj |
417 |
_build-tools: |
418 |
@echo |
419 |
@echo "--------------------------------------------------------------" |
420 |
@echo ">>> stage 2.3: build tools" |
421 |
@echo "--------------------------------------------------------------" |
422 |
${_+_}cd ${.CURDIR}; ${TMAKE} build-tools |
423 |
_cross-tools: |
424 |
@echo |
425 |
@echo "--------------------------------------------------------------" |
426 |
@echo ">>> stage 3: cross tools" |
427 |
@echo "--------------------------------------------------------------" |
428 |
${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools |
429 |
_includes: |
430 |
@echo |
431 |
@echo "--------------------------------------------------------------" |
432 |
@echo ">>> stage 4.1: building includes" |
433 |
@echo "--------------------------------------------------------------" |
434 |
${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes |
435 |
_libraries: |
436 |
@echo |
437 |
@echo "--------------------------------------------------------------" |
438 |
@echo ">>> stage 4.2: building libraries" |
439 |
@echo "--------------------------------------------------------------" |
440 |
${_+_}cd ${.CURDIR}; \ |
441 |
${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ |
442 |
-DWITHOUT_MAN -DWITHOUT_PROFILE libraries |
443 |
_depend: |
444 |
@echo |
445 |
@echo "--------------------------------------------------------------" |
446 |
@echo ">>> stage 4.3: make dependencies" |
447 |
@echo "--------------------------------------------------------------" |
448 |
${_+_}cd ${.CURDIR}; ${WMAKE} par-depend |
449 |
everything: |
450 |
@echo |
451 |
@echo "--------------------------------------------------------------" |
452 |
@echo ">>> stage 4.4: building everything" |
453 |
@echo "--------------------------------------------------------------" |
454 |
${_+_}cd ${.CURDIR}; ${WMAKE} par-all |
455 |
.if defined(LIB32TMP) |
456 |
build32: |
457 |
@echo |
458 |
@echo "--------------------------------------------------------------" |
459 |
@echo ">>> stage 5.1: building 32 bit shim libraries" |
460 |
@echo "--------------------------------------------------------------" |
461 |
mkdir -p ${LIB32TMP}/usr/include |
462 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ |
463 |
-p ${LIB32TMP}/usr >/dev/null |
464 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ |
465 |
-p ${LIB32TMP}/usr/include >/dev/null |
466 |
mkdir -p ${WORLDTMP} |
467 |
ln -sf ${.CURDIR}/sys ${WORLDTMP} |
468 |
.for _t in obj includes |
469 |
cd ${.CURDIR}/include; ${LIB32WMAKE} DIRPRFX=include/ ${_t} |
470 |
cd ${.CURDIR}/lib; ${LIB32WMAKE} DIRPRFX=lib/ ${_t} |
471 |
.if ${MK_APACHE} != "no" |
472 |
cd ${.CURDIR}/apache/lib; ${LIB32WMAKE} ${_t} |
473 |
.endif |
474 |
.if ${MK_CDDL} != "no" |
475 |
cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} DIRPRFX=cddl/lib/ ${_t} |
476 |
.endif |
477 |
cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} DIRPRFX=gnu/lib/ ${_t} |
478 |
.if ${MK_CRYPT} != "no" |
479 |
cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} DIRPRFX=secure/lib/ ${_t} |
480 |
.endif |
481 |
.if ${MK_KERBEROS} != "no" |
482 |
cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} DIRPRFX=kerberos5/lib ${_t} |
483 |
.endif |
484 |
.endfor |
485 |
.for _dir in usr.bin/lex/lib |
486 |
cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} DIRPRFX=${_dir}/ obj |
487 |
.endfor |
488 |
.for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic |
489 |
cd ${.CURDIR}/${_dir}; \ |
490 |
WORLDTMP=${WORLDTMP} \ |
491 |
MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ |
492 |
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \ |
493 |
-DEARLY_BUILD build-tools |
494 |
.endfor |
495 |
cd ${.CURDIR}; \ |
496 |
${LIB32WMAKE} -f Makefile.inc1 libraries |
497 |
.for _t in obj depend all |
498 |
cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32WMAKE} \ |
499 |
DIRPRFX=libexec/rtld-elf/ ${_t} |
500 |
cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32WMAKE} \ |
501 |
DIRPRFX=usr.bin/ldd ${_t} |
502 |
.endfor |
503 |
|
504 |
distribute32 install32: |
505 |
cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} |
506 |
.if ${MK_CDDL} != "no" |
507 |
cd ${.CURDIR}/cddl/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} |
508 |
.endif |
509 |
cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} |
510 |
.if ${MK_CRYPT} != "no" |
511 |
cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} |
512 |
.endif |
513 |
.if ${MK_KERBEROS} != "no" |
514 |
cd ${.CURDIR}/kerberos5/lib; ${LIB32IMAKE} ${.TARGET:S/32$//} |
515 |
.endif |
516 |
cd ${.CURDIR}/libexec/rtld-elf; \ |
517 |
PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//} |
518 |
cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIB32IMAKE} ${.TARGET:S/32$//} |
519 |
.endif |
520 |
|
521 |
WMAKE_TGTS= |
522 |
.if !defined(SUBDIR_OVERRIDE) |
523 |
WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools |
524 |
.endif |
525 |
WMAKE_TGTS+= _cleanobj _obj _build-tools |
526 |
.if !defined(SUBDIR_OVERRIDE) |
527 |
WMAKE_TGTS+= _cross-tools |
528 |
.endif |
529 |
WMAKE_TGTS+= _includes _libraries _depend everything |
530 |
.if defined(LIB32TMP) && ${MK_LIB32} != "no" |
531 |
WMAKE_TGTS+= build32 |
532 |
.endif |
533 |
|
534 |
buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue |
535 |
.ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue |
536 |
|
537 |
buildworld_prologue: |
538 |
@echo "--------------------------------------------------------------" |
539 |
@echo ">>> World build started on `LC_ALL=C date`" |
540 |
@echo "--------------------------------------------------------------" |
541 |
|
542 |
buildworld_epilogue: |
543 |
@echo |
544 |
@echo "--------------------------------------------------------------" |
545 |
@echo ">>> World build completed on `LC_ALL=C date`" |
546 |
@echo "--------------------------------------------------------------" |
547 |
|
548 |
# |
549 |
# We need to have this as a target because the indirection between Makefile |
550 |
# and Makefile.inc1 causes the correct PATH to be used, rather than a |
551 |
# modification of the current environment's PATH. In addition, we need |
552 |
# to quote multiword values. |
553 |
# |
554 |
buildenvvars: |
555 |
@echo ${WMAKEENV:Q} |
556 |
|
557 |
buildenv: |
558 |
@echo Entering world for ${TARGET_ARCH}:${TARGET} |
559 |
@cd ${.CURDIR} && env ${WMAKEENV} sh || true |
560 |
|
561 |
TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32} |
562 |
toolchain: ${TOOLCHAIN_TGTS} |
563 |
kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries} |
564 |
|
565 |
# |
566 |
# installcheck |
567 |
# |
568 |
# Checks to be sure system is ready for installworld/installkernel. |
569 |
# |
570 |
installcheck: |
571 |
|
572 |
# |
573 |
# Require DESTDIR to be set if installing for a different architecture. |
574 |
# |
575 |
.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} |
576 |
.if !make(distributeworld) |
577 |
installcheck: installcheck_DESTDIR |
578 |
installcheck_DESTDIR: |
579 |
.if !defined(DESTDIR) || empty(DESTDIR) |
580 |
@echo "ERROR: Please set DESTDIR!"; \ |
581 |
false |
582 |
.endif |
583 |
.endif |
584 |
.endif |
585 |
|
586 |
# |
587 |
# Check for missing UIDs/GIDs. |
588 |
# |
589 |
CHECK_UIDS= |
590 |
CHECK_GIDS= audit |
591 |
.if ${MK_SENDMAIL} != "no" |
592 |
CHECK_UIDS+= smmsp |
593 |
CHECK_GIDS+= smmsp |
594 |
.endif |
595 |
.if ${MK_PF} != "no" |
596 |
CHECK_UIDS+= proxy |
597 |
CHECK_GIDS+= proxy authpf |
598 |
.endif |
599 |
installcheck: installcheck_UGID |
600 |
installcheck_UGID: |
601 |
.for uid in ${CHECK_UIDS} |
602 |
@if ! `id -u ${uid} >/dev/null 2>&1`; then \ |
603 |
echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \ |
604 |
false; \ |
605 |
fi |
606 |
.endfor |
607 |
.for gid in ${CHECK_GIDS} |
608 |
@if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \ |
609 |
echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \ |
610 |
false; \ |
611 |
fi |
612 |
.endfor |
613 |
|
614 |
# |
615 |
# Required install tools to be saved in a scratch dir for safety. |
616 |
# |
617 |
.if ${MK_INFO} != "no" |
618 |
_install-info= install-info |
619 |
.endif |
620 |
.if ${MK_ZONEINFO} != "no" |
621 |
_zoneinfo= zic tzsetup |
622 |
.endif |
623 |
|
624 |
ITOOLS= [ awk cap_mkdb cat chflags chmod chown \ |
625 |
date echo egrep find grep ${_install-info} \ |
626 |
ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \ |
627 |
test true uname wc ${_zoneinfo} |
628 |
|
629 |
# |
630 |
# distributeworld |
631 |
# |
632 |
# Distributes everything compiled by a `buildworld'. |
633 |
# |
634 |
# installworld |
635 |
# |
636 |
# Installs everything compiled by a 'buildworld'. |
637 |
# |
638 |
|
639 |
# Non-base distributions produced by the base system |
640 |
EXTRA_DISTRIBUTIONS= doc games |
641 |
.if defined(LIB32TMP) && ${MK_LIB32} != "no" |
642 |
EXTRA_DISTRIBUTIONS+= lib32 |
643 |
.endif |
644 |
|
645 |
distributeworld installworld: installcheck |
646 |
mkdir -p ${INSTALLTMP} |
647 |
progs=$$(for prog in ${ITOOLS}; do \ |
648 |
if progpath=`which $$prog`; then \ |
649 |
echo $$progpath; \ |
650 |
else \ |
651 |
echo "Required tool $$prog not found in PATH." >&2; \ |
652 |
exit 1; \ |
653 |
fi; \ |
654 |
done); \ |
655 |
libs=$$(ldd -f "%o %p\n" -f "%o %p\n" $$progs 2>/dev/null | sort -u | \ |
656 |
while read line; do \ |
657 |
set -- $$line; \ |
658 |
if [ "$$2 $$3" != "not found" ]; then \ |
659 |
echo $$2; \ |
660 |
else \ |
661 |
echo "Required library $$1 not found." >&2; \ |
662 |
exit 1; \ |
663 |
fi; \ |
664 |
done); \ |
665 |
cp $$libs $$progs ${INSTALLTMP} |
666 |
cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale |
667 |
.if make(distributeworld) |
668 |
.for dist in ${EXTRA_DISTRIBUTIONS} |
669 |
-mkdir ${DESTDIR}/${DISTDIR}/${dist} |
670 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ |
671 |
-p ${DESTDIR}/${DISTDIR}/${dist} >/dev/null |
672 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ |
673 |
-p ${DESTDIR}/${DISTDIR}/${dist}/usr >/dev/null |
674 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ |
675 |
-p ${DESTDIR}/${DISTDIR}/${dist}/usr/include >/dev/null |
676 |
.endfor |
677 |
-mkdir ${DESTDIR}/${DISTDIR}/base |
678 |
${_+_}cd ${.CURDIR}; ${IMAKE} distrib-dirs \ |
679 |
DESTDIR=${DESTDIR}/${DISTDIR}/base |
680 |
.endif |
681 |
${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ |
682 |
${IMAKEENV} rm -rf ${INSTALLTMP} |
683 |
.if make(distributeworld) |
684 |
.for dist in ${EXTRA_DISTRIBUTIONS} |
685 |
find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete |
686 |
.endfor |
687 |
.endif |
688 |
|
689 |
packageworld: |
690 |
.for dist in base ${EXTRA_DISTRIBUTIONS} |
691 |
${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ |
692 |
tar cvJf ${DESTDIR}/${DISTDIR}/${dist}.txz . |
693 |
.endfor |
694 |
|
695 |
# |
696 |
# reinstall |
697 |
# |
698 |
# If you have a build server, you can NFS mount the source and obj directories |
699 |
# and do a 'make reinstall' on the *client* to install new binaries from the |
700 |
# most recent server build. |
701 |
# |
702 |
reinstall: |
703 |
@echo "--------------------------------------------------------------" |
704 |
@echo ">>> Making hierarchy" |
705 |
@echo "--------------------------------------------------------------" |
706 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy |
707 |
@echo |
708 |
@echo "--------------------------------------------------------------" |
709 |
@echo ">>> Installing everything" |
710 |
@echo "--------------------------------------------------------------" |
711 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install |
712 |
.if defined(LIB32TMP) && ${MK_LIB32} != "no" |
713 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32 |
714 |
.endif |
715 |
|
716 |
redistribute: |
717 |
@echo "--------------------------------------------------------------" |
718 |
@echo ">>> Distributing everything" |
719 |
@echo "--------------------------------------------------------------" |
720 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute |
721 |
.if defined(LIB32TMP) && ${MK_LIB32} != "no" |
722 |
${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 \ |
723 |
DISTRIBUTION=lib32 |
724 |
.endif |
725 |
|
726 |
distrib-dirs distribution: |
727 |
cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET} |
728 |
|
729 |
# |
730 |
# buildkernel and installkernel |
731 |
# |
732 |
# Which kernels to build and/or install is specified by setting |
733 |
# KERNCONF. If not defined a GENERIC kernel is built/installed. |
734 |
# Only the existing (depending TARGET) config files are used |
735 |
# for building kernels and only the first of these is designated |
736 |
# as the one being installed. |
737 |
# |
738 |
# Note that we have to use TARGET instead of TARGET_ARCH when |
739 |
# we're in kernel-land. Since only TARGET_ARCH is (expected) to |
740 |
# be set to cross-build, we have to make sure TARGET is set |
741 |
# properly. |
742 |
|
743 |
.if defined(KERNFAST) |
744 |
NO_KERNELCLEAN= t |
745 |
NO_KERNELCONFIG= t |
746 |
NO_KERNELDEPEND= t |
747 |
NO_KERNELOBJ= t |
748 |
# Shortcut for KERNCONF=Blah -DKERNFAST is now KERNFAST=Blah |
749 |
.if !defined(KERNCONF) && ${KERNFAST} != "1" |
750 |
KERNCONF=${KERNFAST} |
751 |
.endif |
752 |
.endif |
753 |
.if !defined(KERNCONF) && defined(KERNEL) |
754 |
KERNCONF= ${KERNEL} |
755 |
KERNWARN= |
756 |
.else |
757 |
KERNCONF?= GENERIC |
758 |
.endif |
759 |
INSTKERNNAME?= kernel |
760 |
|
761 |
KERNSRCDIR?= ${.CURDIR}/sys |
762 |
KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf |
763 |
KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR} |
764 |
KERNCONFDIR?= ${KRNLCONFDIR} |
765 |
|
766 |
BUILDKERNELS= |
767 |
INSTALLKERNEL= |
768 |
.for _kernel in ${KERNCONF} |
769 |
.if exists(${KERNCONFDIR}/${_kernel}) |
770 |
BUILDKERNELS+= ${_kernel} |
771 |
.if empty(INSTALLKERNEL) |
772 |
INSTALLKERNEL= ${_kernel} |
773 |
.endif |
774 |
.endif |
775 |
.endfor |
776 |
|
777 |
# |
778 |
# buildkernel |
779 |
# |
780 |
# Builds all kernels defined by BUILDKERNELS. |
781 |
# |
782 |
buildkernel: |
783 |
.if empty(BUILDKERNELS) |
784 |
@echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \ |
785 |
false |
786 |
.endif |
787 |
.if defined(KERNWARN) |
788 |
@echo "--------------------------------------------------------------" |
789 |
@echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" |
790 |
@echo "--------------------------------------------------------------" |
791 |
@sleep 3 |
792 |
.endif |
793 |
@echo |
794 |
.for _kernel in ${BUILDKERNELS} |
795 |
@echo "--------------------------------------------------------------" |
796 |
@echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" |
797 |
@echo "--------------------------------------------------------------" |
798 |
@echo "===> ${_kernel}" |
799 |
mkdir -p ${KRNLOBJDIR} |
800 |
.if !defined(NO_KERNELCONFIG) |
801 |
@echo |
802 |
@echo "--------------------------------------------------------------" |
803 |
@echo ">>> stage 1: configuring the kernel" |
804 |
@echo "--------------------------------------------------------------" |
805 |
cd ${KRNLCONFDIR}; \ |
806 |
PATH=${TMPPATH} \ |
807 |
config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ |
808 |
${KERNCONFDIR}/${_kernel} |
809 |
.endif |
810 |
.if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN) |
811 |
@echo |
812 |
@echo "--------------------------------------------------------------" |
813 |
@echo ">>> stage 2.1: cleaning up the object tree" |
814 |
@echo "--------------------------------------------------------------" |
815 |
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR} |
816 |
.endif |
817 |
.if !defined(NO_KERNELOBJ) |
818 |
@echo |
819 |
@echo "--------------------------------------------------------------" |
820 |
@echo ">>> stage 2.2: rebuilding the object tree" |
821 |
@echo "--------------------------------------------------------------" |
822 |
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj |
823 |
.endif |
824 |
@echo |
825 |
@echo "--------------------------------------------------------------" |
826 |
@echo ">>> stage 2.3: build tools" |
827 |
@echo "--------------------------------------------------------------" |
828 |
cd ${KRNLOBJDIR}/${_kernel}; \ |
829 |
PATH=${BPATH}:${PATH} \ |
830 |
MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ |
831 |
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \ |
832 |
-f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile |
833 |
# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. |
834 |
.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) |
835 |
.for target in obj depend all |
836 |
cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ |
837 |
PATH=${BPATH}:${PATH} \ |
838 |
MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ |
839 |
${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target} |
840 |
.endfor |
841 |
.endif |
842 |
.if !defined(NO_KERNELDEPEND) |
843 |
@echo |
844 |
@echo "--------------------------------------------------------------" |
845 |
@echo ">>> stage 3.1: making dependencies" |
846 |
@echo "--------------------------------------------------------------" |
847 |
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ |
848 |
.endif |
849 |
@echo |
850 |
@echo "--------------------------------------------------------------" |
851 |
@echo ">>> stage 3.2: building everything" |
852 |
@echo "--------------------------------------------------------------" |
853 |
cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ |
854 |
@echo "--------------------------------------------------------------" |
855 |
@echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" |
856 |
@echo "--------------------------------------------------------------" |
857 |
.endfor |
858 |
|
859 |
# |
860 |
# installkernel, etc. |
861 |
# |
862 |
# Install the kernel defined by INSTALLKERNEL |
863 |
# |
864 |
installkernel installkernel.debug \ |
865 |
reinstallkernel reinstallkernel.debug: installcheck |
866 |
.if empty(INSTALLKERNEL) |
867 |
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ |
868 |
false |
869 |
.endif |
870 |
@echo "--------------------------------------------------------------" |
871 |
@echo ">>> Installing kernel ${INSTALLKERNEL}" |
872 |
@echo "--------------------------------------------------------------" |
873 |
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ |
874 |
${CROSSENV} PATH=${TMPPATH} \ |
875 |
${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//} |
876 |
|
877 |
distributekernel distributekernel.debug: |
878 |
.if empty(INSTALLKERNEL) |
879 |
@echo "ERROR: No kernel \"${KERNCONF}\" to install."; \ |
880 |
false |
881 |
.endif |
882 |
cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ |
883 |
${CROSSENV} PATH=${TMPPATH} ${MAKE} KERNEL=${INSTKERNNAME} \ |
884 |
DESTDIR=${DESTDIR}/${DISTDIR}/kernel \ |
885 |
${.TARGET:S/distributekernel/install/} |
886 |
.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} |
887 |
cd ${KRNLOBJDIR}/${_kernel}; \ |
888 |
${CROSSENV} PATH=${TMPPATH} ${MAKE} \ |
889 |
KERNEL=${INSTKERNNAME}.${_kernel} \ |
890 |
DESTDIR=${DESTDIR}/${DISTDIR}/kernel.${_kernel} \ |
891 |
${.TARGET:S/distributekernel/install/} |
892 |
.endfor |
893 |
|
894 |
packagekernel: |
895 |
cd ${DESTDIR}/${DISTDIR}/kernel; \ |
896 |
tar cvJf ${DESTDIR}/${DISTDIR}/kernel.txz . |
897 |
.for _kernel in ${BUILDKERNELS:S/${INSTALLKERNEL}//} |
898 |
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ |
899 |
tar cvJf ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.txz . |
900 |
.endfor |
901 |
|
902 |
# |
903 |
# doxygen |
904 |
# |
905 |
# Build the API documentation with doxygen |
906 |
# |
907 |
doxygen: |
908 |
@if [ ! -x `/usr/bin/which doxygen` ]; then \ |
909 |
echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \ |
910 |
exit 1; \ |
911 |
fi |
912 |
cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all |
913 |
|
914 |
# |
915 |
# update |
916 |
# |
917 |
# Update the source tree(s), by running cvsup/cvs/svn to update to the |
918 |
# latest copy. |
919 |
# |
920 |
update: |
921 |
.if defined(SUP_UPDATE) |
922 |
@echo "--------------------------------------------------------------" |
923 |
@echo ">>> Running ${SUP}" |
924 |
@echo "--------------------------------------------------------------" |
925 |
.if defined(SUPFILE) |
926 |
@${SUP} ${SUPFLAGS} ${SUPFILE} |
927 |
.endif |
928 |
.if defined(SUPFILE1) |
929 |
@${SUP} ${SUPFLAGS} ${SUPFILE1} |
930 |
.endif |
931 |
.if defined(SUPFILE2) |
932 |
@${SUP} ${SUPFLAGS} ${SUPFILE2} |
933 |
.endif |
934 |
.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE) |
935 |
@${SUP} ${SUPFLAGS} ${PORTSSUPFILE} |
936 |
.endif |
937 |
.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE) |
938 |
@${SUP} ${SUPFLAGS} ${DOCSUPFILE} |
939 |
.endif |
940 |
.endif |
941 |
.if defined(CVS_UPDATE) |
942 |
@cd ${.CURDIR} ; \ |
943 |
if [ -d CVS ] ; then \ |
944 |
echo "--------------------------------------------------------------" ; \ |
945 |
echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT} ; \ |
946 |
echo "--------------------------------------------------------------" ; \ |
947 |
echo ${CVS} -R -q update ${CVSFLAGS} ; \ |
948 |
${CVS} -R -q update ${CVSFLAGS} ; \ |
949 |
fi |
950 |
.endif |
951 |
.if defined(SVN_UPDATE) |
952 |
@cd ${.CURDIR} ; \ |
953 |
if [ -d .svn ] ; then \ |
954 |
echo "--------------------------------------------------------------" ; \ |
955 |
echo ">>> Updating ${.CURDIR} using Subversion" ; \ |
956 |
echo "--------------------------------------------------------------" ; \ |
957 |
echo ${SVN} update ${SVNFLAGS} ; \ |
958 |
${SVN} update ${SVNFLAGS} ; \ |
959 |
fi |
960 |
.endif |
961 |
|
962 |
# |
963 |
# ------------------------------------------------------------------------ |
964 |
# |
965 |
# From here onwards are utility targets used by the 'make world' and |
966 |
# related targets. If your 'world' breaks, you may like to try to fix |
967 |
# the problem and manually run the following targets to attempt to |
968 |
# complete the build. Beware, this is *not* guaranteed to work, you |
969 |
# need to have a pretty good grip on the current state of the system |
970 |
# to attempt to manually finish it. If in doubt, 'make world' again. |
971 |
# |
972 |
|
973 |
# |
974 |
# legacy: Build compatibility shims for the next three targets |
975 |
# |
976 |
legacy: |
977 |
.if ${BOOTSTRAPPING} < 4000 && ${BOOTSTRAPPING} != 0 |
978 |
@echo "ERROR: Source upgrades from versions prior to 0.4 not supported."; \ |
979 |
false |
980 |
.endif |
981 |
mkdir -p ${MAKEOBJDIRPREFIX}/legacy/usr/bin |
982 |
.for _tool in tools/build |
983 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ |
984 |
cd ${.CURDIR}/${_tool} && \ |
985 |
${MAKE} DIRPRFX=${_tool}/ obj && \ |
986 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes && \ |
987 |
${MAKE} DIRPRFX=${_tool}/ depend && \ |
988 |
${MAKE} DIRPRFX=${_tool}/ all && \ |
989 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install |
990 |
.endfor |
991 |
|
992 |
# |
993 |
# bootstrap-tools: Build tools needed for compatibility |
994 |
# |
995 |
.if ${MK_GAMES} != "no" |
996 |
_strfile= games/fortune/strfile |
997 |
.endif |
998 |
|
999 |
.if ${MK_CXX} != "no" |
1000 |
_gperf= gnu/usr.bin/gperf |
1001 |
.endif |
1002 |
|
1003 |
.if ${MK_GROFF} != "no" |
1004 |
_groff= gnu/usr.bin/groff |
1005 |
.endif |
1006 |
|
1007 |
.if ${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4015 |
1008 |
_ar= usr.bin/ar |
1009 |
.endif |
1010 |
|
1011 |
.if ${BOOTSTRAPPING} < 4015 |
1012 |
_mklocale= usr.bin/mklocale |
1013 |
.endif |
1014 |
|
1015 |
.if ${BOOTSTRAPPING} < 4015 |
1016 |
_sed= usr.bin/sed |
1017 |
.endif |
1018 |
|
1019 |
.if ${BOOTSTRAPPING} < 7003 |
1020 |
_m4= usr.bin/m4 |
1021 |
.endif |
1022 |
|
1023 |
.if ${BOOTSTRAPPING} < 7003 |
1024 |
_lex= usr.bin/lex |
1025 |
.endif |
1026 |
|
1027 |
.if ${BOOTSTRAPPING} < 7003 |
1028 |
_yacc= lib/liby \ |
1029 |
usr.bin/yacc |
1030 |
.endif |
1031 |
|
1032 |
.if ${MK_BSNMP} != "no" && \ |
1033 |
(${BOOTSTRAPPING} < 4015 || !exists(/usr/sbin/gensnmptree)) |
1034 |
_gensnmptree= usr.sbin/bsnmpd/gensnmptree |
1035 |
.endif |
1036 |
|
1037 |
.if ${MK_RESCUE} != "no" && \ |
1038 |
${BOOTSTRAPPING} < 4015 |
1039 |
_crunchgen= usr.sbin/crunch/crunchgen |
1040 |
.endif |
1041 |
|
1042 |
.if ${MK_CLANG} != "no" |
1043 |
_clang_tblgen= \ |
1044 |
lib/clang/libllvmsupport \ |
1045 |
lib/clang/libllvmtablegen \ |
1046 |
usr.bin/clang/tblgen \ |
1047 |
usr.bin/clang/clang-tblgen |
1048 |
.endif |
1049 |
|
1050 |
.if ${MK_CDDL} != "no" && \ |
1051 |
${BOOTSTRAPPING} < 4015 && \ |
1052 |
!(${BOOTSTRAPPING} >= 4000 && ${BOOTSTRAPPING} < 4015) |
1053 |
_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ |
1054 |
lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge |
1055 |
.endif |
1056 |
|
1057 |
.if ${MK_FDT} != "no" |
1058 |
_dtc= gnu/usr.bin/dtc |
1059 |
.endif |
1060 |
|
1061 |
# Please document (add comment) why something is in 'bootstrap-tools'. |
1062 |
# Try to bound the building of the bootstrap-tool to just the |
1063 |
# MidnightBSD versions that need the tool built at this stage of the build. |
1064 |
bootstrap-tools: |
1065 |
.for _tool in \ |
1066 |
${_clang_tblgen} \ |
1067 |
${_kerberos5_bootstrap_tools} \ |
1068 |
${_dtrace_tools} \ |
1069 |
${_strfile} \ |
1070 |
${_gperf} \ |
1071 |
${_groff} \ |
1072 |
${_ar} \ |
1073 |
${_dtc} \ |
1074 |
${_awk} \ |
1075 |
usr.bin/lorder \ |
1076 |
usr.bin/makewhatis \ |
1077 |
${_mklocale} \ |
1078 |
usr.bin/rpcgen \ |
1079 |
${_sed} \ |
1080 |
${_yacc} \ |
1081 |
${_m4} \ |
1082 |
${_lex} \ |
1083 |
lib/libmd \ |
1084 |
usr.bin/xinstall \ |
1085 |
${_gensnmptree} \ |
1086 |
usr.sbin/config \ |
1087 |
${_crunchgen} |
1088 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ |
1089 |
cd ${.CURDIR}/${_tool}; \ |
1090 |
${MAKE} DIRPRFX=${_tool}/ obj; \ |
1091 |
${MAKE} DIRPRFX=${_tool}/ depend; \ |
1092 |
${MAKE} DIRPRFX=${_tool}/ all; \ |
1093 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install |
1094 |
.endfor |
1095 |
|
1096 |
# |
1097 |
# build-tools: Build special purpose build tools |
1098 |
# |
1099 |
.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules) |
1100 |
_aicasm= sys/modules/aic7xxx/aicasm |
1101 |
.endif |
1102 |
|
1103 |
.if !defined(NO_SHARE) |
1104 |
_share= share/syscons/scrnmaps |
1105 |
.endif |
1106 |
|
1107 |
.if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no" |
1108 |
_gcc_tools= gnu/usr.bin/cc/cc_tools |
1109 |
.endif |
1110 |
|
1111 |
.if ${MK_KERBEROS} != "no" |
1112 |
_kerberos5_bootstrap_tools= \ |
1113 |
kerberos5/tools/make-roken \ |
1114 |
kerberos5/lib/libroken \ |
1115 |
kerberos5/lib/libvers \ |
1116 |
kerberos5/tools/asn1_compile \ |
1117 |
kerberos5/tools/slc \ |
1118 |
usr.bin/compile_et |
1119 |
|
1120 |
.ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g} |
1121 |
.endif |
1122 |
|
1123 |
.if ${MK_RESCUE} != "no" |
1124 |
_rescue= rescue/rescue |
1125 |
.endif |
1126 |
|
1127 |
build-tools: |
1128 |
.for _tool in \ |
1129 |
bin/csh \ |
1130 |
bin/sh \ |
1131 |
${_rescue} \ |
1132 |
lib/ncurses/ncurses \ |
1133 |
lib/ncurses/ncursesw \ |
1134 |
${_share} \ |
1135 |
${_aicasm} \ |
1136 |
usr.bin/awk \ |
1137 |
lib/libmagic \ |
1138 |
usr.sbin/sysinstall \ |
1139 |
usr.bin/mkesdb_static \ |
1140 |
usr.bin/mkcsmapper_static |
1141 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \ |
1142 |
cd ${.CURDIR}/${_tool}; \ |
1143 |
${MAKE} DIRPRFX=${_tool}/ obj; \ |
1144 |
${MAKE} DIRPRFX=${_tool}/ build-tools |
1145 |
.endfor |
1146 |
.for _tool in \ |
1147 |
${_gcc_tools} \ |
1148 |
${_kerberos5_bootstrap_tools} |
1149 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ |
1150 |
cd ${.CURDIR}/${_tool} && \ |
1151 |
${MAKE} DIRPRFX=${_tool}/ obj && \ |
1152 |
${MAKE} DIRPRFX=${_tool}/ depend && \ |
1153 |
${MAKE} DIRPRFX=${_tool}/ all && \ |
1154 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${WORLDTMP}/legacy install |
1155 |
.endfor |
1156 |
|
1157 |
# |
1158 |
# cross-tools: Build cross-building tools |
1159 |
# |
1160 |
.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 4016 |
1161 |
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" |
1162 |
_btxld= usr.sbin/btxld |
1163 |
.endif |
1164 |
.endif |
1165 |
.if ${TARGET_ARCH} != ${MACHINE_ARCH} |
1166 |
.if ${MK_RESCUE} != "no" || defined(RELEASEDIR) |
1167 |
_crunchide= usr.sbin/crunch/crunchide |
1168 |
.endif |
1169 |
.if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR) |
1170 |
_kgzip= usr.sbin/kgzip |
1171 |
.endif |
1172 |
.endif |
1173 |
|
1174 |
.if ${MK_BINUTILS} != "no" |
1175 |
_binutils= gnu/usr.bin/binutils |
1176 |
.endif |
1177 |
|
1178 |
.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") |
1179 |
_clang= usr.bin/clang |
1180 |
_clang_libs= lib/clang |
1181 |
.endif |
1182 |
|
1183 |
.if ${MK_GCC} != "no" && ${MK_CLANG_IS_CC} == "no" |
1184 |
_cc= gnu/usr.bin/cc |
1185 |
.endif |
1186 |
|
1187 |
cross-tools: |
1188 |
.for _tool in \ |
1189 |
${_clang_libs} \ |
1190 |
${_clang} \ |
1191 |
${_binutils} \ |
1192 |
${_cc} \ |
1193 |
usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \ |
1194 |
${_btxld} \ |
1195 |
${_crunchide} \ |
1196 |
${_kgzip} |
1197 |
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \ |
1198 |
cd ${.CURDIR}/${_tool}; \ |
1199 |
${MAKE} DIRPRFX=${_tool}/ obj; \ |
1200 |
${MAKE} DIRPRFX=${_tool}/ depend; \ |
1201 |
${MAKE} DIRPRFX=${_tool}/ all; \ |
1202 |
${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install |
1203 |
.endfor |
1204 |
|
1205 |
# |
1206 |
# hierarchy - ensure that all the needed directories are present |
1207 |
# |
1208 |
hierarchy: |
1209 |
cd ${.CURDIR}/etc; ${MAKE} distrib-dirs |
1210 |
|
1211 |
# |
1212 |
# libraries - build all libraries, and install them under ${DESTDIR}. |
1213 |
# |
1214 |
# The list of libraries with dependents (${_prebuild_libs}) and their |
1215 |
# interdependencies (__L) are built automatically by the |
1216 |
# ${.CURDIR}/tools/make_libdeps.sh script. |
1217 |
# |
1218 |
libraries: |
1219 |
cd ${.CURDIR}; \ |
1220 |
${MAKE} -f Makefile.inc1 _prereq_libs; \ |
1221 |
${MAKE} -f Makefile.inc1 _startup_libs; \ |
1222 |
${MAKE} -f Makefile.inc1 _prebuild_libs; \ |
1223 |
${MAKE} -f Makefile.inc1 _generic_libs; |
1224 |
|
1225 |
# |
1226 |
# static libgcc.a prerequisite for shared libc |
1227 |
# |
1228 |
_prereq_libs= gnu/lib/libssp/libssp_nonshared gnu/lib/libgcc lib/libcompiler_rt |
1229 |
|
1230 |
# These dependencies are not automatically generated: |
1231 |
# |
1232 |
# gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before |
1233 |
# all shared libraries for ELF. |
1234 |
# |
1235 |
_startup_libs= gnu/lib/csu |
1236 |
.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf) |
1237 |
_startup_libs+= lib/csu/${MACHINE_ARCH}-elf |
1238 |
.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}) |
1239 |
_startup_libs+= lib/csu/${MACHINE_ARCH} |
1240 |
.else |
1241 |
_startup_libs+= lib/csu/${MACHINE_CPUARCH} |
1242 |
.endif |
1243 |
_startup_libs+= gnu/lib/libgcc |
1244 |
_startup_libs+= lib/libcompiler_rt |
1245 |
_startup_libs+= lib/libc |
1246 |
.if ${MK_LIBCPLUSPLUS} != "no" |
1247 |
_startup_libs+= lib/libcxxrt |
1248 |
.endif |
1249 |
|
1250 |
gnu/lib/libgcc__L: lib/libc__L |
1251 |
.if ${MK_LIBCPLUSPLUS} != "no" |
1252 |
lib/libcxxrt__L: gnu/lib/libgcc__L |
1253 |
.endif |
1254 |
|
1255 |
_prebuild_libs= ${_kerberos5_lib_libasn1} \ |
1256 |
${_kerberos5_lib_libhdb} \ |
1257 |
${_kerberos5_lib_libheimbase} \ |
1258 |
${_kerberos5_lib_libheimntlm} \ |
1259 |
${_kerberos5_lib_libheimsqlite} \ |
1260 |
${_kerberos5_lib_libheimipcc} \ |
1261 |
${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ |
1262 |
${_kerberos5_lib_libroken} \ |
1263 |
${_kerberos5_lib_libwind} \ |
1264 |
lib/libbz2 lib/libcom_err lib/libcrypt \ |
1265 |
lib/libelf lib/libexpat \ |
1266 |
${_lib_libgssapi} ${_lib_libipx} \ |
1267 |
lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ |
1268 |
lib/ncurses/ncurses lib/ncurses/ncursesw \ |
1269 |
lib/libopie lib/libpam ${_lib_libthr} \ |
1270 |
lib/libradius lib/libsbuf lib/libtacplus \ |
1271 |
${_cddl_lib_libumem} \ |
1272 |
lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ |
1273 |
${_secure_lib_libcrypto} ${_secure_lib_libssh} \ |
1274 |
${_secure_lib_libssl} lib/libsqlite3 \ |
1275 |
lib/libarchive lib/libfetch lib/libmagic |
1276 |
.if ${MK_LIBTHR} != "no" |
1277 |
_lib_libthr= lib/libthr |
1278 |
.endif |
1279 |
|
1280 |
.if ${MK_OFED} != "no" |
1281 |
_ofed_lib= contrib/ofed/usr.lib/ |
1282 |
.endif |
1283 |
|
1284 |
_generic_libs= ${_apache_lib} ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib ${_ofed_lib} |
1285 |
|
1286 |
lib/libopie__L lib/libtacplus__L: lib/libmd__L |
1287 |
|
1288 |
.if ${MK_APACHE} != "no" |
1289 |
_apache_lib= apache/lib |
1290 |
.endif |
1291 |
|
1292 |
.if ${MK_CDDL} != "no" |
1293 |
_cddl_lib_libumem= cddl/lib/libumem |
1294 |
_cddl_lib= cddl/lib |
1295 |
.endif |
1296 |
|
1297 |
.if ${MK_CRYPT} != "no" |
1298 |
.if ${MK_OPENSSL} != "no" |
1299 |
_secure_lib_libcrypto= secure/lib/libcrypto |
1300 |
_secure_lib_libssl= secure/lib/libssl |
1301 |
lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L |
1302 |
.if ${MK_OPENSSH} != "no" |
1303 |
_secure_lib_libssh= secure/lib/libssh |
1304 |
secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L |
1305 |
.if ${MK_KERBEROS_SUPPORT} != "no" |
1306 |
secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \ |
1307 |
kerberos5/lib/libhx509__L kerberos5/lib/libasn1__L lib/libcom_err__L \ |
1308 |
lib/libmd__L kerberos5/lib/libroken__L |
1309 |
.endif |
1310 |
.endif |
1311 |
.endif |
1312 |
_secure_lib= secure/lib |
1313 |
.endif |
1314 |
|
1315 |
.if ${MK_KERBEROS} != "no" |
1316 |
kerberos5/lib/libasn1__L: lib/libcom_err__L kerberos5/lib/libroken__L |
1317 |
kerberos5/lib/libhdb__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ |
1318 |
kerberos5/lib/libkrb5__L kerberos5/lib/libroken__L \ |
1319 |
kerberos5/lib/libwind__L kerberos5/lib/libheimsqlite__L |
1320 |
kerberos5/lib/libheimntlm__L: secure/lib/libcrypto__L kerberos5/lib/libkrb5__L \ |
1321 |
kerberos5/lib/libroken__L lib/libcom_err__L |
1322 |
kerberos5/lib/libhx509__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ |
1323 |
secure/lib/libcrypto__L kerberos5/lib/libroken__L kerberos5/lib/libwind__L |
1324 |
kerberos5/lib/libkrb5__L: kerberos5/lib/libasn1__L lib/libcom_err__L \ |
1325 |
lib/libcrypt__L secure/lib/libcrypto__L kerberos5/lib/libhx509__L \ |
1326 |
kerberos5/lib/libroken__L kerberos5/lib/libwind__L \ |
1327 |
kerberos5/lib/libheimbase__L kerberos5/lib/libheimipcc__L |
1328 |
kerberos5/lib/libroken__L: lib/libcrypt__L |
1329 |
kerberos5/lib/libwind__L: kerberos5/lib/libroken__L lib/libcom_err__L |
1330 |
kerberos5/lib/libheimbase__L: lib/libthr__L |
1331 |
kerberos5/lib/libheimipcc__L: kerberos5/lib/libroken__L kerberos5/lib/libheimbase__L lib/libthr__L |
1332 |
kerberos5/lib/libheimsqlite__L: lib/libthr__L |
1333 |
.endif |
1334 |
|
1335 |
.if ${MK_GSSAPI} != "no" |
1336 |
_lib_libgssapi= lib/libgssapi |
1337 |
.endif |
1338 |
|
1339 |
.if ${MK_IPX} != "no" |
1340 |
_lib_libipx= lib/libipx |
1341 |
.endif |
1342 |
|
1343 |
.if ${MK_KERBEROS} != "no" |
1344 |
_kerberos5_lib= kerberos5/lib |
1345 |
_kerberos5_lib_libasn1= kerberos5/lib/libasn1 |
1346 |
_kerberos5_lib_libhdb= kerberos5/lib/libhdb |
1347 |
_kerberos5_lib_libheimbase= kerberos5/lib/libheimbase |
1348 |
_kerberos5_lib_libkrb5= kerberos5/lib/libkrb5 |
1349 |
_kerberos5_lib_libhx509= kerberos5/lib/libhx509 |
1350 |
_kerberos5_lib_libroken= kerberos5/lib/libroken |
1351 |
_kerberos5_lib_libheimntlm= kerberos5/lib/libheimntlm |
1352 |
_kerberos5_lib_libheimsqlite= kerberos5/lib/libheimsqlite |
1353 |
_kerberos5_lib_libheimipcc= kerberos5/lib/libheimipcc |
1354 |
_kerberos5_lib_libwind= kerberos5/lib/libwind |
1355 |
_libcom_err= lib/libcom_err |
1356 |
.endif |
1357 |
|
1358 |
.if ${MK_NIS} != "no" |
1359 |
_lib_libypclnt= lib/libypclnt |
1360 |
.endif |
1361 |
|
1362 |
.if ${MK_OPENSSL} == "no" |
1363 |
lib/libradius__L: lib/libmd__L |
1364 |
.endif |
1365 |
|
1366 |
.for _lib in ${_prereq_libs} |
1367 |
${_lib}__PL: .PHONY .MAKE |
1368 |
.if exists(${.CURDIR}/${_lib}) |
1369 |
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ |
1370 |
cd ${.CURDIR}/${_lib} && \ |
1371 |
${MAKE} DIRPRFX=${_lib}/ obj && \ |
1372 |
${MAKE} DIRPRFX=${_lib}/ depend && \ |
1373 |
${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all && \ |
1374 |
${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install |
1375 |
.endif |
1376 |
.endfor |
1377 |
|
1378 |
.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs} |
1379 |
${_lib}__L: .PHONY |
1380 |
.if exists(${.CURDIR}/${_lib}) |
1381 |
${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \ |
1382 |
cd ${.CURDIR}/${_lib} && \ |
1383 |
${MAKE} DIRPRFX=${_lib}/ obj && \ |
1384 |
${MAKE} DIRPRFX=${_lib}/ depend && \ |
1385 |
${MAKE} DIRPRFX=${_lib}/ all && \ |
1386 |
${MAKE} DIRPRFX=${_lib}/ install |
1387 |
.endif |
1388 |
.endfor |
1389 |
|
1390 |
# libpam is special: we need to build static PAM modules before |
1391 |
# static PAM library, and dynamic PAM library before dynamic PAM |
1392 |
# modules. |
1393 |
lib/libpam__L: .PHONY |
1394 |
${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \ |
1395 |
cd ${.CURDIR}/lib/libpam; \ |
1396 |
${MAKE} DIRPRFX=lib/libpam/ obj; \ |
1397 |
${MAKE} DIRPRFX=lib/libpam/ depend; \ |
1398 |
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \ |
1399 |
${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install |
1400 |
|
1401 |
_prereq_libs: ${_prereq_libs:S/$/__PL/} |
1402 |
_startup_libs: ${_startup_libs:S/$/__L/} |
1403 |
_prebuild_libs: ${_prebuild_libs:S/$/__L/} |
1404 |
_generic_libs: ${_generic_libs:S/$/__L/} |
1405 |
|
1406 |
.for __target in all clean cleandepend cleandir depend includes obj |
1407 |
.for entry in ${SUBDIR} |
1408 |
${entry}.${__target}__D: .PHONY |
1409 |
${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ |
1410 |
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \ |
1411 |
edir=${entry}.${MACHINE_ARCH}; \ |
1412 |
cd ${.CURDIR}/$${edir}; \ |
1413 |
else \ |
1414 |
${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \ |
1415 |
edir=${entry}; \ |
1416 |
cd ${.CURDIR}/$${edir}; \ |
1417 |
fi; \ |
1418 |
${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ |
1419 |
.endfor |
1420 |
par-${__target}: ${SUBDIR:S/$/.${__target}__D/} |
1421 |
.endfor |
1422 |
|
1423 |
.include <bsd.subdir.mk> |
1424 |
|
1425 |
.if make(check-old) || make(check-old-dirs) || \ |
1426 |
make(check-old-files) || make(check-old-libs) || \ |
1427 |
make(delete-old) || make(delete-old-dirs) || \ |
1428 |
make(delete-old-files) || make(delete-old-libs) |
1429 |
|
1430 |
# |
1431 |
# check for / delete old files section |
1432 |
# |
1433 |
|
1434 |
.include "ObsoleteFiles.inc" |
1435 |
|
1436 |
OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \ |
1437 |
else you can not start such an application. Consult UPDATING for more \ |
1438 |
information regarding how to cope with the removal/revision bump of a \ |
1439 |
specific library." |
1440 |
|
1441 |
.if !defined(BATCH_DELETE_OLD_FILES) |
1442 |
RM_I=-i |
1443 |
.else |
1444 |
RM_I=-v |
1445 |
.endif |
1446 |
|
1447 |
delete-old-files: |
1448 |
@echo ">>> Removing old files (only deletes safe to delete libs)" |
1449 |
# Ask for every old file if the user really wants to remove it. |
1450 |
# It's annoying, but better safe than sorry. |
1451 |
# NB: We cannot pass the list of OLD_FILES as a parameter because the |
1452 |
# argument list will get too long. Using .for/.endfor make "loops" will make |
1453 |
# the Makefile parser segfault. |
1454 |
@exec 3<&0; \ |
1455 |
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ |
1456 |
-V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ |
1457 |
while read file; do \ |
1458 |
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ |
1459 |
chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ |
1460 |
rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ |
1461 |
fi; \ |
1462 |
done |
1463 |
# Remove catpages without corresponding manpages. |
1464 |
@exec 3<&0; \ |
1465 |
find ${DESTDIR}/usr/share/man/cat* ! -type d | \ |
1466 |
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ |
1467 |
while read catpage; do \ |
1468 |
read manpage; \ |
1469 |
if [ ! -e "$${manpage}" ]; then \ |
1470 |
rm ${RM_I} $${catpage} <&3; \ |
1471 |
fi; \ |
1472 |
done |
1473 |
@echo ">>> Old files removed" |
1474 |
|
1475 |
check-old-files: |
1476 |
@echo ">>> Checking for old files" |
1477 |
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ |
1478 |
-V OLD_FILES -V "OLD_FILES:Musr/share/*.gz:R" | xargs -n1 | \ |
1479 |
while read file; do \ |
1480 |
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ |
1481 |
echo "${DESTDIR}/$${file}"; \ |
1482 |
fi; \ |
1483 |
done |
1484 |
# Check for catpages without corresponding manpages. |
1485 |
@find ${DESTDIR}/usr/share/man/cat* ! -type d | \ |
1486 |
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \ |
1487 |
while read catpage; do \ |
1488 |
read manpage; \ |
1489 |
if [ ! -e "$${manpage}" ]; then \ |
1490 |
echo $${catpage}; \ |
1491 |
fi; \ |
1492 |
done |
1493 |
|
1494 |
delete-old-libs: |
1495 |
@echo ">>> Removing old libraries" |
1496 |
@echo "${OLD_LIBS_MESSAGE}" | fmt |
1497 |
@exec 3<&0; \ |
1498 |
${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ |
1499 |
-V OLD_LIBS | xargs -n1 | \ |
1500 |
while read file; do \ |
1501 |
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ |
1502 |
chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ |
1503 |
rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ |
1504 |
fi; \ |
1505 |
done |
1506 |
@echo ">>> Old libraries removed" |
1507 |
|
1508 |
check-old-libs: |
1509 |
@echo ">>> Checking for old libraries" |
1510 |
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ |
1511 |
-V OLD_LIBS | xargs -n1 | \ |
1512 |
while read file; do \ |
1513 |
if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ |
1514 |
echo "${DESTDIR}/$${file}"; \ |
1515 |
fi; \ |
1516 |
done |
1517 |
|
1518 |
delete-old-dirs: |
1519 |
@echo ">>> Removing old directories" |
1520 |
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ |
1521 |
-V OLD_DIRS | xargs -n1 | \ |
1522 |
while read dir; do \ |
1523 |
if [ -d "${DESTDIR}/$${dir}" ]; then \ |
1524 |
rmdir -v "${DESTDIR}/$${dir}" || true; \ |
1525 |
elif [ -L "${DESTDIR}/$${dir}" ]; then \ |
1526 |
echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ |
1527 |
fi; \ |
1528 |
done |
1529 |
@echo ">>> Old directories removed" |
1530 |
|
1531 |
check-old-dirs: |
1532 |
@echo ">>> Checking for old directories" |
1533 |
@${MAKE} -f ${.CURDIR}/Makefile.inc1 ${.MAKEFLAGS} ${.TARGET} \ |
1534 |
-V OLD_DIRS | xargs -n1 | \ |
1535 |
while read dir; do \ |
1536 |
if [ -d "${DESTDIR}/$${dir}" ]; then \ |
1537 |
echo "${DESTDIR}/$${dir}"; \ |
1538 |
elif [ -L "${DESTDIR}/$${dir}" ]; then \ |
1539 |
echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \ |
1540 |
fi; \ |
1541 |
done |
1542 |
|
1543 |
delete-old: delete-old-files delete-old-dirs |
1544 |
@echo "To remove old libraries run '${MAKE} delete-old-libs'." |
1545 |
|
1546 |
check-old: check-old-files check-old-libs check-old-dirs |
1547 |
@echo "To remove old files and directories run '${MAKE} delete-old'." |
1548 |
@echo "To remove old libraries run '${MAKE} delete-old-libs'." |
1549 |
|
1550 |
.endif |
1551 |
|
1552 |
# |
1553 |
# showconfig - show build configuration. |
1554 |
# |
1555 |
showconfig: |
1556 |
@${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort |
1557 |
|
1558 |
.if !empty(KRNLOBJDIR) && !empty(KERNCONF) |
1559 |
DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ |
1560 |
|
1561 |
.if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE) |
1562 |
.if exists(${KERNCONFDIR}/${KERNCONF}) |
1563 |
FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ {print $$2}' \ |
1564 |
${KERNCONFDIR}/${KERNCONF} |
1565 |
.endif |
1566 |
.endif |
1567 |
|
1568 |
.endif |
1569 |
|
1570 |
.if !defined(DTBOUTPUTPATH) || !exists(${DTBOUTPUTPATH}) |
1571 |
DTBOUTPUTPATH= ${.CURDIR} |
1572 |
.endif |
1573 |
|
1574 |
# |
1575 |
# Build 'standalone' Device Tree Blob |
1576 |
# |
1577 |
builddtb: |
1578 |
@if [ "${FDT_DTS_FILE}" = "" ]; then \ |
1579 |
echo "ERROR: FDT_DTS_FILE must be specified!"; \ |
1580 |
exit 1; \ |
1581 |
fi; \ |
1582 |
if [ ! -f ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} ]; then \ |
1583 |
echo "ERROR: Specified DTS file (${FDT_DTS_FILE}) does not \ |
1584 |
exist!"; \ |
1585 |
exit 1; \ |
1586 |
fi; \ |
1587 |
if [ "${DTBOUTPUTPATH}" = "${.CURDIR}" ]; then \ |
1588 |
echo "WARNING: DTB will be placed in the current working \ |
1589 |
directory"; \ |
1590 |
fi |
1591 |
@PATH=${TMPPATH} \ |
1592 |
dtc -O dtb -o \ |
1593 |
${DTBOUTPUTPATH}/`echo ${FDT_DTS_FILE} | cut -d. -f1`.dtb -b 0 \ |
1594 |
-p 1024 ${.CURDIR}/sys/boot/fdt/dts/${FDT_DTS_FILE} |
1595 |
|
1596 |
############### |
1597 |
|
1598 |
.if defined(XDEV) && defined(XDEV_ARCH) |
1599 |
|
1600 |
.if ${XDEV} == ${MACHINE} && ${XDEV_ARCH} == ${MACHINE_ARCH} |
1601 |
XDEV_CPUTYPE?=${CPUTYPE} |
1602 |
.else |
1603 |
XDEV_CPUTYPE?=${TARGET_CPUTYPE} |
1604 |
.endif |
1605 |
|
1606 |
NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \ |
1607 |
-DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \ |
1608 |
-DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \ |
1609 |
TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \ |
1610 |
CPUTYPE=${XDEV_CPUTYPE} |
1611 |
|
1612 |
XDDIR=${XDEV_ARCH}-midnightbsd |
1613 |
XDTP=/usr/${XDDIR} |
1614 |
CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} |
1615 |
CDENV= ${CDBENV} \ |
1616 |
_SHLIBDIRPREFIX=${XDTP} \ |
1617 |
TOOLS_PREFIX=${XDTP} |
1618 |
CD2ENV=${CDENV} \ |
1619 |
MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH} |
1620 |
|
1621 |
CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp |
1622 |
CDMAKE=${CDENV} ${MAKE} ${NOFUN} |
1623 |
CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} |
1624 |
XDDESTDIR=${DESTDIR}${XDTP} |
1625 |
.if !defined(OSREL) |
1626 |
OSREL!= uname -r | sed -e 's/[-(].*//' |
1627 |
.endif |
1628 |
|
1629 |
.ORDER: xdev-build xdev-install |
1630 |
xdev: xdev-build xdev-install |
1631 |
|
1632 |
.ORDER: _xb-build-tools _xb-cross-tools |
1633 |
xdev-build: _xb-build-tools _xb-cross-tools |
1634 |
|
1635 |
_xb-build-tools: |
1636 |
${_+_}@cd ${.CURDIR}; \ |
1637 |
${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools |
1638 |
|
1639 |
_xb-cross-tools: |
1640 |
.for _tool in \ |
1641 |
gnu/usr.bin/binutils \ |
1642 |
gnu/usr.bin/cc \ |
1643 |
usr.bin/ar |
1644 |
${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \ |
1645 |
cd ${.CURDIR}/${_tool}; \ |
1646 |
${CDMAKE} DIRPRFX=${_tool}/ obj; \ |
1647 |
${CDMAKE} DIRPRFX=${_tool}/ depend; \ |
1648 |
${CDMAKE} DIRPRFX=${_tool}/ all |
1649 |
.endfor |
1650 |
|
1651 |
_xi-mtree: |
1652 |
${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}" |
1653 |
mkdir -p ${XDDESTDIR} |
1654 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ |
1655 |
-p ${XDDESTDIR} >/dev/null |
1656 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ |
1657 |
-p ${XDDESTDIR}/usr >/dev/null |
1658 |
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ |
1659 |
-p ${XDDESTDIR}/usr/include >/dev/null |
1660 |
|
1661 |
.ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links |
1662 |
xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links |
1663 |
|
1664 |
_xi-cross-tools: |
1665 |
@echo "_xi-cross-tools" |
1666 |
.for _tool in \ |
1667 |
gnu/usr.bin/binutils \ |
1668 |
gnu/usr.bin/cc \ |
1669 |
usr.bin/ar |
1670 |
${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \ |
1671 |
cd ${.CURDIR}/${_tool}; \ |
1672 |
${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR} |
1673 |
.endfor |
1674 |
|
1675 |
_xi-includes: |
1676 |
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \ |
1677 |
DESTDIR=${XDDESTDIR} |
1678 |
|
1679 |
_xi-libraries: |
1680 |
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \ |
1681 |
DESTDIR=${XDDESTDIR} |
1682 |
|
1683 |
_xi-links: |
1684 |
${_+_}cd ${XDDESTDIR}/usr/bin; \ |
1685 |
for i in *; do \ |
1686 |
ln -sf ../../${XDTP}/usr/bin/$$i \ |
1687 |
../../../../usr/bin/${XDDIR}-$$i; \ |
1688 |
ln -sf ../../${XDTP}/usr/bin/$$i \ |
1689 |
../../../../usr/bin/${XDDIR}${OSREL}-$$i; \ |
1690 |
done |
1691 |
.endif |