ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 8593
Committed: Mon Sep 19 20:50:56 2016 UTC (7 years, 7 months ago) by laffer1
File size: 51875 byte(s)
Log Message:
add bin to path

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

Properties

Name Value
svn:keywords MidnightBSD=%H