ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 8155
Committed: Fri Sep 16 22:23:36 2016 UTC (7 years, 7 months ago) by laffer1
File size: 51743 byte(s)
Log Message:
partial revert of last commit

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

Properties

Name Value
svn:keywords MidnightBSD=%H