ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 2436
Committed: Tue Dec 9 18:37:20 2008 UTC (15 years, 4 months ago) by laffer1
File size: 37876 byte(s)
Log Message:
Remove 50* osrel check.

File Contents

# User Rev Content
1 laffer1 2 #
2 laffer1 5 # $FreeBSD: src/Makefile.inc1,v 1.499.2.7 2006/01/07 19:40:08 netchild Exp $
3 laffer1 2436 # $MidnightBSD: src/Makefile.inc1,v 1.12 2008/10/07 01:56:49 laffer1 Exp $
4 laffer1 2 #
5     # Make command line options:
6     # -DNO_CLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
7     # -DNO_CLEAN do not clean at all
8     # -DNO_SHARE do not go into share subdir
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_PORTSUPDATE do not update ports in ${MAKE} update
13     # -DNO_DOCUPDATE do not update doc in ${MAKE} update
14     # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
15 laffer1 1926 # TARGET="machine" to crossbuild world for a different machine type
16 laffer1 2
17     #
18     # The intended user-driven targets are:
19     # buildworld - rebuild *everything*, including glue to help do upgrades
20     # installworld- install everything built by "buildworld"
21 laffer1 1926 # doxygen - build API documentation of the kernel
22 laffer1 2 # update - convenient way to update your source tree (eg: cvsup/cvs)
23     #
24     # Standard targets (not defined here) are documented in the makefiles in
25     # /usr/share/mk. These include:
26     # obj depend all install clean cleandepend cleanobj
27    
28 laffer1 1926 .include <bsd.own.mk>
29    
30 laffer1 2 # We must do share/info early so that installation of info `dir'
31     # entries works correctly. Do it first since it is less likely to
32     # grow dependencies on include and lib than vice versa.
33     #
34 laffer1 1926 # We must do lib/ and libexec/ before bin/, because if installworld
35 laffer1 2 # installs a new /bin/sh, the 'make' command will *immediately*
36     # use that new version. And the new (dynamically-linked) /bin/sh
37     # will expect to find appropriate libraries in /lib and /libexec.
38     #
39 laffer1 1926 SUBDIR= share/info lib libexec
40     SUBDIR+=bin
41     .if ${MK_GAMES} != "no"
42 laffer1 2 SUBDIR+=games
43     .endif
44 laffer1 1926 .if ${MK_CDDL} != "no"
45     SUBDIR+=cddl
46     .endif
47     SUBDIR+=gnu include
48     .if ${MK_KERBEROS} != "no"
49 laffer1 2 SUBDIR+=kerberos5
50     .endif
51 laffer1 1926 .if ${MK_RESCUE} != "no"
52 laffer1 2 SUBDIR+=rescue
53     .endif
54     SUBDIR+=sbin
55 laffer1 1926 .if ${MK_CRYPT} != "no"
56 laffer1 2 SUBDIR+=secure
57     .endif
58     .if !defined(NO_SHARE)
59     SUBDIR+=share
60     .endif
61 laffer1 1926 SUBDIR+=sys usr.bin usr.sbin
62     #
63     # We must do etc/ last for install/distribute to work.
64     #
65     SUBDIR+=etc
66 laffer1 2
67     # These are last, since it is nice to at least get the base system
68     # rebuilt before you do them.
69     .for _DIR in ${LOCAL_DIRS}
70     .if exists(${.CURDIR}/${_DIR}/Makefile)
71     SUBDIR+= ${_DIR}
72     .endif
73     .endfor
74    
75     .if defined(SUBDIR_OVERRIDE)
76     SUBDIR= ${SUBDIR_OVERRIDE}
77     .endif
78    
79     .if defined(NOCLEAN)
80     NO_CLEAN= ${NOCLEAN}
81     .endif
82     .if defined(NO_CLEANDIR)
83     CLEANDIR= clean cleandepend
84     .else
85     CLEANDIR= cleandir
86     .endif
87    
88     CVS?= cvs
89 laffer1 359 CVSFLAGS?= -r . -P -d -I!
90     SUP?= /usr/bin/csup
91 laffer1 1926 SUPFLAGS?= -g -L 2
92 laffer1 2 .if defined(SUPHOST)
93     SUPFLAGS+= -h ${SUPHOST}
94     .endif
95    
96     MAKEOBJDIRPREFIX?= /usr/obj
97     .if !defined(OSRELDATE)
98     .if exists(/usr/include/osreldate.h)
99     OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
100     /usr/include/osreldate.h
101     .else
102     OSRELDATE= 0
103     .endif
104     .endif
105 laffer1 1926
106     # Guess machine architecture from machine type, and vice versa.
107     .if !defined(TARGET_ARCH) && defined(TARGET)
108     TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/}
109     .elif !defined(TARGET) && defined(TARGET_ARCH) && \
110     ${TARGET_ARCH} != ${MACHINE_ARCH}
111     TARGET= ${TARGET_ARCH}
112     .endif
113     # Otherwise, default to current machine type and architecture.
114     TARGET?= ${MACHINE}
115 laffer1 2 TARGET_ARCH?= ${MACHINE_ARCH}
116 laffer1 1926
117     KNOWN_ARCHES?= amd64 arm i386 i386/pc98 ia64 powerpc sparc64 sparc64/sun4v
118     .if ${TARGET} == ${TARGET_ARCH}
119     _t= ${TARGET}
120     .else
121     _t= ${TARGET_ARCH}/${TARGET}
122     .endif
123     .for _t in ${_t}
124     .if empty(KNOWN_ARCHES:M${_t})
125     .error Unknown target ${TARGET_ARCH}:${TARGET}.
126     .endif
127     .endfor
128    
129     .if ${TARGET} == ${MACHINE}
130 laffer1 2 TARGET_CPUTYPE?=${CPUTYPE}
131     .else
132     TARGET_CPUTYPE?=
133     .endif
134 laffer1 1926
135 laffer1 2 .if !empty(TARGET_CPUTYPE)
136     _TARGET_CPUTYPE=${TARGET_CPUTYPE}
137     .else
138     _TARGET_CPUTYPE=dummy
139     .endif
140     _CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} \
141     -f /dev/null -m ${.CURDIR}/share/mk -V CPUTYPE
142     .if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
143     .error CPUTYPE global should be set with ?=.
144     .endif
145     .if make(buildworld)
146 laffer1 1926 BUILD_ARCH!= uname -p
147 laffer1 2 .if ${MACHINE_ARCH} != ${BUILD_ARCH}
148     .error To cross-build, set TARGET_ARCH.
149     .endif
150     .endif
151     .if ${MACHINE} == ${TARGET} && !defined(CROSS_BUILD_TESTING)
152     OBJTREE= ${MAKEOBJDIRPREFIX}
153     .else
154     OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
155     .endif
156     WORLDTMP= ${OBJTREE}${.CURDIR}/tmp
157     # /usr/games added for fortune which depend on strfile
158     BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
159     XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
160     STRICTTMPPATH= ${BPATH}:${XPATH}
161     TMPPATH= ${STRICTTMPPATH}:${PATH}
162    
163     INSTALLTMP!= /usr/bin/mktemp -d -u -t install
164    
165     #
166     # Building a world goes through the following stages
167     #
168     # 1. legacy stage [BMAKE]
169     # This stage is responsible for creating compatibility
170     # shims that are needed by the bootstrap-tools,
171     # build-tools and cross-tools stages.
172     # 1. bootstrap-tools stage [BMAKE]
173     # This stage is responsible for creating programs that
174     # are needed for backward compatibility reasons. They
175     # are not built as cross-tools.
176     # 2. build-tools stage [TMAKE]
177     # This stage is responsible for creating the object
178     # tree and building any tools that are needed during
179     # the build process.
180     # 3. cross-tools stage [XMAKE]
181     # This stage is responsible for creating any tools that
182     # are needed for cross-builds. A cross-compiler is one
183     # of them.
184     # 4. world stage [WMAKE]
185     # This stage actually builds the world.
186     # 5. install stage (optional) [IMAKE]
187     # This stage installs a previously built world.
188     #
189    
190     BOOTSTRAPPING?= 0
191    
192     # Common environment for world related stages
193     CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
194     MACHINE_ARCH=${TARGET_ARCH} \
195     MACHINE=${TARGET} \
196     CPUTYPE=${TARGET_CPUTYPE} \
197     GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
198     GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
199     GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
200    
201     # bootstrap-tools stage
202     BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
203     PATH=${BPATH}:${PATH} \
204     WORLDTMP=${WORLDTMP} \
205     MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
206     BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
207     ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
208     DESTDIR= \
209     BOOTSTRAPPING=${OSRELDATE} \
210 laffer1 1926 -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
211     -DWITHOUT_NLS -DNO_PIC -DWITHOUT_PROFILE -DNO_SHARED \
212     -DNO_CPU_CFLAGS -DNO_WARNS
213 laffer1 2
214     # build-tools stage
215     TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
216     ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
217 laffer1 1926 TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
218 laffer1 2 DESTDIR= \
219     BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS
220    
221     # cross-tools stage
222 laffer1 1926 XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
223     TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
224     -DWITHOUT_GDB
225 laffer1 2
226     # world stage
227     WMAKEENV= ${CROSSENV} \
228     _SHLIBDIRPREFIX=${WORLDTMP} \
229     INSTALL="sh ${.CURDIR}/tools/install.sh" \
230     PATH=${TMPPATH}
231     WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
232    
233     .if ${TARGET_ARCH} == "amd64"
234     # 32 bit world
235     LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
236    
237 laffer1 1926 .if empty(TARGET_CPUTYPE)
238     LIB32CPUTYPE= k8
239     .else
240     LIB32CPUTYPE= ${TARGET_CPUTYPE}
241     .endif
242     LIB32FLAGS= -m32 -march=${LIB32CPUTYPE} -mfancy-math-387 -DCOMPAT_32BIT \
243     -iprefix ${LIB32TMP}/usr/ \
244 laffer1 2 -L${LIB32TMP}/usr/lib32 \
245     -B${LIB32TMP}/usr/lib32
246    
247     # Yes, the flags are redundant.
248 laffer1 1926 LIB32WMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
249 laffer1 2 _SHLIBDIRPREFIX=${LIB32TMP} \
250     MACHINE=i386 \
251     MACHINE_ARCH=i386 \
252     INSTALL="sh ${.CURDIR}/tools/install.sh" \
253     PATH=${TMPPATH} \
254 laffer1 1926 CC="${CC} ${LIB32FLAGS}" \
255     CXX="${CXX} ${LIB32FLAGS}" \
256     OBJC="${OBJC} ${LIB32FLAGS}" \
257 laffer1 2 LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
258     AS="${AS} --32" \
259     LIBDIR=/usr/lib32 \
260     SHLIBDIR=/usr/lib32
261    
262 laffer1 1926 LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
263     -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_INFO \
264     -DWITHOUT_HTML DESTDIR=${LIB32TMP}
265     LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS
266 laffer1 2 .endif
267    
268     # install stage
269     .if empty(.MAKEFLAGS:M-n)
270     IMAKEENV= ${CROSSENV} \
271     PATH=${STRICTTMPPATH}:${INSTALLTMP}
272     .else
273     IMAKEENV= ${CROSSENV} \
274     PATH=${TMPPATH}:${INSTALLTMP}
275     .endif
276     IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
277    
278     # kernel stage
279     KMAKEENV= ${WMAKEENV}
280 laffer1 1926 KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME}
281 laffer1 2
282     #
283     # buildworld
284     #
285     # Attempt to rebuild the entire system, with reasonable chance of
286     # success, regardless of how old your existing system is.
287     #
288     _worldtmp:
289     .if ${.CURDIR:C/[^,]//g} != ""
290     # The m4 build of sendmail files doesn't like it if ',' is used
291     # anywhere in the path of it's files.
292     @echo
293     @echo "*** Error: path to source tree contains a comma ','"
294     @echo
295     false
296     .endif
297     @echo
298     @echo "--------------------------------------------------------------"
299     @echo ">>> Rebuilding the temporary build tree"
300     @echo "--------------------------------------------------------------"
301     .if !defined(NO_CLEAN)
302     rm -rf ${WORLDTMP}
303     .if ${TARGET_ARCH} == "amd64"
304     rm -rf ${LIB32TMP}
305     .endif
306     .else
307     rm -rf ${WORLDTMP}/legacy/usr/include
308 laffer1 1926 # XXX - These two can depend on any header file.
309 laffer1 2 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
310     rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
311     .endif
312     .for _dir in \
313 laffer1 1926 usr/bin usr/games usr/include/sys usr/lib \
314 laffer1 2 usr/libexec usr/sbin usr/share/dict \
315     usr/share/groff_font/devX100 \
316     usr/share/groff_font/devX100-12 \
317     usr/share/groff_font/devX75 \
318     usr/share/groff_font/devX75-12 \
319     usr/share/groff_font/devascii \
320     usr/share/groff_font/devcp1047 \
321     usr/share/groff_font/devdvi \
322     usr/share/groff_font/devhtml \
323     usr/share/groff_font/devkoi8-r \
324     usr/share/groff_font/devlatin1 \
325     usr/share/groff_font/devlbp \
326     usr/share/groff_font/devlj4 \
327     usr/share/groff_font/devps \
328     usr/share/groff_font/devutf8 \
329     usr/share/tmac/mdoc usr/share/tmac/mm
330     mkdir -p ${WORLDTMP}/legacy/${_dir}
331     .endfor
332     .for _dir in \
333     lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
334 laffer1 1551 usr/libexec usr/sbin usr/share/misc
335 laffer1 2 mkdir -p ${WORLDTMP}/${_dir}
336     .endfor
337     mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
338     -p ${WORLDTMP}/usr/include >/dev/null
339     ln -sf ${.CURDIR}/sys ${WORLDTMP}
340 laffer1 1926 .if ${MK_BIND_LIBS} != "no"
341 laffer1 2 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
342     -p ${WORLDTMP}/usr/include >/dev/null
343     .endif
344     _legacy:
345     @echo
346     @echo "--------------------------------------------------------------"
347     @echo ">>> stage 1.1: legacy release compatibility shims"
348     @echo "--------------------------------------------------------------"
349     ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
350     _bootstrap-tools:
351     @echo
352     @echo "--------------------------------------------------------------"
353     @echo ">>> stage 1.2: bootstrap tools"
354     @echo "--------------------------------------------------------------"
355     ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
356     _cleanobj:
357     .if !defined(NO_CLEAN)
358     @echo
359     @echo "--------------------------------------------------------------"
360     @echo ">>> stage 2.1: cleaning up the object tree"
361     @echo "--------------------------------------------------------------"
362     ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
363     .if ${TARGET_ARCH} == "amd64"
364 laffer1 1926 ${_+_}cd ${.CURDIR}; ${LIB32WMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/}
365 laffer1 2 .endif
366     .endif
367     _obj:
368     @echo
369     @echo "--------------------------------------------------------------"
370     @echo ">>> stage 2.2: rebuilding the object tree"
371     @echo "--------------------------------------------------------------"
372     ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
373     _build-tools:
374     @echo
375     @echo "--------------------------------------------------------------"
376     @echo ">>> stage 2.3: build tools"
377     @echo "--------------------------------------------------------------"
378     ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
379     _cross-tools:
380     @echo
381     @echo "--------------------------------------------------------------"
382     @echo ">>> stage 3: cross tools"
383     @echo "--------------------------------------------------------------"
384     ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
385     _includes:
386     @echo
387     @echo "--------------------------------------------------------------"
388     @echo ">>> stage 4.1: building includes"
389     @echo "--------------------------------------------------------------"
390     ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
391     _libraries:
392     @echo
393     @echo "--------------------------------------------------------------"
394     @echo ">>> stage 4.2: building libraries"
395     @echo "--------------------------------------------------------------"
396     ${_+_}cd ${.CURDIR}; \
397 laffer1 1926 ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
398     -DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE libraries
399 laffer1 2 _depend:
400     @echo
401     @echo "--------------------------------------------------------------"
402     @echo ">>> stage 4.3: make dependencies"
403     @echo "--------------------------------------------------------------"
404     ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
405     everything:
406     @echo
407     @echo "--------------------------------------------------------------"
408     @echo ">>> stage 4.4: building everything"
409     @echo "--------------------------------------------------------------"
410     ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
411     .if ${TARGET_ARCH} == "amd64"
412     build32:
413     @echo
414     @echo "--------------------------------------------------------------"
415     @echo ">>> stage 5.1: building 32 bit shim libraries"
416     @echo "--------------------------------------------------------------"
417     .for _dir in \
418 laffer1 1926 usr/include usr/lib32 usr/share/misc
419 laffer1 2 mkdir -p ${LIB32TMP}/${_dir}
420     .endfor
421     mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
422     -p ${LIB32TMP}/usr/include >/dev/null
423     mkdir -p ${WORLDTMP}
424     ln -sf ${.CURDIR}/sys ${WORLDTMP}
425 laffer1 1926 .if ${MK_KERBEROS} != "no"
426 laffer1 2 .for _t in obj depend all
427     cd ${.CURDIR}/kerberos5/tools; \
428     MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= ${_t}
429     .endfor
430     .endif
431     .for _t in obj includes
432 laffer1 1926 cd ${.CURDIR}/include; ${LIB32WMAKE} ${_t}
433     cd ${.CURDIR}/lib; ${LIB32WMAKE} ${_t}
434     .if ${MK_CDDL} != "no"
435     cd ${.CURDIR}/cddl/lib; ${LIB32WMAKE} ${_t}
436 laffer1 2 .endif
437 laffer1 1926 cd ${.CURDIR}/gnu/lib; ${LIB32WMAKE} ${_t}
438     .if ${MK_CRYPT} != "no"
439     cd ${.CURDIR}/secure/lib; ${LIB32WMAKE} ${_t}
440 laffer1 2 .endif
441 laffer1 1926 .if ${MK_KERBEROS} != "no"
442     cd ${.CURDIR}/kerberos5/lib; ${LIB32WMAKE} ${_t}
443     .endif
444 laffer1 2 .endfor
445 laffer1 1551 .for _dir in usr.bin/lex/lib
446 laffer1 1926 cd ${.CURDIR}/${_dir}; ${LIB32WMAKE} obj
447 laffer1 2 .endfor
448 laffer1 1926 .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic
449 laffer1 2 cd ${.CURDIR}/${_dir}; \
450     MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} DESTDIR= build-tools
451     .endfor
452     cd ${.CURDIR}; \
453 laffer1 1926 ${LIB32WMAKE} -f Makefile.inc1 libraries
454 laffer1 2 .for _t in obj depend all
455     cd ${.CURDIR}/libexec/rtld-elf; \
456 laffer1 1926 PROG=ld-elf32.so.1 ${LIB32WMAKE} ${_t}
457 laffer1 2 .endfor
458    
459     distribute32 install32:
460     .if make(distribute32)
461     mkdir -p ${DISTDIR}/${DISTRIBUTION}/usr/lib32 # XXX add to mtree
462     .else
463     mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
464     .endif
465     cd ${.CURDIR}/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
466     cd ${.CURDIR}/gnu/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
467 laffer1 1926 .if ${MK_CRYPT} != "no"
468 laffer1 2 cd ${.CURDIR}/secure/lib; ${LIB32IMAKE} ${.TARGET:S/32$//}
469     .endif
470     cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32IMAKE} ${.TARGET:S/32$//}
471     .endif
472    
473    
474     WMAKE_TGTS=
475     .if !defined(SUBDIR_OVERRIDE)
476     WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
477     .endif
478     WMAKE_TGTS+= _cleanobj _obj _build-tools
479     .if !defined(SUBDIR_OVERRIDE)
480     WMAKE_TGTS+= _cross-tools
481     .endif
482     WMAKE_TGTS+= _includes _libraries _depend everything
483 laffer1 1926 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
484 laffer1 2 WMAKE_TGTS+= build32
485     .endif
486    
487 laffer1 1926 buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
488     .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue
489 laffer1 2
490 laffer1 1926 buildworld_prologue:
491     @echo "--------------------------------------------------------------"
492     @echo ">>> World build started on `LC_ALL=C date`"
493     @echo "--------------------------------------------------------------"
494    
495     buildworld_epilogue:
496     @echo
497     @echo "--------------------------------------------------------------"
498     @echo ">>> World build completed on `LC_ALL=C date`"
499     @echo "--------------------------------------------------------------"
500    
501     #
502     # We need to have this as a target because the indirection between Makefile
503     # and Makefile.inc1 causes the correct PATH to be used, rather than a
504     # modification of the current environment's PATH. In addition, we need
505     # to quote multiword values.
506     #
507     buildenvvars:
508     @echo ${WMAKEENV:Q}
509    
510 laffer1 2 buildenv:
511     @echo Entering world for ${TARGET_ARCH}:${TARGET}
512     @cd ${.CURDIR} && env ${WMAKEENV} sh || true
513    
514     TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything:Nbuild32}
515     toolchain: ${TOOLCHAIN_TGTS}
516     kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
517    
518     #
519 laffer1 1926 # installcheck
520 laffer1 2 #
521 laffer1 1926 # Checks to be sure system is ready for installworld/installkernel.
522     #
523     installcheck:
524 laffer1 2
525     #
526     # Require DESTDIR to be set if installing for a different architecture.
527     #
528     .if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
529     .if !make(distributeworld)
530 laffer1 1926 installcheck: installcheck_DESTDIR
531 laffer1 2 installcheck_DESTDIR:
532     .if !defined(DESTDIR) || empty(DESTDIR)
533     @echo "ERROR: Please set DESTDIR!"; \
534     false
535     .endif
536     .endif
537     .endif
538    
539     #
540 laffer1 1926 # Check for missing UIDs/GIDs.
541 laffer1 2 #
542     CHECK_UIDS=
543 laffer1 1549 CHECK_GIDS= audit
544 laffer1 1926 .if ${MK_SENDMAIL} != "no"
545 laffer1 2 CHECK_UIDS+= smmsp
546     CHECK_GIDS+= smmsp
547     .endif
548 laffer1 1926 .if ${MK_PF} != "no"
549 laffer1 2 CHECK_UIDS+= proxy
550     CHECK_GIDS+= proxy authpf
551     .endif
552 laffer1 1926 installcheck: installcheck_UGID
553     installcheck_UGID:
554 laffer1 2 .for uid in ${CHECK_UIDS}
555     @if ! `id -u ${uid} >/dev/null 2>&1`; then \
556     echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
557     false; \
558     fi
559     .endfor
560     .for gid in ${CHECK_GIDS}
561     @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
562     echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
563     false; \
564     fi
565     .endfor
566    
567     #
568     # distributeworld
569     #
570     # Distributes everything compiled by a `buildworld'.
571     #
572     # installworld
573     #
574     # Installs everything compiled by a 'buildworld'.
575     #
576     distributeworld installworld: installcheck
577     mkdir -p ${INSTALLTMP}
578     for prog in [ awk cap_mkdb cat chflags chmod chown \
579     date echo egrep find grep install-info \
580 laffer1 361 ln lockf make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
581 laffer1 2 test true uname wc zic; do \
582     cp `which $$prog` ${INSTALLTMP}; \
583     done
584     ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
585     rm -rf ${INSTALLTMP}
586    
587     #
588     # reinstall
589     #
590     # If you have a build server, you can NFS mount the source and obj directories
591     # and do a 'make reinstall' on the *client* to install new binaries from the
592     # most recent server build.
593     #
594 laffer1 1926 reinstall:
595 laffer1 2 @echo "--------------------------------------------------------------"
596     @echo ">>> Making hierarchy"
597     @echo "--------------------------------------------------------------"
598     ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
599     @echo
600     @echo "--------------------------------------------------------------"
601     @echo ">>> Installing everything"
602     @echo "--------------------------------------------------------------"
603     ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
604 laffer1 1926 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
605 laffer1 2 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
606     .endif
607    
608     redistribute:
609     @echo "--------------------------------------------------------------"
610     @echo ">>> Distributing everything"
611     @echo "--------------------------------------------------------------"
612     ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
613 laffer1 1926 .if ${TARGET_ARCH} == "amd64" && ${MK_LIB32} != "no"
614 laffer1 2 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute32 DISTRIBUTION=lib32
615     .endif
616    
617     distrib-dirs distribution:
618     cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
619    
620     #
621     # buildkernel and installkernel
622     #
623     # Which kernels to build and/or install is specified by setting
624     # KERNCONF. If not defined a GENERIC kernel is built/installed.
625     # Only the existing (depending TARGET) config files are used
626     # for building kernels and only the first of these is designated
627     # as the one being installed.
628     #
629     # Note that we have to use TARGET instead of TARGET_ARCH when
630     # we're in kernel-land. Since only TARGET_ARCH is (expected) to
631     # be set to cross-build, we have to make sure TARGET is set
632     # properly.
633    
634     .if !defined(KERNCONF) && defined(KERNEL)
635     KERNCONF= ${KERNEL}
636     KERNWARN=
637     .else
638     KERNCONF?= GENERIC
639     .endif
640     INSTKERNNAME?= kernel
641    
642     KERNSRCDIR?= ${.CURDIR}/sys
643     KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
644     KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
645     KERNCONFDIR?= ${KRNLCONFDIR}
646    
647     BUILDKERNELS=
648     INSTALLKERNEL=
649     .for _kernel in ${KERNCONF}
650     .if exists(${KERNCONFDIR}/${_kernel})
651     BUILDKERNELS+= ${_kernel}
652     .if empty(INSTALLKERNEL)
653     INSTALLKERNEL= ${_kernel}
654     .endif
655     .endif
656     .endfor
657    
658     #
659     # buildkernel
660     #
661     # Builds all kernels defined by BUILDKERNELS.
662     #
663     buildkernel:
664     .if empty(BUILDKERNELS)
665     @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF})."; \
666     false
667     .endif
668     .if defined(KERNWARN)
669     @echo "--------------------------------------------------------------"
670     @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
671     @echo "--------------------------------------------------------------"
672     @sleep 3
673     .endif
674     @echo
675     .for _kernel in ${BUILDKERNELS}
676     @echo "--------------------------------------------------------------"
677     @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
678     @echo "--------------------------------------------------------------"
679     @echo "===> ${_kernel}"
680     mkdir -p ${KRNLOBJDIR}
681     .if !defined(NO_KERNELCONFIG)
682     @echo
683     @echo "--------------------------------------------------------------"
684     @echo ">>> stage 1: configuring the kernel"
685     @echo "--------------------------------------------------------------"
686     cd ${KRNLCONFDIR}; \
687     PATH=${TMPPATH} \
688     config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
689     ${KERNCONFDIR}/${_kernel}
690     .endif
691     .if !defined(NO_CLEAN) && !defined(NO_KERNELCLEAN)
692     @echo
693     @echo "--------------------------------------------------------------"
694     @echo ">>> stage 2.1: cleaning up the object tree"
695     @echo "--------------------------------------------------------------"
696 laffer1 1926 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} ${CLEANDIR}
697 laffer1 2 .endif
698     @echo
699     @echo "--------------------------------------------------------------"
700     @echo ">>> stage 2.2: rebuilding the object tree"
701     @echo "--------------------------------------------------------------"
702 laffer1 1926 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} obj
703 laffer1 2 @echo
704     @echo "--------------------------------------------------------------"
705     @echo ">>> stage 2.3: build tools"
706     @echo "--------------------------------------------------------------"
707     cd ${KRNLOBJDIR}/${_kernel}; \
708     MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
709     ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
710     # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
711     .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
712     .for target in obj depend all
713     cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \
714     MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
715     ${MAKE} -DNO_CPU_CFLAGS ${target}
716     .endfor
717     .endif
718     .if !defined(NO_KERNELDEPEND)
719     @echo
720     @echo "--------------------------------------------------------------"
721     @echo ">>> stage 3.1: making dependencies"
722     @echo "--------------------------------------------------------------"
723 laffer1 1926 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} depend -DNO_MODULES_OBJ
724 laffer1 2 .endif
725     @echo
726     @echo "--------------------------------------------------------------"
727     @echo ">>> stage 3.2: building everything"
728     @echo "--------------------------------------------------------------"
729 laffer1 1926 cd ${KRNLOBJDIR}/${_kernel}; ${KMAKE} all -DNO_MODULES_OBJ
730 laffer1 2 @echo "--------------------------------------------------------------"
731     @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
732     @echo "--------------------------------------------------------------"
733     .endfor
734    
735     #
736     # installkernel, etc.
737     #
738     # Install the kernel defined by INSTALLKERNEL
739     #
740     installkernel installkernel.debug \
741 laffer1 1926 reinstallkernel reinstallkernel.debug: installcheck
742 laffer1 2 .if empty(INSTALLKERNEL)
743     @echo "ERROR: No kernel \"${KERNCONF}\" to install."; \
744     false
745     .endif
746     @echo "--------------------------------------------------------------"
747     @echo ">>> Installing kernel"
748     @echo "--------------------------------------------------------------"
749     cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
750     ${CROSSENV} PATH=${TMPPATH} \
751     ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
752    
753     #
754 laffer1 1926 # doxygen
755     #
756     # Build the API documentation with doxygen
757     #
758     doxygen:
759     @if [ ! -x `/usr/bin/which doxygen` ]; then \
760     echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
761     exit 1; \
762     fi
763     cd ${.CURDIR}/tools/kerneldoc/subsys && ${MAKE} obj all
764    
765     #
766 laffer1 2 # update
767     #
768     # Update the source tree, by running cvsup and/or running cvs to update to the
769     # latest copy.
770     #
771     update:
772     .if defined(SUP_UPDATE)
773     @echo "--------------------------------------------------------------"
774     @echo ">>> Running ${SUP}"
775     @echo "--------------------------------------------------------------"
776     .if defined(SUPFILE)
777     @${SUP} ${SUPFLAGS} ${SUPFILE}
778     .endif
779     .if defined(SUPFILE1)
780     @${SUP} ${SUPFLAGS} ${SUPFILE1}
781     .endif
782     .if defined(SUPFILE2)
783     @${SUP} ${SUPFLAGS} ${SUPFILE2}
784     .endif
785     .if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
786     @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
787     .endif
788     .if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
789     @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
790     .endif
791     .endif
792     .if defined(CVS_UPDATE)
793     @echo "--------------------------------------------------------------"
794     @echo ">>> Updating ${.CURDIR} from CVS repository" ${CVSROOT}
795     @echo "--------------------------------------------------------------"
796     cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
797     .endif
798    
799     #
800     # ------------------------------------------------------------------------
801     #
802     # From here onwards are utility targets used by the 'make world' and
803     # related targets. If your 'world' breaks, you may like to try to fix
804     # the problem and manually run the following targets to attempt to
805     # complete the build. Beware, this is *not* guaranteed to work, you
806     # need to have a pretty good grip on the current state of the system
807     # to attempt to manually finish it. If in doubt, 'make world' again.
808     #
809    
810     #
811     # legacy: Build compatibility shims for the next three targets
812     #
813     legacy:
814     .for _tool in tools/build
815     ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
816     cd ${.CURDIR}/${_tool}; \
817     ${MAKE} DIRPRFX=${_tool}/ obj; \
818     ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
819     ${MAKE} DIRPRFX=${_tool}/ depend; \
820     ${MAKE} DIRPRFX=${_tool}/ all; \
821     ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
822     .endfor
823    
824     #
825     # bootstrap-tools: Build tools needed for compatibility
826     #
827 laffer1 1926 .if ${MK_GAMES} != "no"
828 laffer1 2 _strfile= games/fortune/strfile
829     .endif
830    
831 laffer1 1926 .if ${MK_CXX} != "no"
832 laffer1 2 _gperf= gnu/usr.bin/gperf
833 laffer1 1926 .if ${BOOTSTRAPPING} < 700004
834 laffer1 2 _groff= gnu/usr.bin/groff
835     .else
836     _groff= gnu/usr.bin/groff/tmac
837     .endif
838     .endif
839    
840     .if ${BOOTSTRAPPING} < 600029
841     _texinfo= gnu/usr.bin/texinfo
842     .endif
843    
844     .if ${BOOTSTRAPPING} < 600015
845     _cap_mkdb= usr.bin/cap_mkdb
846     .endif
847    
848     .if ${BOOTSTRAPPING} < 600018
849     _colldef= usr.bin/colldef
850     .endif
851    
852     .if ${BOOTSTRAPPING} < 600017
853     _gencat= usr.bin/gencat
854     .endif
855    
856     .if ${BOOTSTRAPPING} < 600016
857     _mklocale= usr.bin/mklocale
858     .endif
859    
860 laffer1 1926 .if ${BOOTSTRAPPING} < 700018
861 laffer1 687 _gensnmptree= usr.sbin/bsnmpd/gensnmptree
862 laffer1 366 .endif
863    
864 laffer1 1926 .if ${MK_RESCUE} != "no" && \
865     ${BOOTSTRAPPING} < 700026
866 laffer1 2 _crunchgen= usr.sbin/crunch/crunchgen
867     .endif
868    
869     .if ${BOOTSTRAPPING} < 600020
870     _pwd_mkdb= usr.sbin/pwd_mkdb
871     .endif
872    
873     bootstrap-tools:
874     .for _tool in \
875     ${_strfile} \
876     ${_gperf} \
877     ${_groff} \
878     ${_texinfo} \
879     ${_cap_mkdb} \
880     ${_colldef} \
881     ${_gencat} \
882     usr.bin/lorder \
883     usr.bin/makewhatis \
884     ${_mklocale} \
885     usr.bin/rpcgen \
886 laffer1 1926 usr.bin/xinstall \
887 laffer1 366 ${_gensnmptree} \
888 laffer1 2 usr.sbin/config \
889     ${_crunchgen} \
890     ${_pwd_mkdb}
891     ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
892     cd ${.CURDIR}/${_tool}; \
893     ${MAKE} DIRPRFX=${_tool}/ obj; \
894     ${MAKE} DIRPRFX=${_tool}/ depend; \
895     ${MAKE} DIRPRFX=${_tool}/ all; \
896     ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
897     .endfor
898    
899     #
900     # build-tools: Build special purpose build tools
901     #
902     .if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
903     _aicasm= sys/modules/aic7xxx/aicasm
904     .endif
905    
906     .if !defined(NO_SHARE)
907     _share= share/syscons/scrnmaps
908     .endif
909    
910 laffer1 1926 .if ${MK_KERBEROS} != "no"
911 laffer1 2 _kerberos5_tools= kerberos5/tools
912     .endif
913    
914 laffer1 1926 .if ${MK_RESCUE} != "no"
915 laffer1 2 _rescue= rescue/rescue
916     .endif
917    
918     build-tools:
919     .for _tool in \
920     bin/csh \
921     bin/sh \
922     ${_rescue} \
923 laffer1 1926 lib/ncurses/ncurses \
924     lib/ncurses/ncursesw \
925 laffer1 2 ${_share} \
926     ${_aicasm} \
927     usr.bin/awk \
928     lib/libmagic \
929     usr.sbin/sysinstall
930     ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
931     cd ${.CURDIR}/${_tool}; \
932     ${MAKE} DIRPRFX=${_tool}/ obj; \
933     ${MAKE} DIRPRFX=${_tool}/ build-tools
934     .endfor
935     .for _tool in \
936     gnu/usr.bin/cc/cc_tools \
937     ${_kerberos5_tools}
938     ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
939     cd ${.CURDIR}/${_tool}; \
940     ${MAKE} DIRPRFX=${_tool}/ obj; \
941     ${MAKE} DIRPRFX=${_tool}/ depend; \
942     ${MAKE} DIRPRFX=${_tool}/ all
943     .endfor
944    
945     #
946     # cross-tools: Build cross-building tools
947     #
948 laffer1 1926 .if ${TARGET_ARCH} != ${MACHINE_ARCH}
949     .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
950 laffer1 2 _btxld= usr.sbin/btxld
951     .endif
952 laffer1 1926 .if ${MK_RESCUE} != "no" || defined(RELEASEDIR)
953 laffer1 2 _crunchide= usr.sbin/crunch/crunchide
954     .endif
955 laffer1 1926 .if ${TARGET_ARCH} == "i386" && defined(RELEASEDIR)
956 laffer1 2 _kgzip= usr.sbin/kgzip
957     .endif
958 laffer1 1926 .endif
959 laffer1 2
960     cross-tools:
961     .for _tool in \
962     gnu/usr.bin/binutils \
963     gnu/usr.bin/cc \
964 laffer1 1926 usr.bin/sed \
965 laffer1 2 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
966     ${_btxld} \
967     ${_crunchide} \
968     ${_kgzip}
969     ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
970     cd ${.CURDIR}/${_tool}; \
971     ${MAKE} DIRPRFX=${_tool}/ obj; \
972     ${MAKE} DIRPRFX=${_tool}/ depend; \
973     ${MAKE} DIRPRFX=${_tool}/ all; \
974     ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
975     .endfor
976    
977     #
978     # hierarchy - ensure that all the needed directories are present
979     #
980     hierarchy:
981     cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
982    
983     #
984     # libraries - build all libraries, and install them under ${DESTDIR}.
985     #
986     # The list of libraries with dependents (${_prebuild_libs}) and their
987     # interdependencies (__L) are built automatically by the
988     # ${.CURDIR}/tools/make_libdeps.sh script.
989     #
990     libraries:
991     cd ${.CURDIR}; \
992 laffer1 1926 ${MAKE} -f Makefile.inc1 _prereq_libs; \
993 laffer1 2 ${MAKE} -f Makefile.inc1 _startup_libs; \
994     ${MAKE} -f Makefile.inc1 _prebuild_libs; \
995     ${MAKE} -f Makefile.inc1 _generic_libs;
996    
997 laffer1 1926 #
998     # static libgcc.a prerequisite for shared libc
999     #
1000     _prereq_libs= gnu/lib/libgcc
1001    
1002 laffer1 2 # These dependencies are not automatically generated:
1003     #
1004 laffer1 1926 # gnu/lib/csu, gnu/lib/libgcc, lib/csu and lib/libc must be built before
1005     # all shared libraries for ELF.
1006 laffer1 2 #
1007 laffer1 1926 _startup_libs= gnu/lib/csu
1008 laffer1 2 .if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
1009     _startup_libs+= lib/csu/${MACHINE_ARCH}-elf
1010     .else
1011     _startup_libs+= lib/csu/${MACHINE_ARCH}
1012     .endif
1013 laffer1 1926 _startup_libs+= gnu/lib/libgcc
1014     _startup_libs+= lib/libc
1015 laffer1 2
1016 laffer1 1926 gnu/lib/libgcc__L: lib/libc__L
1017 laffer1 2
1018 laffer1 1926 _prebuild_libs= ${_kerberos5_lib_libasn1} ${_kerberos5_lib_libkrb5} \
1019     ${_kerberos5_lib_libroken} \
1020     lib/libbz2 lib/libcom_err lib/libcrypt lib/libexpat \
1021     ${_lib_libgssapi} ${_lib_libipx} \
1022     lib/libkiconv lib/libkvm lib/libmd \
1023     lib/ncurses/ncurses lib/ncurses/ncursesw \
1024     lib/libopie lib/libpam ${_default_thread_lib} \
1025     lib/libradius lib/libsbuf lib/libtacplus lib/libutil \
1026     ${_lib_libypclnt} lib/libz lib/msun \
1027     ${_secure_lib_libcrypto} ${_secure_lib_libssh} \
1028     ${_secure_lib_libssl}
1029 laffer1 2
1030 laffer1 1926 .if ${MK_LIBTHR} != "no" && ${MK_LIBKSE} != "no"
1031     _default_thread_lib= lib/${DEFAULT_THREAD_LIB}
1032     .elif ${MK_LIBTHR} != "no"
1033     _default_thread_lib= lib/libthr
1034     .elif ${MK_LIBKSE} != "no"
1035     _default_thread_lib= lib/libkse
1036 laffer1 2 .endif
1037    
1038 laffer1 1926 _generic_libs= ${_cddl_lib} gnu/lib ${_kerberos5_lib} lib ${_secure_lib} usr.bin/lex/lib
1039 laffer1 2
1040     lib/libopie__L lib/libtacplus__L: lib/libmd__L
1041    
1042 laffer1 1926 .if ${MK_CDDL} != "no"
1043     _cddl_lib= cddl/lib
1044     .endif
1045 laffer1 2
1046 laffer1 1926 .if ${MK_CRYPT} != "no"
1047     .if ${MK_OPENSSL} != "no"
1048     _secure_lib_libcrypto= secure/lib/libcrypto
1049     _secure_lib_libssl= secure/lib/libssl
1050     lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
1051     .if ${MK_OPENSSH} != "no"
1052     _secure_lib_libssh= secure/lib/libssh
1053     secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1054     .if ${MK_KERBEROS} != "no"
1055     secure/lib/libssh__L: lib/libgssapi__L kerberos5/lib/libkrb5__L \
1056     kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
1057 laffer1 2 kerberos5/lib/libroken__L
1058     .endif
1059     .endif
1060     .endif
1061 laffer1 1926 _secure_lib= secure/lib
1062 laffer1 2 .endif
1063    
1064 laffer1 1926 .if ${MK_IPX} != "no"
1065     _lib_libipx= lib/libipx
1066     .endif
1067    
1068     .if ${MK_KERBEROS} != "no"
1069     _kerberos5_lib= kerberos5/lib
1070     _kerberos5_lib_libasn1= kerberos5/lib/libasn1
1071     _kerberos5_lib_libkrb5= kerberos5/lib/libkrb5
1072     _kerberos5_lib_libroken= kerberos5/lib/libroken
1073     _lib_libgssapi= lib/libgssapi
1074     .endif
1075    
1076     .if ${MK_NIS} != "no"
1077     _lib_libypclnt= lib/libypclnt
1078     .endif
1079    
1080     .if ${MK_OPENSSL} == "no"
1081 laffer1 2 lib/libradius__L: lib/libmd__L
1082     .endif
1083    
1084 laffer1 1926 .for _lib in ${_prereq_libs}
1085     ${_lib}__PL: .PHONY
1086     .if exists(${.CURDIR}/${_lib})
1087     ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1088     cd ${.CURDIR}/${_lib}; \
1089     ${MAKE} DIRPRFX=${_lib}/ obj; \
1090     ${MAKE} DIRPRFX=${_lib}/ depend; \
1091     ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ all; \
1092     ${MAKE} -DWITHOUT_PROFILE -DNO_PIC DIRPRFX=${_lib}/ install
1093 laffer1 2 .endif
1094 laffer1 1926 .endfor
1095 laffer1 2
1096     .for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1097     ${_lib}__L: .PHONY
1098     .if exists(${.CURDIR}/${_lib})
1099 laffer1 1549 ${_+_}@${ECHODIR} "===> ${_lib} (obj,depend,all,install)"; \
1100 laffer1 2 cd ${.CURDIR}/${_lib}; \
1101 laffer1 1549 ${MAKE} DIRPRFX=${_lib}/ obj; \
1102 laffer1 2 ${MAKE} DIRPRFX=${_lib}/ depend; \
1103     ${MAKE} DIRPRFX=${_lib}/ all; \
1104     ${MAKE} DIRPRFX=${_lib}/ install
1105     .endif
1106     .endfor
1107    
1108     # libpam is special: we need to build static PAM modules before
1109     # static PAM library, and dynamic PAM library before dynamic PAM
1110     # modules.
1111     lib/libpam__L: .PHONY
1112 laffer1 1549 ${_+_}@${ECHODIR} "===> lib/libpam (obj,depend,all,install)"; \
1113 laffer1 2 cd ${.CURDIR}/lib/libpam; \
1114 laffer1 1549 ${MAKE} DIRPRFX=lib/libpam/ obj; \
1115 laffer1 2 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1116     ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1117     ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1118    
1119 laffer1 1926 _prereq_libs: ${_prereq_libs:S/$/__PL/}
1120 laffer1 2 _startup_libs: ${_startup_libs:S/$/__L/}
1121     _prebuild_libs: ${_prebuild_libs:S/$/__L/}
1122     _generic_libs: ${_generic_libs:S/$/__L/}
1123    
1124     .for __target in all clean cleandepend cleandir depend includes obj
1125     .for entry in ${SUBDIR}
1126     ${entry}.${__target}__D: .PHONY
1127     ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1128     ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1129     edir=${entry}.${MACHINE_ARCH}; \
1130     cd ${.CURDIR}/$${edir}; \
1131     else \
1132     ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1133     edir=${entry}; \
1134     cd ${.CURDIR}/$${edir}; \
1135     fi; \
1136     ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1137     .endfor
1138     par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1139     .endfor
1140    
1141     .include <bsd.subdir.mk>
1142 laffer1 5
1143 laffer1 1926 .if make(check-old) || make(check-old-dirs) || \
1144     make(check-old-files) || make(check-old-libs) || \
1145     make(delete-old) || make(delete-old-dirs) || \
1146     make(delete-old-files) || make(delete-old-libs)
1147 laffer1 5
1148     #
1149     # check for / delete old files section
1150     #
1151    
1152     .include "ObsoleteFiles.inc"
1153    
1154     OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
1155     else you can not start such an application. Consult UPDATING for more \
1156     information regarding how to cope with the removal/revision bump of a \
1157     specific library."
1158    
1159     .if !defined(BATCH_DELETE_OLD_FILES)
1160     RM_I=-i
1161     .else
1162     RM_I=-v
1163     .endif
1164    
1165     delete-old-files:
1166     @echo ">>> Removing old files (only deletes safe to delete libs)"
1167     # Ask for every old file if the user really wants to remove it.
1168     # It's annoying, but better safe than sorry.
1169 laffer1 1926 @for file in ${OLD_FILES}; do \
1170     if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1171     chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1172     rm ${RM_I} "${DESTDIR}/$${file}"; \
1173     fi; \
1174     done
1175 laffer1 5 # Remove catpages without corresponding manpages.
1176     @3<&0; \
1177     find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1178     sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1179     while read catpage; do \
1180     read manpage; \
1181     if [ ! -e "$${manpage}" ]; then \
1182     rm ${RM_I} $${catpage} <&3 ; \
1183     fi; \
1184     done
1185     @echo ">>> Old files removed"
1186    
1187     check-old-files:
1188     @echo ">>> Checking for old files"
1189 laffer1 1926 @for file in ${OLD_FILES}; do \
1190     if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1191     echo "${DESTDIR}/$${file}"; \
1192     fi; \
1193     done
1194 laffer1 5 # Check for catpages without corresponding manpages.
1195     @find ${DESTDIR}/usr/share/man/cat* ! -type d | \
1196     sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
1197     while read catpage; do \
1198     read manpage; \
1199     if [ ! -e "$${manpage}" ]; then \
1200     echo $${catpage} ; \
1201     fi; \
1202     done
1203    
1204     delete-old-libs:
1205     @echo ">>> Removing old libraries"
1206     @echo "${OLD_LIBS_MESSAGE}" | fmt
1207 laffer1 1926 @for file in ${OLD_LIBS}; do \
1208     if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1209     chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \
1210     rm ${RM_I} "${DESTDIR}/$${file}"; \
1211     fi; \
1212     done
1213 laffer1 5 @echo ">>> Old libraries removed"
1214    
1215     check-old-libs:
1216     @echo ">>> Checking for old libraries"
1217 laffer1 1926 @for file in ${OLD_LIBS}; do \
1218     if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
1219     echo "${DESTDIR}/$${file}"; \
1220     fi; \
1221     done
1222 laffer1 5
1223     delete-old-dirs:
1224     @echo ">>> Removing old directories"
1225 laffer1 1926 @for dir in ${OLD_DIRS}; do \
1226     if [ -d "${DESTDIR}/$${dir}" ]; then \
1227     rmdir -v "${DESTDIR}/$${dir}" || true; \
1228     elif [ -L "${DESTDIR}/$${dir}" ]; then \
1229     echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1230     fi; \
1231     done
1232 laffer1 5 @echo ">>> Old directories removed"
1233    
1234     check-old-dirs:
1235     @echo ">>> Checking for old directories"
1236 laffer1 1926 @for dir in ${OLD_DIRS}; do \
1237     if [ -d "${DESTDIR}/$${dir}" ]; then \
1238     echo "${DESTDIR}/$${dir}"; \
1239     elif [ -L "${DESTDIR}/$${dir}" ]; then \
1240     echo "${DESTDIR}/$${dir} is a link, please remove everything manually."; \
1241     fi; \
1242     done
1243 laffer1 5
1244     delete-old: delete-old-files delete-old-dirs
1245     @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1246    
1247     check-old: check-old-files check-old-libs check-old-dirs
1248     @echo "To remove old files and directories run '${MAKE} delete-old'."
1249     @echo "To remove old libraries run '${MAKE} delete-old-libs'."
1250    
1251     .endif
1252    
1253 laffer1 1925 #
1254     # showconfig - show build configuration.
1255     #
1256     showconfig:
1257     @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort

Properties

Name Value
cvs2svn:cvs-rev 1.13