ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 9024
Committed: Sat Oct 1 09:39:11 2016 UTC (7 years, 7 months ago) by laffer1
File size: 52902 byte(s)
Log Message:
add missing \

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

Properties

Name Value
svn:keywords MidnightBSD=%H