Deleted Added
full compact
Makefile.inc1 (136910) Makefile.inc1 (137288)
1#
1#
2# $FreeBSD: head/Makefile.inc1 136910 2004-10-24 15:33:08Z ru $
2# $FreeBSD: head/Makefile.inc1 137288 2004-11-06 03:14:26Z peter $
3#
4# Make command line options:
5# -DNO_DYNAMICROOT do not link /bin and /sbin dynamically
6# -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
7# -DNO_RESCUE do not build rescue binaries
8# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9# -DNOCLEAN do not clean at all
10# -DNOCRYPT will prevent building of crypt versions
11# -DNOMAN do not build the manual pages
12# -DNOPROFILE do not build profiled libraries
13# -DNOGAMES do not go into games subdir
14# -DNOSHARE do not go into share subdir
15# -DNOINFO do not make or install info files
16# -DNOLIBC_R do not build libc_r.
17# -DNO_FORTRAN do not build g77 and related libraries.
18# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
19# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
20# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
21# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
22# -DNO_DOCUPDATE do not update doc in ${MAKE} update
23# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
24# TARGET_ARCH="arch" to crossbuild world to a different arch
25
26#
27# The intended user-driven targets are:
28# buildworld - rebuild *everything*, including glue to help do upgrades
29# installworld- install everything built by "buildworld"
30# update - convenient way to update your source tree (eg: sup/cvs)
31#
32# Standard targets (not defined here) are documented in the makefiles in
33# /usr/share/mk. These include:
34# obj depend all install clean cleandepend cleanobj
35
36# We must do share/info early so that installation of info `dir'
37# entries works correctly. Do it first since it is less likely to
38# grow dependencies on include and lib than vice versa.
39#
40# We must do lib and libexec before bin, because if installworld
41# installs a new /bin/sh, the 'make' command will *immediately*
42# use that new version. And the new (dynamically-linked) /bin/sh
43# will expect to find appropriate libraries in /lib and /libexec.
44#
45# We must do etc last for install/distribute to work.
46#
47SUBDIR= share/info include lib libexec bin
48.if !defined(NOGAMES)
49SUBDIR+=games
50.endif
51SUBDIR+=gnu
52.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
53SUBDIR+=kerberos5
54.endif
55.if !defined(NO_RESCUE)
56SUBDIR+=rescue
57.endif
58SUBDIR+=sbin
59.if !defined(NOCRYPT)
60SUBDIR+=secure
61.endif
62.if !defined(NOSHARE)
63SUBDIR+=share
64.endif
65SUBDIR+=sys usr.bin usr.sbin etc
66
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)
71SUBDIR+= ${_DIR}
72.endif
73.endfor
74
75.if defined(SUBDIR_OVERRIDE)
76SUBDIR= ${SUBDIR_OVERRIDE}
77.endif
78
79.if defined(NOCLEANDIR)
80CLEANDIR= clean cleandepend
81.else
82CLEANDIR= cleandir
83.endif
84
85CVS?= cvs
86CVSFLAGS?= -A -P -d
87SUP?= /usr/local/bin/cvsup
88SUPFLAGS?= -g -L 2 -P -
89.if defined(SUPHOST)
90SUPFLAGS+= -h ${SUPHOST}
91.endif
92
93MAKEOBJDIRPREFIX?= /usr/obj
94.if !defined(OSRELDATE)
95.if exists(/usr/include/osreldate.h)
96OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
97 /usr/include/osreldate.h
98.else
99OSRELDATE= 0
100.endif
101.endif
102TARGET_ARCH?= ${MACHINE_ARCH}
103.if ${TARGET_ARCH} == ${MACHINE_ARCH}
104TARGET?= ${MACHINE}
105TARGET_CPUTYPE?=${CPUTYPE}
106.else
107TARGET?= ${TARGET_ARCH}
108TARGET_CPUTYPE?=
109.endif
110.if !empty(TARGET_CPUTYPE)
111_TARGET_CPUTYPE=${TARGET_CPUTYPE}
112.else
113_TARGET_CPUTYPE=dummy
114.endif
115_CPUTYPE!= MAKEFLAGS= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
116 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
117.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
118.error CPUTYPE global should be set with ?=.
119.endif
120.if make(buildworld)
121BUILD_ARCH!= sysctl -n hw.machine_arch
122.if ${MACHINE_ARCH} != ${BUILD_ARCH}
123.error To cross-build, set TARGET_ARCH.
124.endif
125.endif
126.if ${MACHINE} == ${TARGET}
127OBJTREE= ${MAKEOBJDIRPREFIX}
128.else
129OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
130.endif
131WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
132# /usr/games added for fortune which depend on strfile
133BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
134XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
135STRICTTMPPATH= ${BPATH}:${XPATH}
136TMPPATH= ${STRICTTMPPATH}:${PATH}
137
138INSTALLTMP!= /usr/bin/mktemp -d -u -t install
139
140#
141# Building a world goes through the following stages
142#
143# 1. legacy stage [BMAKE]
144# This stage is responsible for creating compatibility
145# shims that are needed by the bootstrap-tools,
146# build-tools and cross-tools stages.
147# 1. bootstrap-tools stage [BMAKE]
148# This stage is responsible for creating programs that
149# are needed for backward compatibility reasons. They
150# are not built as cross-tools.
151# 2. build-tools stage [TMAKE]
152# This stage is responsible for creating the object
153# tree and building any tools that are needed during
154# the build process.
155# 3. cross-tools stage [XMAKE]
156# This stage is responsible for creating any tools that
157# are needed for cross-builds. A cross-compiler is one
158# of them.
159# 4. world stage [WMAKE]
160# This stage actually builds the world.
161# 5. install stage (optional) [IMAKE]
162# This stage installs a previously built world.
163#
164
165BOOTSTRAPPING?= 0
166
167# Common environment for world related stages
168CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
169 MACHINE_ARCH=${TARGET_ARCH} \
170 MACHINE=${TARGET} \
171 CPUTYPE=${TARGET_CPUTYPE} \
172 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
173 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
174 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
175
176# bootstrap-tools stage
177BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
178 PATH=${BPATH}:${PATH} \
179 WORLDTMP=${WORLDTMP} \
180 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
181BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
182 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
183 DESTDIR= \
184 BOOTSTRAPPING=${OSRELDATE} \
185 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
186 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
187
188# build-tools stage
189TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
190 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
191 DESTDIR= \
192 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
193
194# cross-tools stage
195XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
196
197# world stage
198WMAKEENV= ${CROSSENV} \
199 _SHLIBDIRPREFIX=${WORLDTMP} \
200 INSTALL="sh ${.CURDIR}/tools/install.sh" \
201 PATH=${TMPPATH}
202WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
203
3#
4# Make command line options:
5# -DNO_DYNAMICROOT do not link /bin and /sbin dynamically
6# -DNO_KERBEROS Do not build Heimdal (Kerberos 5)
7# -DNO_RESCUE do not build rescue binaries
8# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
9# -DNOCLEAN do not clean at all
10# -DNOCRYPT will prevent building of crypt versions
11# -DNOMAN do not build the manual pages
12# -DNOPROFILE do not build profiled libraries
13# -DNOGAMES do not go into games subdir
14# -DNOSHARE do not go into share subdir
15# -DNOINFO do not make or install info files
16# -DNOLIBC_R do not build libc_r.
17# -DNO_FORTRAN do not build g77 and related libraries.
18# -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
19# -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
20# -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
21# -DNO_PORTSUPDATE do not update ports in ${MAKE} update
22# -DNO_DOCUPDATE do not update doc in ${MAKE} update
23# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
24# TARGET_ARCH="arch" to crossbuild world to a different arch
25
26#
27# The intended user-driven targets are:
28# buildworld - rebuild *everything*, including glue to help do upgrades
29# installworld- install everything built by "buildworld"
30# update - convenient way to update your source tree (eg: sup/cvs)
31#
32# Standard targets (not defined here) are documented in the makefiles in
33# /usr/share/mk. These include:
34# obj depend all install clean cleandepend cleanobj
35
36# We must do share/info early so that installation of info `dir'
37# entries works correctly. Do it first since it is less likely to
38# grow dependencies on include and lib than vice versa.
39#
40# We must do lib and libexec before bin, because if installworld
41# installs a new /bin/sh, the 'make' command will *immediately*
42# use that new version. And the new (dynamically-linked) /bin/sh
43# will expect to find appropriate libraries in /lib and /libexec.
44#
45# We must do etc last for install/distribute to work.
46#
47SUBDIR= share/info include lib libexec bin
48.if !defined(NOGAMES)
49SUBDIR+=games
50.endif
51SUBDIR+=gnu
52.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
53SUBDIR+=kerberos5
54.endif
55.if !defined(NO_RESCUE)
56SUBDIR+=rescue
57.endif
58SUBDIR+=sbin
59.if !defined(NOCRYPT)
60SUBDIR+=secure
61.endif
62.if !defined(NOSHARE)
63SUBDIR+=share
64.endif
65SUBDIR+=sys usr.bin usr.sbin etc
66
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)
71SUBDIR+= ${_DIR}
72.endif
73.endfor
74
75.if defined(SUBDIR_OVERRIDE)
76SUBDIR= ${SUBDIR_OVERRIDE}
77.endif
78
79.if defined(NOCLEANDIR)
80CLEANDIR= clean cleandepend
81.else
82CLEANDIR= cleandir
83.endif
84
85CVS?= cvs
86CVSFLAGS?= -A -P -d
87SUP?= /usr/local/bin/cvsup
88SUPFLAGS?= -g -L 2 -P -
89.if defined(SUPHOST)
90SUPFLAGS+= -h ${SUPHOST}
91.endif
92
93MAKEOBJDIRPREFIX?= /usr/obj
94.if !defined(OSRELDATE)
95.if exists(/usr/include/osreldate.h)
96OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \
97 /usr/include/osreldate.h
98.else
99OSRELDATE= 0
100.endif
101.endif
102TARGET_ARCH?= ${MACHINE_ARCH}
103.if ${TARGET_ARCH} == ${MACHINE_ARCH}
104TARGET?= ${MACHINE}
105TARGET_CPUTYPE?=${CPUTYPE}
106.else
107TARGET?= ${TARGET_ARCH}
108TARGET_CPUTYPE?=
109.endif
110.if !empty(TARGET_CPUTYPE)
111_TARGET_CPUTYPE=${TARGET_CPUTYPE}
112.else
113_TARGET_CPUTYPE=dummy
114.endif
115_CPUTYPE!= MAKEFLAGS= ${MAKE} -f /dev/null -m ${.CURDIR}/share/mk \
116 CPUTYPE=${_TARGET_CPUTYPE} -V CPUTYPE
117.if ${_CPUTYPE} != ${_TARGET_CPUTYPE}
118.error CPUTYPE global should be set with ?=.
119.endif
120.if make(buildworld)
121BUILD_ARCH!= sysctl -n hw.machine_arch
122.if ${MACHINE_ARCH} != ${BUILD_ARCH}
123.error To cross-build, set TARGET_ARCH.
124.endif
125.endif
126.if ${MACHINE} == ${TARGET}
127OBJTREE= ${MAKEOBJDIRPREFIX}
128.else
129OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}
130.endif
131WORLDTMP= ${OBJTREE}${.CURDIR}/${MACHINE_ARCH}
132# /usr/games added for fortune which depend on strfile
133BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/usr/games
134XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
135STRICTTMPPATH= ${BPATH}:${XPATH}
136TMPPATH= ${STRICTTMPPATH}:${PATH}
137
138INSTALLTMP!= /usr/bin/mktemp -d -u -t install
139
140#
141# Building a world goes through the following stages
142#
143# 1. legacy stage [BMAKE]
144# This stage is responsible for creating compatibility
145# shims that are needed by the bootstrap-tools,
146# build-tools and cross-tools stages.
147# 1. bootstrap-tools stage [BMAKE]
148# This stage is responsible for creating programs that
149# are needed for backward compatibility reasons. They
150# are not built as cross-tools.
151# 2. build-tools stage [TMAKE]
152# This stage is responsible for creating the object
153# tree and building any tools that are needed during
154# the build process.
155# 3. cross-tools stage [XMAKE]
156# This stage is responsible for creating any tools that
157# are needed for cross-builds. A cross-compiler is one
158# of them.
159# 4. world stage [WMAKE]
160# This stage actually builds the world.
161# 5. install stage (optional) [IMAKE]
162# This stage installs a previously built world.
163#
164
165BOOTSTRAPPING?= 0
166
167# Common environment for world related stages
168CROSSENV= MAKEOBJDIRPREFIX=${OBJTREE} \
169 MACHINE_ARCH=${TARGET_ARCH} \
170 MACHINE=${TARGET} \
171 CPUTYPE=${TARGET_CPUTYPE} \
172 GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \
173 GROFF_FONT_PATH=${WORLDTMP}/legacy/usr/share/groff_font \
174 GROFF_TMAC_PATH=${WORLDTMP}/legacy/usr/share/tmac
175
176# bootstrap-tools stage
177BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
178 PATH=${BPATH}:${PATH} \
179 WORLDTMP=${WORLDTMP} \
180 MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"
181BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
182 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
183 DESTDIR= \
184 BOOTSTRAPPING=${OSRELDATE} \
185 -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE \
186 -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS
187
188# build-tools stage
189TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
190 ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
191 DESTDIR= \
192 BOOTSTRAPPING=${OSRELDATE} -DNOLINT -DNO_CPU_CFLAGS -DNO_WARNS
193
194# cross-tools stage
195XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
196
197# world stage
198WMAKEENV= ${CROSSENV} \
199 _SHLIBDIRPREFIX=${WORLDTMP} \
200 INSTALL="sh ${.CURDIR}/tools/install.sh" \
201 PATH=${TMPPATH}
202WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
203
204.if ${MACHINE_ARCH} == amd64
205# 32 bit world
206LIB32TMP= ${OBJTREE}${.CURDIR}/lib32
207
208LIB32PREFLAGS= -m32 -march=athlon-xp -msse2 -mfancy-math-387 -DCOMPAT_32BIT
209LIB32POSTFLAGS= -I${LIB32TMP}/usr/include \
210 -L${LIB32TMP}/usr/lib32 \
211 -B${LIB32TMP}/usr/lib32
212LIB32CC= ${LIB32PREFLAGS} \
213 ${LIB32POSTFLAGS}
214LIB32CXX= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/c++/3.4 \
215 ${LIB32POSTFLAGS}
216LIB32OBJC= ${LIB32PREFLAGS} -I${LIB32TMP}/usr/include/objc \
217 ${LIB32POSTFLAGS}
218
219# Yes, the flags are redundant.
220LIB32MAKEENV= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \
221 _SHLIBDIRPREFIX=${LIB32TMP} \
222 MACHINE_ARCH=i386 \
223 INSTALL="sh ${.CURDIR}/tools/install.sh" \
224 PATH=${TMPPATH} \
225 CC="cc ${LIB32CC}" \
226 CXX="c++ ${LIB32CXX}" \
227 OBJC="cc ${LIB32OBJC}" \
228 LD="ld -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
229 AS="as --32" \
230 LIBDIR=/usr/lib32 \
231 SHLIBDIR=/usr/lib32
232
233LIB32MAKE= ${LIB32MAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \
234 -DNO_BIND -DNOMAN -DNODOC -DNOINFO -DNOHTML \
235 CC="cc ${LIB32CC}" \
236 CXX="c++ ${LIB32CXX}" \
237 OBJC="cc ${LIB32OBJC}" \
238 LD="ld -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \
239 AS="as --32" \
240 LIBDIR=/usr/lib32 \
241 SHLIBDIR=/usr/lib32
242.endif
243
204# install stage
205.if empty(.MAKEFLAGS:M-n)
206IMAKEENV= ${CROSSENV} \
207 PATH=${STRICTTMPPATH}:${INSTALLTMP}
208.else
209IMAKEENV= ${CROSSENV} \
210 PATH=${TMPPATH}:${INSTALLTMP}
211.endif
212IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
213
214# kernel stage
215KMAKEENV= ${WMAKEENV}
216
217#
218# buildworld
219#
220# Attempt to rebuild the entire system, with reasonable chance of
221# success, regardless of how old your existing system is.
222#
223_worldtmp:
224.if ${.CURDIR:C/[^,]//g} != ""
225# The m4 build of sendmail files doesn't like it if ',' is used
226# anywhere in the path of it's files.
227 @echo
228 @echo "*** Error: path to source tree contains a comma ','"
229 @echo
230 false
231.endif
232 @echo
233 @echo "--------------------------------------------------------------"
234 @echo ">>> Rebuilding the temporary build tree"
235 @echo "--------------------------------------------------------------"
236.if !defined(NOCLEAN)
237 rm -rf ${WORLDTMP}
238.else
239 rm -rf ${WORLDTMP}/legacy/usr/include
240 # XXX - These two can depend on any header file.
241 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
242 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
243.endif
244.for _dir in \
245 usr/bin usr/games usr/include/c++/3.4 usr/include/sys usr/lib \
246 usr/libexec usr/sbin usr/share/dict \
247 usr/share/groff_font/devX100 \
248 usr/share/groff_font/devX100-12 \
249 usr/share/groff_font/devX75 \
250 usr/share/groff_font/devX75-12 \
251 usr/share/groff_font/devascii \
252 usr/share/groff_font/devcp1047 \
253 usr/share/groff_font/devdvi \
254 usr/share/groff_font/devhtml \
255 usr/share/groff_font/devkoi8-r \
256 usr/share/groff_font/devlatin1 \
257 usr/share/groff_font/devlbp \
258 usr/share/groff_font/devlj4 \
259 usr/share/groff_font/devps \
260 usr/share/groff_font/devutf8 \
261 usr/share/tmac/mdoc usr/share/tmac/mm
262 mkdir -p ${WORLDTMP}/legacy/${_dir}
263.endfor
264.for _dir in \
265 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
266 usr/libexec usr/sbin usr/share/misc \
267 usr/share/snmp/defs usr/share/snmp/mibs
268 mkdir -p ${WORLDTMP}/${_dir}
269.endfor
270 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
271 -p ${WORLDTMP}/usr/include >/dev/null
272 ln -sf ${.CURDIR}/sys ${WORLDTMP}
273.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
274 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
275 -p ${WORLDTMP}/usr/include >/dev/null
276.endif
277_legacy:
278 @echo
279 @echo "--------------------------------------------------------------"
280 @echo ">>> stage 1.1: legacy release compatibility shims"
281 @echo "--------------------------------------------------------------"
282 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
283_bootstrap-tools:
284 @echo
285 @echo "--------------------------------------------------------------"
286 @echo ">>> stage 1.2: bootstrap tools"
287 @echo "--------------------------------------------------------------"
288 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
289_cleanobj:
290.if !defined(NOCLEAN)
291 @echo
292 @echo "--------------------------------------------------------------"
293 @echo ">>> stage 2.1: cleaning up the object tree"
294 @echo "--------------------------------------------------------------"
295 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
296.endif
297_obj:
298 @echo
299 @echo "--------------------------------------------------------------"
300 @echo ">>> stage 2.2: rebuilding the object tree"
301 @echo "--------------------------------------------------------------"
302 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
303_build-tools:
304 @echo
305 @echo "--------------------------------------------------------------"
306 @echo ">>> stage 2.3: build tools"
307 @echo "--------------------------------------------------------------"
308 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
309_cross-tools:
310 @echo
311 @echo "--------------------------------------------------------------"
312 @echo ">>> stage 3: cross tools"
313 @echo "--------------------------------------------------------------"
314 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
315_includes:
316 @echo
317 @echo "--------------------------------------------------------------"
318 @echo ">>> stage 4.1: building includes"
319 @echo "--------------------------------------------------------------"
320 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
321_libraries:
322 @echo
323 @echo "--------------------------------------------------------------"
324 @echo ">>> stage 4.2: building libraries"
325 @echo "--------------------------------------------------------------"
326 ${_+_}cd ${.CURDIR}; \
327 ${WMAKE} -DNOFSCHG -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPROFILE \
328 libraries
329_depend:
330 @echo
331 @echo "--------------------------------------------------------------"
332 @echo ">>> stage 4.3: make dependencies"
333 @echo "--------------------------------------------------------------"
334 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
335everything:
336 @echo
337 @echo "--------------------------------------------------------------"
338 @echo ">>> stage 4.4: building everything"
339 @echo "--------------------------------------------------------------"
340 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
244# install stage
245.if empty(.MAKEFLAGS:M-n)
246IMAKEENV= ${CROSSENV} \
247 PATH=${STRICTTMPPATH}:${INSTALLTMP}
248.else
249IMAKEENV= ${CROSSENV} \
250 PATH=${TMPPATH}:${INSTALLTMP}
251.endif
252IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
253
254# kernel stage
255KMAKEENV= ${WMAKEENV}
256
257#
258# buildworld
259#
260# Attempt to rebuild the entire system, with reasonable chance of
261# success, regardless of how old your existing system is.
262#
263_worldtmp:
264.if ${.CURDIR:C/[^,]//g} != ""
265# The m4 build of sendmail files doesn't like it if ',' is used
266# anywhere in the path of it's files.
267 @echo
268 @echo "*** Error: path to source tree contains a comma ','"
269 @echo
270 false
271.endif
272 @echo
273 @echo "--------------------------------------------------------------"
274 @echo ">>> Rebuilding the temporary build tree"
275 @echo "--------------------------------------------------------------"
276.if !defined(NOCLEAN)
277 rm -rf ${WORLDTMP}
278.else
279 rm -rf ${WORLDTMP}/legacy/usr/include
280 # XXX - These two can depend on any header file.
281 rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
282 rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
283.endif
284.for _dir in \
285 usr/bin usr/games usr/include/c++/3.4 usr/include/sys usr/lib \
286 usr/libexec usr/sbin usr/share/dict \
287 usr/share/groff_font/devX100 \
288 usr/share/groff_font/devX100-12 \
289 usr/share/groff_font/devX75 \
290 usr/share/groff_font/devX75-12 \
291 usr/share/groff_font/devascii \
292 usr/share/groff_font/devcp1047 \
293 usr/share/groff_font/devdvi \
294 usr/share/groff_font/devhtml \
295 usr/share/groff_font/devkoi8-r \
296 usr/share/groff_font/devlatin1 \
297 usr/share/groff_font/devlbp \
298 usr/share/groff_font/devlj4 \
299 usr/share/groff_font/devps \
300 usr/share/groff_font/devutf8 \
301 usr/share/tmac/mdoc usr/share/tmac/mm
302 mkdir -p ${WORLDTMP}/legacy/${_dir}
303.endfor
304.for _dir in \
305 lib usr/bin usr/include usr/lib/compat/aout usr/libdata/ldscripts \
306 usr/libexec usr/sbin usr/share/misc \
307 usr/share/snmp/defs usr/share/snmp/mibs
308 mkdir -p ${WORLDTMP}/${_dir}
309.endfor
310 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
311 -p ${WORLDTMP}/usr/include >/dev/null
312 ln -sf ${.CURDIR}/sys ${WORLDTMP}
313.if defined(WITH_BIND_LIBS) && !defined(NO_BIND)
314 mtree -deU -f ${.CURDIR}/etc/mtree/BIND.include.dist \
315 -p ${WORLDTMP}/usr/include >/dev/null
316.endif
317_legacy:
318 @echo
319 @echo "--------------------------------------------------------------"
320 @echo ">>> stage 1.1: legacy release compatibility shims"
321 @echo "--------------------------------------------------------------"
322 ${_+_}cd ${.CURDIR}; ${BMAKE} legacy
323_bootstrap-tools:
324 @echo
325 @echo "--------------------------------------------------------------"
326 @echo ">>> stage 1.2: bootstrap tools"
327 @echo "--------------------------------------------------------------"
328 ${_+_}cd ${.CURDIR}; ${BMAKE} bootstrap-tools
329_cleanobj:
330.if !defined(NOCLEAN)
331 @echo
332 @echo "--------------------------------------------------------------"
333 @echo ">>> stage 2.1: cleaning up the object tree"
334 @echo "--------------------------------------------------------------"
335 ${_+_}cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/}
336.endif
337_obj:
338 @echo
339 @echo "--------------------------------------------------------------"
340 @echo ">>> stage 2.2: rebuilding the object tree"
341 @echo "--------------------------------------------------------------"
342 ${_+_}cd ${.CURDIR}; ${WMAKE} par-obj
343_build-tools:
344 @echo
345 @echo "--------------------------------------------------------------"
346 @echo ">>> stage 2.3: build tools"
347 @echo "--------------------------------------------------------------"
348 ${_+_}cd ${.CURDIR}; ${TMAKE} build-tools
349_cross-tools:
350 @echo
351 @echo "--------------------------------------------------------------"
352 @echo ">>> stage 3: cross tools"
353 @echo "--------------------------------------------------------------"
354 ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools
355_includes:
356 @echo
357 @echo "--------------------------------------------------------------"
358 @echo ">>> stage 4.1: building includes"
359 @echo "--------------------------------------------------------------"
360 ${_+_}cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes
361_libraries:
362 @echo
363 @echo "--------------------------------------------------------------"
364 @echo ">>> stage 4.2: building libraries"
365 @echo "--------------------------------------------------------------"
366 ${_+_}cd ${.CURDIR}; \
367 ${WMAKE} -DNOFSCHG -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPROFILE \
368 libraries
369_depend:
370 @echo
371 @echo "--------------------------------------------------------------"
372 @echo ">>> stage 4.3: make dependencies"
373 @echo "--------------------------------------------------------------"
374 ${_+_}cd ${.CURDIR}; ${WMAKE} par-depend
375everything:
376 @echo
377 @echo "--------------------------------------------------------------"
378 @echo ">>> stage 4.4: building everything"
379 @echo "--------------------------------------------------------------"
380 ${_+_}cd ${.CURDIR}; ${WMAKE} par-all
381.if ${MACHINE_ARCH} == amd64
382build32:
383 @echo
384 @echo "--------------------------------------------------------------"
385 @echo ">>> stage 5.1: building 32 bit shim libraries"
386 @echo "--------------------------------------------------------------"
387.for _dir in \
388 lib lib32 usr/bin usr/include usr/lib32 usr/libdata/ldscripts \
389 usr/libexec usr/sbin usr/share/misc \
390 usr/share/snmp/defs usr/share/snmp/mibs
391 mkdir -p ${LIB32TMP}/${_dir}
392.endfor
393 mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
394 -p ${LIB32TMP}/usr/include >/dev/null
395 ln -sf ${.CURDIR}/sys ${WORLDTMP}
396.for _t in obj includes
397 cd ${.CURDIR}/include; \
398 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
399 cd ${.CURDIR}/lib; \
400 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
401 cd ${.CURDIR}/gnu/lib; \
402 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
403.if !defined(NOCRYPT)
404 cd ${.CURDIR}/secure/lib; \
405 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
406.endif
407.endfor
408.for _dir in lib/libncurses lib/libmagic
409 cd ${.CURDIR}/${_dir}; \
410 MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} build-tools
411.endfor
412 cd ${.CURDIR}; \
413 ${LIB32MAKE} -f Makefile.inc1 DESTDIR=${LIB32TMP} libraries
414.for _t in obj depend all
415 cd ${.CURDIR}/libexec/rtld-elf; \
416 PROG=ld-elf32.so.1 ${LIB32MAKE} DESTDIR=${LIB32TMP} ${_t}
417.endfor
341
418
419install32:
420 mkdir -p ${DESTDIR}/usr/lib32 # XXX add to mtree
421 cd ${.CURDIR}/lib; ${LIB32MAKE} install
422 cd ${.CURDIR}/gnu/lib; ${LIB32MAKE} install
423.if !defined(NOCRYPT)
424 cd ${.CURDIR}/secure/lib; ${LIB32MAKE} install
425.endif
426 cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIB32MAKE} install
427.endif
342
428
429
343WMAKE_TGTS=
344.if !defined(SUBDIR_OVERRIDE)
345WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
346.endif
347WMAKE_TGTS+= _cleanobj _obj _build-tools
348.if !defined(SUBDIR_OVERRIDE)
349WMAKE_TGTS+= _cross-tools
350.endif
351WMAKE_TGTS+= _includes _libraries _depend everything
430WMAKE_TGTS=
431.if !defined(SUBDIR_OVERRIDE)
432WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
433.endif
434WMAKE_TGTS+= _cleanobj _obj _build-tools
435.if !defined(SUBDIR_OVERRIDE)
436WMAKE_TGTS+= _cross-tools
437.endif
438WMAKE_TGTS+= _includes _libraries _depend everything
439.if ${MACHINE_ARCH} == amd64 && defined(WANT_LIB32)
440WMAKE_TGTS+= build32
441.endif
352
353buildworld: ${WMAKE_TGTS}
354.ORDER: ${WMAKE_TGTS}
355
356TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything}
357toolchain: ${TOOLCHAIN_TGTS}
358kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
359
360#
361# Use this to add checks to installworld/installkernel targets.
362#
363SPECIAL_INSTALLCHECKS=
364
365#
366# The following install-time check will see if the installation will
367# change the type used for time_t, and if it will, the target makes
368# sure that the user is expecting to make that change.
369#
370.if ${TARGET_ARCH} == "sparc64"
371SPECIAL_INSTALLCHECKS+=sparc64_installcheck
372
373CUR_TIMET!= grep __time_t /usr/include/machine/_types.h | awk '{print $$2}'
374SRC_TIMET!= grep __time_t ${.CURDIR}/sys/sparc64/include/_types.h | \
375 awk '{print $$2}'
376NEWSPARC_TIMETYPE?=${CUR_TIMET}
377
378sparc64_installcheck:
379.if ${CUR_TIMET} != ${SRC_TIMET}
380 @echo
381.if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
382 @echo "*** ERROR: This target would change the type used for time_t!"
383.else
384 @echo "* Note: This installation changes the type used for time_t."
385.endif
386 @echo "* "
387 @echo "* This host has time_t defined as ${CUR_TIMET},"
388 @echo "* and this installation would change that to type ${SRC_TIMET}."
389.if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
390 @echo "* "
391 @echo "* If that is *NOT* what you wanted, then you need to change the"
392 @echo "* typedef of __time_t in ${.CURDIR}/sys/sparc64/include/_types.h"
393 @echo "* from '${SRC_TIMET}' to '${CUR_TIMET}'. After that you *MUST*"
394 @echo "* do a complete cleanworld, buildworld, buildkernel before you"
395 @echo "* retry the 'make' command. Also read /usr/src/UPDATING.64BTT."
396 @echo "* "
397 @echo "* If that *is* what you want, then enter the commands:"
398 @echo " NEWSPARC_TIMETYPE=${SRC_TIMET}"
399 @echo " export NEWSPARC_TIMETYPE"
400 @echo "* and repeat your 'make' command."
401 @echo
402 false
403.endif
404 @echo
405.elif ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
406 @echo
407 @echo "*** ERROR: NEWSPARC_TIMETYPE is set to '${NEWSPARC_TIMETYPE}'"
408 @echo "*** but ${.CURDIR}/sys/sparc64/include/_types.h"
409 @echo "*** has __time_t defined as '${SRC_TIMET}'."
410 false
411.else
412 @# in sparc64_installcheck, all TIMETYPEs == '${CUR_TIMET}'
413.endif
414.endif
415
416#
417# installcheck
418#
419# Checks to be sure system is ready for installworld
420#
421CHECK_UIDS=
422CHECK_GIDS=
423.if !defined(NO_SENDMAIL)
424CHECK_UIDS+= smmsp
425CHECK_GIDS+= smmsp
426.endif
427.if !defined(NO_PF)
428CHECK_UIDS+= proxy
429CHECK_GIDS+= proxy authpf
430.endif
431installcheck: ${SPECIAL_INSTALLCHECKS}
432.for uid in ${CHECK_UIDS}
433 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
434 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
435 false; \
436 fi
437.endfor
438.for gid in ${CHECK_GIDS}
439 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
440 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
441 false; \
442 fi
443.endfor
444
445#
446# distributeworld
447#
448# Distributes everything compiled by a `buildworld'.
449#
450# installworld
451#
452# Installs everything compiled by a 'buildworld'.
453#
454distributeworld installworld: installcheck
455 mkdir -p ${INSTALLTMP}
456 for prog in [ awk cap_mkdb cat chflags chmod chown \
457 date echo egrep find grep \
458 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
459 test true uname wc zic; do \
460 cp `which $$prog` ${INSTALLTMP}; \
461 done
462 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
463 rm -rf ${INSTALLTMP}
464
465#
466# reinstall
467#
468# If you have a build server, you can NFS mount the source and obj directories
469# and do a 'make reinstall' on the *client* to install new binaries from the
470# most recent server build.
471#
472reinstall: ${SPECIAL_INSTALLCHECKS}
473 @echo "--------------------------------------------------------------"
474 @echo ">>> Making hierarchy"
475 @echo "--------------------------------------------------------------"
476 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
477 @echo
478 @echo "--------------------------------------------------------------"
479 @echo ">>> Installing everything"
480 @echo "--------------------------------------------------------------"
481 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
442
443buildworld: ${WMAKE_TGTS}
444.ORDER: ${WMAKE_TGTS}
445
446TOOLCHAIN_TGTS= ${WMAKE_TGTS:N_depend:Neverything}
447toolchain: ${TOOLCHAIN_TGTS}
448kernel-toolchain: ${TOOLCHAIN_TGTS:N_includes:N_libraries}
449
450#
451# Use this to add checks to installworld/installkernel targets.
452#
453SPECIAL_INSTALLCHECKS=
454
455#
456# The following install-time check will see if the installation will
457# change the type used for time_t, and if it will, the target makes
458# sure that the user is expecting to make that change.
459#
460.if ${TARGET_ARCH} == "sparc64"
461SPECIAL_INSTALLCHECKS+=sparc64_installcheck
462
463CUR_TIMET!= grep __time_t /usr/include/machine/_types.h | awk '{print $$2}'
464SRC_TIMET!= grep __time_t ${.CURDIR}/sys/sparc64/include/_types.h | \
465 awk '{print $$2}'
466NEWSPARC_TIMETYPE?=${CUR_TIMET}
467
468sparc64_installcheck:
469.if ${CUR_TIMET} != ${SRC_TIMET}
470 @echo
471.if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
472 @echo "*** ERROR: This target would change the type used for time_t!"
473.else
474 @echo "* Note: This installation changes the type used for time_t."
475.endif
476 @echo "* "
477 @echo "* This host has time_t defined as ${CUR_TIMET},"
478 @echo "* and this installation would change that to type ${SRC_TIMET}."
479.if ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
480 @echo "* "
481 @echo "* If that is *NOT* what you wanted, then you need to change the"
482 @echo "* typedef of __time_t in ${.CURDIR}/sys/sparc64/include/_types.h"
483 @echo "* from '${SRC_TIMET}' to '${CUR_TIMET}'. After that you *MUST*"
484 @echo "* do a complete cleanworld, buildworld, buildkernel before you"
485 @echo "* retry the 'make' command. Also read /usr/src/UPDATING.64BTT."
486 @echo "* "
487 @echo "* If that *is* what you want, then enter the commands:"
488 @echo " NEWSPARC_TIMETYPE=${SRC_TIMET}"
489 @echo " export NEWSPARC_TIMETYPE"
490 @echo "* and repeat your 'make' command."
491 @echo
492 false
493.endif
494 @echo
495.elif ${NEWSPARC_TIMETYPE} != ${SRC_TIMET}
496 @echo
497 @echo "*** ERROR: NEWSPARC_TIMETYPE is set to '${NEWSPARC_TIMETYPE}'"
498 @echo "*** but ${.CURDIR}/sys/sparc64/include/_types.h"
499 @echo "*** has __time_t defined as '${SRC_TIMET}'."
500 false
501.else
502 @# in sparc64_installcheck, all TIMETYPEs == '${CUR_TIMET}'
503.endif
504.endif
505
506#
507# installcheck
508#
509# Checks to be sure system is ready for installworld
510#
511CHECK_UIDS=
512CHECK_GIDS=
513.if !defined(NO_SENDMAIL)
514CHECK_UIDS+= smmsp
515CHECK_GIDS+= smmsp
516.endif
517.if !defined(NO_PF)
518CHECK_UIDS+= proxy
519CHECK_GIDS+= proxy authpf
520.endif
521installcheck: ${SPECIAL_INSTALLCHECKS}
522.for uid in ${CHECK_UIDS}
523 @if ! `id -u ${uid} >/dev/null 2>&1`; then \
524 echo "ERROR: Required ${uid} user is missing, see /usr/src/UPDATING."; \
525 false; \
526 fi
527.endfor
528.for gid in ${CHECK_GIDS}
529 @if ! `find / -prune -group ${gid} >/dev/null 2>&1`; then \
530 echo "ERROR: Required ${gid} group is missing, see /usr/src/UPDATING."; \
531 false; \
532 fi
533.endfor
534
535#
536# distributeworld
537#
538# Distributes everything compiled by a `buildworld'.
539#
540# installworld
541#
542# Installs everything compiled by a 'buildworld'.
543#
544distributeworld installworld: installcheck
545 mkdir -p ${INSTALLTMP}
546 for prog in [ awk cap_mkdb cat chflags chmod chown \
547 date echo egrep find grep \
548 ln make mkdir mtree mv pwd_mkdb rm sed sh sysctl \
549 test true uname wc zic; do \
550 cp `which $$prog` ${INSTALLTMP}; \
551 done
552 ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}
553 rm -rf ${INSTALLTMP}
554
555#
556# reinstall
557#
558# If you have a build server, you can NFS mount the source and obj directories
559# and do a 'make reinstall' on the *client* to install new binaries from the
560# most recent server build.
561#
562reinstall: ${SPECIAL_INSTALLCHECKS}
563 @echo "--------------------------------------------------------------"
564 @echo ">>> Making hierarchy"
565 @echo "--------------------------------------------------------------"
566 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy
567 @echo
568 @echo "--------------------------------------------------------------"
569 @echo ">>> Installing everything"
570 @echo "--------------------------------------------------------------"
571 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install
572.if ${MACHINE_ARCH} == amd64 && defined(WANT_LIB32)
573 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install32
574.endif
482
483redistribute:
484 @echo "--------------------------------------------------------------"
485 @echo ">>> Distributing everything"
486 @echo "--------------------------------------------------------------"
487 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
488
489#
490# buildkernel and installkernel
491#
492# Which kernels to build and/or install is specified by setting
493# KERNCONF. If not defined a GENERIC kernel is built/installed.
494# Only the existing (depending TARGET) config files are used
495# for building kernels and only the first of these is designated
496# as the one being installed.
497#
498# Note that we have to use TARGET instead of TARGET_ARCH when
499# we're in kernel-land. Since only TARGET_ARCH is (expected) to
500# be set to cross-build, we have to make sure TARGET is set
501# properly.
502
503.if !defined(KERNCONF) && defined(KERNEL)
504KERNCONF= ${KERNEL}
505KERNWARN=
506.else
507KERNCONF?= GENERIC
508.endif
509INSTKERNNAME?= kernel
510
511KERNSRCDIR?= ${.CURDIR}/sys
512KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
513KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
514KERNCONFDIR?= ${KRNLCONFDIR}
515
516BUILDKERNELS=
517INSTALLKERNEL=
518.for _kernel in ${KERNCONF}
519.if exists(${KERNCONFDIR}/${_kernel})
520BUILDKERNELS+= ${_kernel}
521.if empty(INSTALLKERNEL)
522INSTALLKERNEL= ${_kernel}
523.endif
524.endif
525.endfor
526
527#
528# buildkernel
529#
530# Builds all kernels defined by BUILDKERNELS.
531#
532buildkernel:
533.if empty(BUILDKERNELS)
534 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
535 false
536.endif
537.if defined(KERNWARN)
538 @echo "--------------------------------------------------------------"
539 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
540 @echo "--------------------------------------------------------------"
541 @sleep 3
542.endif
543 @echo
544.for _kernel in ${BUILDKERNELS}
545 @echo "--------------------------------------------------------------"
546 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
547 @echo "--------------------------------------------------------------"
548 @echo "===> ${_kernel}"
549 mkdir -p ${KRNLOBJDIR}
550.if !defined(NO_KERNELCONFIG)
551 @echo
552 @echo "--------------------------------------------------------------"
553 @echo ">>> stage 1: configuring the kernel"
554 @echo "--------------------------------------------------------------"
555 cd ${KRNLCONFDIR}; \
556 PATH=${TMPPATH} \
557 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
558 ${KERNCONFDIR}/${_kernel}
559.endif
560.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
561 @echo
562 @echo "--------------------------------------------------------------"
563 @echo ">>> stage 2.1: cleaning up the object tree"
564 @echo "--------------------------------------------------------------"
565 cd ${KRNLOBJDIR}/${_kernel}; \
566 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
567.endif
568 @echo
569 @echo "--------------------------------------------------------------"
570 @echo ">>> stage 2.2: rebuilding the object tree"
571 @echo "--------------------------------------------------------------"
572 cd ${KRNLOBJDIR}/${_kernel}; \
573 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
574 @echo
575 @echo "--------------------------------------------------------------"
576 @echo ">>> stage 2.3: build tools"
577 @echo "--------------------------------------------------------------"
578 cd ${KRNLOBJDIR}/${_kernel}; \
579 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
580 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
581# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
582.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
583.for target in obj depend all
584 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
585 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
586 ${MAKE} -DNO_CPU_CFLAGS ${target}
587.endfor
588.endif
589.if !defined(NO_KERNELDEPEND)
590 @echo
591 @echo "--------------------------------------------------------------"
592 @echo ">>> stage 3.1: making dependencies"
593 @echo "--------------------------------------------------------------"
594 cd ${KRNLOBJDIR}/${_kernel}; \
595 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
596.endif
597 @echo
598 @echo "--------------------------------------------------------------"
599 @echo ">>> stage 3.2: building everything"
600 @echo "--------------------------------------------------------------"
601 cd ${KRNLOBJDIR}/${_kernel}; \
602 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
603 @echo "--------------------------------------------------------------"
604 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
605 @echo "--------------------------------------------------------------"
606.endfor
607
608#
609# installkernel, etc.
610#
611# Install the kernel defined by INSTALLKERNEL
612#
613installkernel installkernel.debug \
614reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
615.if empty(INSTALLKERNEL)
616 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
617 false
618.endif
619 @echo "--------------------------------------------------------------"
620 @echo ">>> Making hierarchy"
621 @echo "--------------------------------------------------------------"
622 cd ${.CURDIR}; \
623 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
624 @echo
625 @echo "--------------------------------------------------------------"
626 @echo ">>> Installing kernel"
627 @echo "--------------------------------------------------------------"
628 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
629 ${CROSSENV} PATH=${TMPPATH} \
630 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
631
632#
633# update
634#
635# Update the source tree, by running sup and/or running cvs to update to the
636# latest copy.
637#
638update:
639.if defined(SUP_UPDATE)
640 @echo "--------------------------------------------------------------"
641 @echo ">>> Running ${SUP}"
642 @echo "--------------------------------------------------------------"
643.if defined(SUPFILE)
644 @${SUP} ${SUPFLAGS} ${SUPFILE}
645.endif
646.if defined(SUPFILE1)
647 @${SUP} ${SUPFLAGS} ${SUPFILE1}
648.endif
649.if defined(SUPFILE2)
650 @${SUP} ${SUPFLAGS} ${SUPFILE2}
651.endif
652.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
653 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
654.endif
655.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
656 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
657.endif
658.endif
659.if defined(CVS_UPDATE)
660 @echo "--------------------------------------------------------------"
661 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
662 @echo "--------------------------------------------------------------"
663 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
664.endif
665
666#
667# ------------------------------------------------------------------------
668#
669# From here onwards are utility targets used by the 'make world' and
670# related targets. If your 'world' breaks, you may like to try to fix
671# the problem and manually run the following targets to attempt to
672# complete the build. Beware, this is *not* guaranteed to work, you
673# need to have a pretty good grip on the current state of the system
674# to attempt to manually finish it. If in doubt, 'make world' again.
675#
676
677#
678# legacy: Build compatibility shims for the next three targets
679#
680legacy:
681.for _tool in tools/build
682 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
683 cd ${.CURDIR}/${_tool}; \
684 ${MAKE} DIRPRFX=${_tool}/ obj; \
685 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
686 ${MAKE} DIRPRFX=${_tool}/ depend; \
687 ${MAKE} DIRPRFX=${_tool}/ all; \
688 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
689.endfor
690
691#
692# bootstrap-tools: Build tools needed for compatibility
693#
694.if !defined(NOGAMES)
695_strfile= games/fortune/strfile
696.endif
697
698.if !defined(NO_CXX)
699_gperf= gnu/usr.bin/gperf
700.if ${BOOTSTRAPPING} < 500113
701_groff= gnu/usr.bin/groff
702.else
703_groff= gnu/usr.bin/groff/tmac
704.endif
705.endif
706
707.if ${BOOTSTRAPPING} < 502102
708_lex= usr.bin/lex
709.endif
710
711.if ${BOOTSTRAPPING} < 450005 || \
712 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
713_uudecode= usr.bin/uudecode
714.endif
715
716.if ${BOOTSTRAPPING} < 430002 || \
717 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
718_xargs= usr.bin/xargs
719.endif
720
721.if ${BOOTSTRAPPING} < 430002 || \
722 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
723_yacc= usr.bin/yacc
724.endif
725
726.if !defined(NO_RESCUE) && \
727 ${BOOTSTRAPPING} < 502128
728_crunchgen= usr.sbin/crunch/crunchgen
729.endif
730
731.if ${BOOTSTRAPPING} < 502128
732_gensnmptree= usr.sbin/bsnmpd/gensnmptree
733.endif
734
735.if ${BOOTSTRAPPING} < 500019
736_kbdcontrol= usr.sbin/kbdcontrol
737.endif
738
739bootstrap-tools:
740.for _tool in \
741 ${_strfile} \
742 ${_gperf} \
743 ${_groff} \
744 gnu/usr.bin/texinfo \
745 usr.bin/colldef \
746 ${_lex} \
747 usr.bin/makewhatis \
748 usr.bin/rpcgen \
749 ${_uudecode} \
750 ${_xargs} \
751 usr.bin/xinstall \
752 ${_yacc} \
753 usr.sbin/config \
754 ${_crunchgen} \
755 ${_gensnmptree} \
756 ${_kbdcontrol}
757 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
758 cd ${.CURDIR}/${_tool}; \
759 ${MAKE} DIRPRFX=${_tool}/ obj; \
760 ${MAKE} DIRPRFX=${_tool}/ depend; \
761 ${MAKE} DIRPRFX=${_tool}/ all; \
762 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
763.endfor
764
765#
766# build-tools: Build special purpose build tools
767#
768.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
769_aicasm= sys/modules/aic7xxx/aicasm
770.endif
771
772.if !defined(NOSHARE)
773_share= share/syscons/scrnmaps
774.endif
775
776.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
777_kerberos5_tools= kerberos5/tools
778.endif
779
780.if !defined(NO_RESCUE)
781_rescue= rescue/rescue
782.endif
783
784build-tools:
785.for _tool in \
786 bin/csh \
787 bin/sh \
788 ${_rescue} \
789 lib/libncurses \
790 ${_share} \
791 ${_aicasm} \
792 usr.bin/awk \
793 lib/libmagic \
794 usr.sbin/sysinstall
795 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
796 cd ${.CURDIR}/${_tool}; \
797 ${MAKE} DIRPRFX=${_tool}/ obj; \
798 ${MAKE} DIRPRFX=${_tool}/ build-tools
799.endfor
800.for _tool in \
801 gnu/usr.bin/cc/cc_tools \
802 ${_kerberos5_tools}
803 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
804 cd ${.CURDIR}/${_tool}; \
805 ${MAKE} DIRPRFX=${_tool}/ obj; \
806 ${MAKE} DIRPRFX=${_tool}/ depend; \
807 ${MAKE} DIRPRFX=${_tool}/ all
808.endfor
809
810#
811# cross-tools: Build cross-building tools
812#
813.if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
814 ${BOOTSTRAPPING} < 500037
815_elf2aout= usr.bin/elf2aout
816.endif
817
818.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
819_btxld= usr.sbin/btxld
820.endif
821
822.if (!defined(NO_RESCUE) || \
823 defined(RELEASEDIR)) && \
824 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
825_crunchide= usr.sbin/crunch/crunchide
826.endif
827
828.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
829_elf2exe= usr.sbin/elf2exe
830.endif
831
832.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
833 defined(RELEASEDIR)
834_kgzip= usr.sbin/kgzip
835.endif
836
837cross-tools:
838.for _tool in \
839 gnu/usr.bin/binutils \
840 gnu/usr.bin/cc \
841 ${_elf2aout} \
842 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
843 ${_btxld} \
844 ${_crunchide} \
845 ${_elf2exe} \
846 ${_kgzip}
847 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
848 cd ${.CURDIR}/${_tool}; \
849 ${MAKE} DIRPRFX=${_tool}/ obj; \
850 ${MAKE} DIRPRFX=${_tool}/ depend; \
851 ${MAKE} DIRPRFX=${_tool}/ all; \
852 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
853.endfor
854
855#
856# hierarchy - ensure that all the needed directories are present
857#
858hierarchy:
859 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
860
861#
862# libraries - build all libraries, and install them under ${DESTDIR}.
863#
864# The list of libraries with dependents (${_prebuild_libs}) and their
865# interdependencies (__L) are built automatically by the
866# ${.CURDIR}/tools/make_libdeps.sh script.
867#
868libraries:
869 cd ${.CURDIR}; \
870 ${MAKE} -f Makefile.inc1 _startup_libs; \
871 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
872 ${MAKE} -f Makefile.inc1 _generic_libs;
873
874# These dependencies are not automatically generated:
875#
876# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
877# shared libraries for ELF.
878#
879_startup_libs= gnu/lib/csu gnu/lib/libgcc
880.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
881_startup_libs+= lib/csu/${MACHINE_ARCH}-elf
882.else
883_startup_libs+= lib/csu/${MACHINE_ARCH}
884.endif
885
886_prebuild_libs=
887
888_generic_libs= gnu/lib
889
890.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
891_prebuild_libs+= kerberos5/lib/libasn1
892_prebuild_libs+= kerberos5/lib/libgssapi
893_prebuild_libs+= kerberos5/lib/libkrb5
894_prebuild_libs+= kerberos5/lib/libroken
895_generic_libs+= kerberos5/lib
896.endif
897
898_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
899 lib/libkvm lib/libmd \
900 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
901 lib/libradius \
902 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
903 lib/libz lib/msun
904
905lib/libopie__L lib/libtacplus__L: lib/libmd__L
906
907.if !defined(NO_BIND)
908.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
909_prebuild_libs+= lib/libc_r
910.else
911_prebuild_libs+= lib/libpthread
912.endif
913.endif
914
915_generic_libs+= lib
916
917.if !defined(NOCRYPT)
918.if !defined(NO_OPENSSL)
919_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
920lib/libradius__L: secure/lib/libssl__L
921secure/lib/libssl__L: secure/lib/libcrypto__L
922.if !defined(NO_OPENSSH)
923_prebuild_libs+= secure/lib/libssh
924secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
925.if !defined(NO_KERBEROS)
926secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
927 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
928 kerberos5/lib/libroken__L
929.endif
930.endif
931.endif
932_generic_libs+= secure/lib
933.endif
934
935.if defined(NOCRYPT) || defined(NO_OPENSSL)
936lib/libradius__L: lib/libmd__L
937.endif
938
939_generic_libs+= usr.bin/lex/lib
940
941.if ${MACHINE_ARCH} == "i386"
942_generic_libs+= usr.sbin/pcvt/keycap
943.endif
944
945.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
946${_lib}__L: .PHONY
947.if exists(${.CURDIR}/${_lib})
948 ${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \
949 cd ${.CURDIR}/${_lib}; \
950 ${MAKE} DIRPRFX=${_lib}/ depend; \
951 ${MAKE} DIRPRFX=${_lib}/ all; \
952 ${MAKE} DIRPRFX=${_lib}/ install
953.endif
954.endfor
955
956# libpam is special: we need to build static PAM modules before
957# static PAM library, and dynamic PAM library before dynamic PAM
958# modules.
959lib/libpam__L: .PHONY
960 ${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \
961 cd ${.CURDIR}/lib/libpam; \
962 ${MAKE} DIRPRFX=lib/libpam/ depend; \
963 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
964 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
965
966_startup_libs: ${_startup_libs:S/$/__L/}
967_prebuild_libs: ${_prebuild_libs:S/$/__L/}
968_generic_libs: ${_generic_libs:S/$/__L/}
969
970.for __target in all clean cleandepend cleandir depend includes obj
971.for entry in ${SUBDIR}
972${entry}.${__target}__D: .PHONY
973 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
974 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
975 edir=${entry}.${MACHINE_ARCH}; \
976 cd ${.CURDIR}/$${edir}; \
977 else \
978 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
979 edir=${entry}; \
980 cd ${.CURDIR}/$${edir}; \
981 fi; \
982 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
983.endfor
984par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
985.endfor
986
987.include <bsd.subdir.mk>
575
576redistribute:
577 @echo "--------------------------------------------------------------"
578 @echo ">>> Distributing everything"
579 @echo "--------------------------------------------------------------"
580 ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 distribute
581
582#
583# buildkernel and installkernel
584#
585# Which kernels to build and/or install is specified by setting
586# KERNCONF. If not defined a GENERIC kernel is built/installed.
587# Only the existing (depending TARGET) config files are used
588# for building kernels and only the first of these is designated
589# as the one being installed.
590#
591# Note that we have to use TARGET instead of TARGET_ARCH when
592# we're in kernel-land. Since only TARGET_ARCH is (expected) to
593# be set to cross-build, we have to make sure TARGET is set
594# properly.
595
596.if !defined(KERNCONF) && defined(KERNEL)
597KERNCONF= ${KERNEL}
598KERNWARN=
599.else
600KERNCONF?= GENERIC
601.endif
602INSTKERNNAME?= kernel
603
604KERNSRCDIR?= ${.CURDIR}/sys
605KRNLCONFDIR= ${KERNSRCDIR}/${TARGET}/conf
606KRNLOBJDIR= ${OBJTREE}${KERNSRCDIR}
607KERNCONFDIR?= ${KRNLCONFDIR}
608
609BUILDKERNELS=
610INSTALLKERNEL=
611.for _kernel in ${KERNCONF}
612.if exists(${KERNCONFDIR}/${_kernel})
613BUILDKERNELS+= ${_kernel}
614.if empty(INSTALLKERNEL)
615INSTALLKERNEL= ${_kernel}
616.endif
617.endif
618.endfor
619
620#
621# buildkernel
622#
623# Builds all kernels defined by BUILDKERNELS.
624#
625buildkernel:
626.if empty(BUILDKERNELS)
627 @echo "ERROR: Missing kernel configuration file(s) (${KERNCONF}).";
628 false
629.endif
630.if defined(KERNWARN)
631 @echo "--------------------------------------------------------------"
632 @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF="
633 @echo "--------------------------------------------------------------"
634 @sleep 3
635.endif
636 @echo
637.for _kernel in ${BUILDKERNELS}
638 @echo "--------------------------------------------------------------"
639 @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`"
640 @echo "--------------------------------------------------------------"
641 @echo "===> ${_kernel}"
642 mkdir -p ${KRNLOBJDIR}
643.if !defined(NO_KERNELCONFIG)
644 @echo
645 @echo "--------------------------------------------------------------"
646 @echo ">>> stage 1: configuring the kernel"
647 @echo "--------------------------------------------------------------"
648 cd ${KRNLCONFDIR}; \
649 PATH=${TMPPATH} \
650 config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \
651 ${KERNCONFDIR}/${_kernel}
652.endif
653.if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN)
654 @echo
655 @echo "--------------------------------------------------------------"
656 @echo ">>> stage 2.1: cleaning up the object tree"
657 @echo "--------------------------------------------------------------"
658 cd ${KRNLOBJDIR}/${_kernel}; \
659 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${CLEANDIR}
660.endif
661 @echo
662 @echo "--------------------------------------------------------------"
663 @echo ">>> stage 2.2: rebuilding the object tree"
664 @echo "--------------------------------------------------------------"
665 cd ${KRNLOBJDIR}/${_kernel}; \
666 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj
667 @echo
668 @echo "--------------------------------------------------------------"
669 @echo ">>> stage 2.3: build tools"
670 @echo "--------------------------------------------------------------"
671 cd ${KRNLOBJDIR}/${_kernel}; \
672 MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
673 ${MAKE} -DNO_CPU_CFLAGS -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
674# XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
675.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
676.for target in obj depend all
677 cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \
678 MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \
679 ${MAKE} -DNO_CPU_CFLAGS ${target}
680.endfor
681.endif
682.if !defined(NO_KERNELDEPEND)
683 @echo
684 @echo "--------------------------------------------------------------"
685 @echo ">>> stage 3.1: making dependencies"
686 @echo "--------------------------------------------------------------"
687 cd ${KRNLOBJDIR}/${_kernel}; \
688 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ
689.endif
690 @echo
691 @echo "--------------------------------------------------------------"
692 @echo ">>> stage 3.2: building everything"
693 @echo "--------------------------------------------------------------"
694 cd ${KRNLOBJDIR}/${_kernel}; \
695 ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ
696 @echo "--------------------------------------------------------------"
697 @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`"
698 @echo "--------------------------------------------------------------"
699.endfor
700
701#
702# installkernel, etc.
703#
704# Install the kernel defined by INSTALLKERNEL
705#
706installkernel installkernel.debug \
707reinstallkernel reinstallkernel.debug: ${SPECIAL_INSTALLCHECKS}
708.if empty(INSTALLKERNEL)
709 @echo "ERROR: No kernel \"${KERNCONF}\" to install."
710 false
711.endif
712 @echo "--------------------------------------------------------------"
713 @echo ">>> Making hierarchy"
714 @echo "--------------------------------------------------------------"
715 cd ${.CURDIR}; \
716 ${CROSSENV} PATH=${TMPPATH} ${MAKE} -f Makefile.inc1 hierarchy
717 @echo
718 @echo "--------------------------------------------------------------"
719 @echo ">>> Installing kernel"
720 @echo "--------------------------------------------------------------"
721 cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \
722 ${CROSSENV} PATH=${TMPPATH} \
723 ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
724
725#
726# update
727#
728# Update the source tree, by running sup and/or running cvs to update to the
729# latest copy.
730#
731update:
732.if defined(SUP_UPDATE)
733 @echo "--------------------------------------------------------------"
734 @echo ">>> Running ${SUP}"
735 @echo "--------------------------------------------------------------"
736.if defined(SUPFILE)
737 @${SUP} ${SUPFLAGS} ${SUPFILE}
738.endif
739.if defined(SUPFILE1)
740 @${SUP} ${SUPFLAGS} ${SUPFILE1}
741.endif
742.if defined(SUPFILE2)
743 @${SUP} ${SUPFLAGS} ${SUPFILE2}
744.endif
745.if defined(PORTSSUPFILE) && !defined(NO_PORTSUPDATE)
746 @${SUP} ${SUPFLAGS} ${PORTSSUPFILE}
747.endif
748.if defined(DOCSUPFILE) && !defined(NO_DOCUPDATE)
749 @${SUP} ${SUPFLAGS} ${DOCSUPFILE}
750.endif
751.endif
752.if defined(CVS_UPDATE)
753 @echo "--------------------------------------------------------------"
754 @echo ">>> Updating ${.CURDIR} from cvs repository" ${CVSROOT}
755 @echo "--------------------------------------------------------------"
756 cd ${.CURDIR}; ${CVS} -R -q update ${CVSFLAGS}
757.endif
758
759#
760# ------------------------------------------------------------------------
761#
762# From here onwards are utility targets used by the 'make world' and
763# related targets. If your 'world' breaks, you may like to try to fix
764# the problem and manually run the following targets to attempt to
765# complete the build. Beware, this is *not* guaranteed to work, you
766# need to have a pretty good grip on the current state of the system
767# to attempt to manually finish it. If in doubt, 'make world' again.
768#
769
770#
771# legacy: Build compatibility shims for the next three targets
772#
773legacy:
774.for _tool in tools/build
775 ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \
776 cd ${.CURDIR}/${_tool}; \
777 ${MAKE} DIRPRFX=${_tool}/ obj; \
778 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
779 ${MAKE} DIRPRFX=${_tool}/ depend; \
780 ${MAKE} DIRPRFX=${_tool}/ all; \
781 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
782.endfor
783
784#
785# bootstrap-tools: Build tools needed for compatibility
786#
787.if !defined(NOGAMES)
788_strfile= games/fortune/strfile
789.endif
790
791.if !defined(NO_CXX)
792_gperf= gnu/usr.bin/gperf
793.if ${BOOTSTRAPPING} < 500113
794_groff= gnu/usr.bin/groff
795.else
796_groff= gnu/usr.bin/groff/tmac
797.endif
798.endif
799
800.if ${BOOTSTRAPPING} < 502102
801_lex= usr.bin/lex
802.endif
803
804.if ${BOOTSTRAPPING} < 450005 || \
805 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500034
806_uudecode= usr.bin/uudecode
807.endif
808
809.if ${BOOTSTRAPPING} < 430002 || \
810 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500019
811_xargs= usr.bin/xargs
812.endif
813
814.if ${BOOTSTRAPPING} < 430002 || \
815 ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500018
816_yacc= usr.bin/yacc
817.endif
818
819.if !defined(NO_RESCUE) && \
820 ${BOOTSTRAPPING} < 502128
821_crunchgen= usr.sbin/crunch/crunchgen
822.endif
823
824.if ${BOOTSTRAPPING} < 502128
825_gensnmptree= usr.sbin/bsnmpd/gensnmptree
826.endif
827
828.if ${BOOTSTRAPPING} < 500019
829_kbdcontrol= usr.sbin/kbdcontrol
830.endif
831
832bootstrap-tools:
833.for _tool in \
834 ${_strfile} \
835 ${_gperf} \
836 ${_groff} \
837 gnu/usr.bin/texinfo \
838 usr.bin/colldef \
839 ${_lex} \
840 usr.bin/makewhatis \
841 usr.bin/rpcgen \
842 ${_uudecode} \
843 ${_xargs} \
844 usr.bin/xinstall \
845 ${_yacc} \
846 usr.sbin/config \
847 ${_crunchgen} \
848 ${_gensnmptree} \
849 ${_kbdcontrol}
850 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
851 cd ${.CURDIR}/${_tool}; \
852 ${MAKE} DIRPRFX=${_tool}/ obj; \
853 ${MAKE} DIRPRFX=${_tool}/ depend; \
854 ${MAKE} DIRPRFX=${_tool}/ all; \
855 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
856.endfor
857
858#
859# build-tools: Build special purpose build tools
860#
861.if defined(MODULES_WITH_WORLD) && exists(${KERNSRCDIR}/modules)
862_aicasm= sys/modules/aic7xxx/aicasm
863.endif
864
865.if !defined(NOSHARE)
866_share= share/syscons/scrnmaps
867.endif
868
869.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
870_kerberos5_tools= kerberos5/tools
871.endif
872
873.if !defined(NO_RESCUE)
874_rescue= rescue/rescue
875.endif
876
877build-tools:
878.for _tool in \
879 bin/csh \
880 bin/sh \
881 ${_rescue} \
882 lib/libncurses \
883 ${_share} \
884 ${_aicasm} \
885 usr.bin/awk \
886 lib/libmagic \
887 usr.sbin/sysinstall
888 ${_+_}@${ECHODIR} "===> ${_tool} (obj,build-tools)"; \
889 cd ${.CURDIR}/${_tool}; \
890 ${MAKE} DIRPRFX=${_tool}/ obj; \
891 ${MAKE} DIRPRFX=${_tool}/ build-tools
892.endfor
893.for _tool in \
894 gnu/usr.bin/cc/cc_tools \
895 ${_kerberos5_tools}
896 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all)"; \
897 cd ${.CURDIR}/${_tool}; \
898 ${MAKE} DIRPRFX=${_tool}/ obj; \
899 ${MAKE} DIRPRFX=${_tool}/ depend; \
900 ${MAKE} DIRPRFX=${_tool}/ all
901.endfor
902
903#
904# cross-tools: Build cross-building tools
905#
906.if ${TARGET_ARCH} == "sparc64" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
907 ${BOOTSTRAPPING} < 500037
908_elf2aout= usr.bin/elf2aout
909.endif
910
911.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH}
912_btxld= usr.sbin/btxld
913.endif
914
915.if (!defined(NO_RESCUE) || \
916 defined(RELEASEDIR)) && \
917 (${TARGET_ARCH} != ${MACHINE_ARCH} || ${BOOTSTRAPPING} < 501101)
918_crunchide= usr.sbin/crunch/crunchide
919.endif
920
921.if ${TARGET_ARCH} == "alpha" && ${TARGET_ARCH} != ${MACHINE_ARCH}
922_elf2exe= usr.sbin/elf2exe
923.endif
924
925.if ${TARGET_ARCH} == "i386" && ${TARGET_ARCH} != ${MACHINE_ARCH} && \
926 defined(RELEASEDIR)
927_kgzip= usr.sbin/kgzip
928.endif
929
930cross-tools:
931.for _tool in \
932 gnu/usr.bin/binutils \
933 gnu/usr.bin/cc \
934 ${_elf2aout} \
935 usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
936 ${_btxld} \
937 ${_crunchide} \
938 ${_elf2exe} \
939 ${_kgzip}
940 ${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
941 cd ${.CURDIR}/${_tool}; \
942 ${MAKE} DIRPRFX=${_tool}/ obj; \
943 ${MAKE} DIRPRFX=${_tool}/ depend; \
944 ${MAKE} DIRPRFX=${_tool}/ all; \
945 ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install
946.endfor
947
948#
949# hierarchy - ensure that all the needed directories are present
950#
951hierarchy:
952 cd ${.CURDIR}/etc; ${MAKE} distrib-dirs
953
954#
955# libraries - build all libraries, and install them under ${DESTDIR}.
956#
957# The list of libraries with dependents (${_prebuild_libs}) and their
958# interdependencies (__L) are built automatically by the
959# ${.CURDIR}/tools/make_libdeps.sh script.
960#
961libraries:
962 cd ${.CURDIR}; \
963 ${MAKE} -f Makefile.inc1 _startup_libs; \
964 ${MAKE} -f Makefile.inc1 _prebuild_libs; \
965 ${MAKE} -f Makefile.inc1 _generic_libs;
966
967# These dependencies are not automatically generated:
968#
969# gnu/lib/csu, gnu/lib/libgcc and lib/csu must be built before all
970# shared libraries for ELF.
971#
972_startup_libs= gnu/lib/csu gnu/lib/libgcc
973.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
974_startup_libs+= lib/csu/${MACHINE_ARCH}-elf
975.else
976_startup_libs+= lib/csu/${MACHINE_ARCH}
977.endif
978
979_prebuild_libs=
980
981_generic_libs= gnu/lib
982
983.if !defined(NO_KERBEROS) && !defined(NOCRYPT) && !defined(NO_OPENSSL)
984_prebuild_libs+= kerberos5/lib/libasn1
985_prebuild_libs+= kerberos5/lib/libgssapi
986_prebuild_libs+= kerberos5/lib/libkrb5
987_prebuild_libs+= kerberos5/lib/libroken
988_generic_libs+= kerberos5/lib
989.endif
990
991_prebuild_libs+= lib/libcom_err lib/libcrypt lib/libexpat \
992 lib/libkvm lib/libmd \
993 lib/libncurses lib/libnetgraph lib/libopie lib/libpam \
994 lib/libradius \
995 lib/libsbuf lib/libtacplus lib/libutil lib/libypclnt \
996 lib/libz lib/msun
997
998lib/libopie__L lib/libtacplus__L: lib/libmd__L
999
1000.if !defined(NO_BIND)
1001.if ${MACHINE_ARCH} == "alpha" || ${MACHINE_ARCH} == "sparc64"
1002_prebuild_libs+= lib/libc_r
1003.else
1004_prebuild_libs+= lib/libpthread
1005.endif
1006.endif
1007
1008_generic_libs+= lib
1009
1010.if !defined(NOCRYPT)
1011.if !defined(NO_OPENSSL)
1012_prebuild_libs+= secure/lib/libcrypto secure/lib/libssl
1013lib/libradius__L: secure/lib/libssl__L
1014secure/lib/libssl__L: secure/lib/libcrypto__L
1015.if !defined(NO_OPENSSH)
1016_prebuild_libs+= secure/lib/libssh
1017secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
1018.if !defined(NO_KERBEROS)
1019secure/lib/libssh__L: kerberos5/lib/libgssapi__L kerberos5/lib/libkrb5__L \
1020 kerberos5/lib/libasn1__L lib/libcom_err__L lib/libmd__L \
1021 kerberos5/lib/libroken__L
1022.endif
1023.endif
1024.endif
1025_generic_libs+= secure/lib
1026.endif
1027
1028.if defined(NOCRYPT) || defined(NO_OPENSSL)
1029lib/libradius__L: lib/libmd__L
1030.endif
1031
1032_generic_libs+= usr.bin/lex/lib
1033
1034.if ${MACHINE_ARCH} == "i386"
1035_generic_libs+= usr.sbin/pcvt/keycap
1036.endif
1037
1038.for _lib in ${_startup_libs} ${_prebuild_libs:Nlib/libpam} ${_generic_libs}
1039${_lib}__L: .PHONY
1040.if exists(${.CURDIR}/${_lib})
1041 ${_+_}@${ECHODIR} "===> ${_lib} (depend,all,install)"; \
1042 cd ${.CURDIR}/${_lib}; \
1043 ${MAKE} DIRPRFX=${_lib}/ depend; \
1044 ${MAKE} DIRPRFX=${_lib}/ all; \
1045 ${MAKE} DIRPRFX=${_lib}/ install
1046.endif
1047.endfor
1048
1049# libpam is special: we need to build static PAM modules before
1050# static PAM library, and dynamic PAM library before dynamic PAM
1051# modules.
1052lib/libpam__L: .PHONY
1053 ${_+_}@${ECHODIR} "===> lib/libpam (depend,all,install)"; \
1054 cd ${.CURDIR}/lib/libpam; \
1055 ${MAKE} DIRPRFX=lib/libpam/ depend; \
1056 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET all; \
1057 ${MAKE} DIRPRFX=lib/libpam/ -D_NO_LIBPAM_SO_YET install
1058
1059_startup_libs: ${_startup_libs:S/$/__L/}
1060_prebuild_libs: ${_prebuild_libs:S/$/__L/}
1061_generic_libs: ${_generic_libs:S/$/__L/}
1062
1063.for __target in all clean cleandepend cleandir depend includes obj
1064.for entry in ${SUBDIR}
1065${entry}.${__target}__D: .PHONY
1066 ${_+_}@if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \
1067 ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH} (${__target})"; \
1068 edir=${entry}.${MACHINE_ARCH}; \
1069 cd ${.CURDIR}/$${edir}; \
1070 else \
1071 ${ECHODIR} "===> ${DIRPRFX}${entry} (${__target})"; \
1072 edir=${entry}; \
1073 cd ${.CURDIR}/$${edir}; \
1074 fi; \
1075 ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
1076.endfor
1077par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
1078.endfor
1079
1080.include <bsd.subdir.mk>