ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 9346
Committed: Sat Mar 4 16:46:02 2017 UTC (7 years, 2 months ago) by laffer1
File size: 53074 byte(s)
Log Message:
Fix installkernel requiring users/groups defined in CHECK_UIDS
  and CHECK_GIDS to exist since r152680. This is only needed for
  installworld. The documented procedure of running mergemaster -p
  to check for missing users is only needed for installworld, not
  for installkernel. This fixes auditdistd incorrectly being
  required for installkernel.

Obtained from: FreeBSD

File Contents

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

Properties

Name Value
svn:keywords MidnightBSD=%H