ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 8977
Committed: Fri Sep 30 01:10:03 2016 UTC (7 years, 8 months ago) by laffer1
File size: 52879 byte(s)
Log Message:
change 32bit builds to switch to sub make vs -E

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

Properties

Name Value
svn:keywords MidnightBSD=%H