ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/Makefile.inc1
Revision: 9688
Committed: Sat Dec 16 17:24:42 2017 UTC (6 years, 4 months ago) by laffer1
File size: 55102 byte(s)
Log Message:
Update libiconv implementation from NetBSD & FreeBSD.

Add compatiblity shim for old binaries (libc_nonshared hack).

Introduce ldscript for libc to allow us to use stack protector on i386 later.

File Contents

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

Properties

Name Value
svn:keywords MidnightBSD=%H