Makefile revision 1.287 1 # $NetBSD: Makefile,v 1.287 2004/05/16 09:53:09 lukem Exp $
2 # from: @(#)Makefile 8.7 (Berkeley) 5/25/95
3
4 # Environment variables without default values:
5 # DESTDIR must be set before anything in this file will work.
6 # RELEASEDIR is where the tarred up stuff for a snapshot or
7 # release will be placed.
8 #
9 # Environment variables with default values:
10 # LOCALTIME will set the default local time for the system you
11 # build; it determines what /etc/localtime is symlink'd to.
12 # KERNSRCDIR points to kernel source; it is set by default to ../sys,
13 # but can be overridden.
14 # KERNOBJDIR is the kernel build directory, it defaults to
15 # ${KERNSRCDIR}/arch/${MACHINE}/compile, but can be overridden.
16 # KERNCONFDIR is where the configuration files for kernels are found;
17 # default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden.
18 # MKCRYPTO; if not `no', install crypto-related configuration
19 # MKSENDMAIL; if not `no', install sendmail configuration
20 # MKUNPRIVED; if not `no', allow non-root installs.
21 # MKUPDATE; if not `no', don't do a 'make clean' before kernel compile
22 #
23 # Targets:
24 # distribution: makes a full NetBSD distribution in DESTDIR. If
25 # INSTALL_DONE is set, it will not do a `make install.'
26 # if DISTRIBUTION_DONE is set, it will not do anything.
27 # distrib-dirs: creates an empty NetBSD directory tree in DESTDIR.
28 # Called by distribution.
29 # snapshot: calls distribution, above, and then tars up the files
30 # into a release(7) format in RELEASEDIR/${RELEASEMACHINEDIR}.
31 # Any port-dependent stuff for this target is found in
32 # etc.${MACHINE}/Makefile.inc.
33 # release: a synonym for `snapshot'
34 #
35
36 # For MK* vars
37 .include <bsd.own.mk>
38
39 .include <bsd.sys.mk> # for HOST_SH
40 .include <bsd.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ...
41 .include <bsd.endian.mk> # For TARGET_ENDIANNESS
42
43
44 .MAKEOVERRIDES+= USETOOLS
45
46 TZDIR= /usr/share/zoneinfo
47 LOCALTIME?= UTC
48 CKSUM?= ${TOOL_CKSUM}
49 MAKESUMS= CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
50 DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
51
52 # Flags for creating ISO CDROM image
53 # mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrecord
54 # Note: At least mkisofs 2.0 should be used.
55 #
56 MKISOFS?= mkisofs
57 DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s
58 # ISO 9660 volume ID. Note that this can only contain [A-Z0-9_].
59 ISO_VOLID!= echo NETBSD_${MACHINE}_${DISTRIBREV} | tr a-z A-Z
60 MKISOFS_FLAGS+= -J -l \
61 -r -T -v \
62 -V ${ISO_VOLID} \
63 -P "The NetBSD Project" \
64 -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom"
65
66 # MD Makefile.inc may append MD targets to BIN[123]. Make sure all
67 # are empty, to preserve the old semantics of setting them below with "=".
68 #
69 BIN1=
70 BIN2=
71 BIN3=
72
73 # Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}.
74 # MD Makefile.inc files can add to this.
75 # NOTE: Parent directories must be listed before subdirectories.
76 #
77 INSTALLATION_DIRS= binary binary/sets binary/kernel installation
78
79 .if exists(etc.${RELEASEMACHINE}/Makefile.inc)
80 .include "etc.${RELEASEMACHINE}/Makefile.inc"
81 .endif
82
83 # -rw-r--r--
84 BINOWN= root
85 BINGRP= wheel
86 UTMPGRP= utmp
87 BIN1+= bootptab changelist csh.cshrc csh.login csh.logout daily \
88 daily.conf dm.conf floppytab ftpchroot ftpusers \
89 gettytab group hosts hosts.lpd inetd.conf lkm.conf locate.conf \
90 mailer.conf man.conf monthly monthly.conf mrouted.conf \
91 netconfig networks newsyslog.conf nsswitch.conf ntp.conf \
92 passwd.conf phones printcap profile protocols rbootd.conf rc rc.conf \
93 rc.lkm rc.local rc.subr rc.shutdown remote rpc \
94 security security.conf services shells sysctl.conf syslog.conf \
95 weekly weekly.conf wscons.conf \
96 etc.${MACHINE}/ttys
97
98 # Use machine-specific disktab if it exists, or the MI one otherwise
99 .if exists(etc.${MACHINE}/disktab)
100 BIN1+= etc.${MACHINE}/disktab
101 .else
102 BIN1+= disktab
103 .endif
104
105 .if exists(etc.${MACHINE}/ld.so.conf)
106 BIN1+= etc.${MACHINE}/ld.so.conf
107 .endif
108
109 .if exists(etc.${MACHINE}/ttyaction)
110 BIN1+= etc.${MACHINE}/ttyaction
111 .endif
112
113 # -rw-rw-r--
114 BIN2+= motd
115
116 # -rw-------
117 BIN3+= hosts.equiv
118
119 ETC_PKG=-T etc_pkg
120 BASE_PKG=-T base_pkg
121 ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG}
122 ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG}
123 ETC_INSTALL_LINK=cd ${.CURDIR} && ${INSTALL_LINK} ${ETC_PKG}
124 ETC_INSTALL_SYMLINK=cd ${.CURDIR} && ${INSTALL_SYMLINK} ${ETC_PKG}
125
126 .if ${TARGET_ENDIANNESS} == "1234"
127 PWD_MKDB_ENDIAN= -L
128 .elif ${TARGET_ENDIANNESS} == "4321"
129 PWD_MKDB_ENDIAN= -B
130 .else
131 PWD_MKDB_ENDIAN=
132 .endif
133
134
135 # distribution --
136 # Build a distribution
137 #
138 distribution: .PHONY check_DESTDIR .WAIT distrib-dirs
139 .if !defined(DISTRIBUTION_DONE)
140 .if !defined(INSTALL_DONE)
141 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB=
142 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB=
143 .endif # !INSTALL_DONE
144 ${MAKEDIRTARGET} . install-etc-files
145 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles
146 .endif # !DISTRIBUTION_DONE
147
148
149 CLEANFILES+= MAKEDEV
150 MAKEDEV: .EXEC
151 ${_MKTARGET_CREATE}
152 MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
153 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
154 awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET}
155
156
157 RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID \
158 DESTDIR EXTERNAL_TOOLCHAIN \
159 INSTALLWORLDDIR \
160 KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \
161 MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \
162 MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
163 MKBFD MKCATPAGES \
164 MKCRYPTO MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKCVS \
165 MKDOC MKDYNAMICROOT MKGCC MKGCCCMDS MKGDB \
166 MKHESIOD MKHOSTOBJ MKHTML MKIEEEFP MKINFO \
167 MKKERBEROS4 MKKERBEROS MKLINKLIB MKLINT \
168 MKMAN MKMANZ MKNLS MKOBJ MKOBJDIRS \
169 MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
170 MKSENDMAIL MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
171 MKUNPRIVED MKUPDATE MKUUCP MKX11 MKYP \
172 NBUILDJOBS NETBSDSRCDIR \
173 NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
174 OBJMACHINE \
175 RELEASEDIR TOOLCHAIN_MISSING TOOLDIR \
176 USETOOLS USR_OBJMACHINE \
177 X11SRCDIR
178
179 params: .PHONY
180 .for var in ${RELEASEVARS}
181 .if defined(${var})
182 @printf "%20s = '%-s'\n" ${var} ${${var}:Q}
183 .else
184 @printf "%20s = (undefined)\n" ${var}
185 .endif
186 .endfor
187
188 CLEANFILES+= etc-release
189 etc-release: .EXEC
190 ${_MKTARGET_CREATE}
191 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \
192 echo ; \
193 cat ${NETBSDSRCDIR}/sys/conf/copyright; \
194 echo ; \
195 echo "Build settings:"; \
196 printf "%20s %s\n" "Build date" "$$(date -u)"; \
197 printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \
198 echo ; \
199 (cd ${.CURDIR}; ${MAKE} ${MFLAGS} -j1 params); \
200 ) >${.OBJDIR}/${.TARGET}
201
202 install-etc-release: .PHONY etc-release
203 ${_MKMSG_INSTALL} etc/release
204 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
205 etc-release ${DESTDIR}/etc/release
206
207 # install-etc-files --
208 # Install etc (config) files; not performed by "make build"
209 #
210 install-etc-files: .PHONY check_DESTDIR MAKEDEV
211 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
212 ${BIN1} ${DESTDIR}/etc
213 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
214 ${BIN2} ${DESTDIR}/etc
215 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
216 ${BIN3} ${DESTDIR}/etc
217 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
218 aliases ${DESTDIR}/etc/mail
219 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
220 /dev/null ${DESTDIR}/etc/mail/local-host-names
221 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
222 crontab ${DESTDIR}/var/cron/tabs/root
223 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
224 master.passwd ${DESTDIR}/etc
225 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
226 ${DESTDIR}/etc/master.passwd
227 .if ${MKUNPRIVED} != "no"
228 ( \
229 for metaent in passwd pwd.db spwd.db; do \
230 echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
231 done; \
232 ) | ${METALOG.add}
233 .endif # MKUNPRIVED != no
234 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
235 MAKEDEV ${DESTDIR}/dev
236 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
237 MAKEDEV.local ${DESTDIR}/dev
238 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
239 minfree ${DESTDIR}/var/crash
240 ${MAKEDIRTARGET} defaults configinstall
241 ${MAKEDIRTARGET} mtree configinstall
242 ${MAKEDIRTARGET} namedb configinstall
243 ${MAKEDIRTARGET} powerd configinstall
244 ${MAKEDIRTARGET} rc.d configinstall
245 ${MAKEDIRTARGET} root configinstall
246 ${MAKEDIRTARGET} skel configinstall
247 ${MAKEDIRTARGET} ssh configinstall
248 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
249 postinstall ${DESTDIR}/etc
250 ${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
251 ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
252 ${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
253 /usr/sbin/rmt ${DESTDIR}/etc/rmt
254 ${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 664 \
255 /dev/null ${DESTDIR}/etc/dumpdates
256 ${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 600 \
257 /dev/null ${DESTDIR}/etc/skeykeys
258 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
259 /dev/null ${DESTDIR}/var/at/at.deny
260 ${ETC_INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 \
261 /dev/null ${DESTDIR}/var/db/locate.database
262 ${ETC_INSTALL_FILE} -o uucp -g dialer -m 640 \
263 /dev/null ${DESTDIR}/var/log/aculog
264 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
265 /dev/null ${DESTDIR}/var/log/authlog
266 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
267 /dev/null ${DESTDIR}/var/log/cron
268 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
269 /dev/null ${DESTDIR}/var/log/lastlog
270 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 640 \
271 /dev/null ${DESTDIR}/var/log/lpd-errs
272 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
273 /dev/null ${DESTDIR}/var/log/maillog
274 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
275 /dev/null ${DESTDIR}/var/log/messages
276 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
277 /dev/null ${DESTDIR}/var/log/secure
278 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
279 /dev/null ${DESTDIR}/var/log/sendmail.st
280 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
281 /dev/null ${DESTDIR}/var/log/wtmp
282 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
283 /dev/null ${DESTDIR}/var/log/wtmpx
284 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
285 /dev/null ${DESTDIR}/var/log/xferlog
286 ${ETC_INSTALL_FILE} -o daemon -g staff -m 664 \
287 /dev/null ${DESTDIR}/var/msgs/bounds
288 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
289 /dev/null ${DESTDIR}/var/run/utmp
290 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
291 /dev/null ${DESTDIR}/var/run/utmpx
292 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
293 /dev/null ${DESTDIR}/var/games/atc_score
294 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
295 /dev/null ${DESTDIR}/var/games/battlestar.log
296 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
297 /dev/null ${DESTDIR}/var/games/cfscores
298 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
299 /dev/null ${DESTDIR}/var/games/criblog
300 ${ETC_INSTALL_FILE} -o games -g games -m 660 \
301 /dev/null ${DESTDIR}/var/games/hackdir/perm
302 ${ETC_INSTALL_FILE} -o games -g games -m 660 \
303 /dev/null ${DESTDIR}/var/games/hackdir/record
304 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
305 /dev/null ${DESTDIR}/var/games/larn/llog12.0
306 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
307 /dev/null ${DESTDIR}/var/games/larn/lscore12.0
308 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
309 /dev/null ${DESTDIR}/var/games/larn/playerids
310 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
311 /dev/null ${DESTDIR}/var/games/robots_roll
312 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
313 /dev/null ${DESTDIR}/var/games/rogue.scores
314 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
315 /dev/null ${DESTDIR}/var/games/saillog
316 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
317 /dev/null ${DESTDIR}/var/games/snakerawscores
318 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
319 /dev/null ${DESTDIR}/var/games/snake.log
320 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
321 /dev/null ${DESTDIR}/var/games/tetris.scores
322 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall
323 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/gnu/usr.sbin/postfix configinstall
324 .if (${MKCRYPTO} != "no")
325 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/ssh configinstall
326 .endif
327 .if (${MKSENDMAIL} != "no")
328 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/gnu/usr.sbin/sendmail/cf/cf configinstall
329 .endif
330
331
332 # install-obsolete-lists --
333 # Install var/db/obsolete set lists; this is performed by "make build"
334 #
335 OBSOLETE.dir= ${.OBJDIR}/obsolete.dir
336 OBSOLETE.files= base comp etc games man misc text
337
338 install-obsolete-lists: .PHONY
339 mkdir -p ${OBSOLETE.dir}
340 (cd ${NETBSDSRCDIR}/distrib/sets && \
341 MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
342 .for file in ${OBSOLETE.files}
343 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
344 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete
345 .endfor
346
347
348 # distrib-dirs --
349 # Populate $DESTDIR with directories needed by NetBSD
350 #
351 .if ${MKUNPRIVED} == "no"
352 TOOL_MTREE.unpriv=
353 .else
354 TOOL_MTREE.unpriv= -W
355 .endif
356
357 distrib-dirs: .PHONY check_DESTDIR
358 .if !defined(DISTRIBUTION_DONE)
359 ${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
360 .endif
361 ${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
362 -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
363
364
365 # release, snapshot --
366 # Build a full distribution including kernels & install media.
367 #
368 release snapshot: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
369 distribution .WAIT \
370 snap_pre .WAIT snap_kern .WAIT \
371 snap_post .WAIT snap_md_post
372 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets
373 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz'
374
375
376 # iso-image --
377 # Standalone target to create a CDROM image after the release
378 # was composed. Should be run after "make release" in src and xsrc.
379 #
380 # Note: At least mkisofs 2.0 should be used.
381 #
382 CDROM.image=${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom/netbsd-${MACHINE}.iso
383 CDROM.dir= cdrom.dir
384 CDROM.pathlist= cdrom.pathlist
385
386 iso-image: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-md-post
387 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom '*.iso'
388 @echo "iso-image created as: ${CDROM.image}"
389
390 iso-image-setup: .PHONY check_RELEASEDIR
391 rm -f ${CDROM.pathlist}
392 echo "${MACHINE}=${RELEASEDIR}/${RELEASEMACHINEDIR}" >> ${CDROM.pathlist}
393 mkdir -p ${CDROM.dir}
394 mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom
395
396 # iso-image-mi --
397 # Create the image after the MD operations have completed.
398 #
399 iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
400 iso-image-setup .WAIT iso-image-md-pre
401 @if ! ${MKISOFS} --version; then \
402 echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \
403 false; \
404 fi
405 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
406 -o ${CDROM.image} ${CDROM.dir}
407
408 # iso-image-md-pre --
409 # Setup ${CDROM.dir} to produce a bootable CD image.
410 # Overridden by etc.$MACHINE/Makefile.inc
411 #
412 iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR
413 # (empty -- look in the machine-dependent Makefile.inc)
414
415 # iso-image-md-post --
416 # Fixup the CD-image to be bootable.
417 # Overridden by etc.$MACHINE/Makefile.inc
418 #
419 iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-mi
420 # (empty -- look in the machine-dependent Makefile.inc)
421
422
423 # snap_pre --
424 # Create ${RELEASEDIR} and necessary subdirectories.
425 #
426 snap_pre: .PHONY check_DESTDIR check_RELEASEDIR
427 ${INSTALL} -d -m 755 ${RELEASEDIR}
428 .if ${MKUPDATE} == "no"
429 # Could be a mount point, ignore the errors
430 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR}
431 .endif
432 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}
433 .for dir in ${INSTALLATION_DIRS}
434 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir}
435 .endfor
436
437 # snap_post --
438 # Build the install media and notes from distrib
439 #
440 snap_post: .PHONY check_DESTDIR check_RELEASEDIR
441 .if ${MKUPDATE} == "no"
442 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
443 .endif
444 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
445 ${MAKE} release
446
447 # snap_kern --
448 # This target builds the kernels specified by each port.
449 # A port may specify the following kernels:
450 #
451 # KERNEL_SETS The list of kernels that will be
452 # packaged into sets, named
453 # kern-${kernel}.tgz. These kernels
454 # are also placed in the binary/kernel
455 # area of the release package as
456 # netbsd-${kernel}.gz.
457 #
458 # EXTRA_KERNELS Additional kernels to place in the
459 # binary/kernel area of the release
460 # package as netbsd-${kernel}.gz, but
461 # which are not placed into sets. This
462 # allows a port to provide e.g. a netbootable
463 # installation kernel containing a ramdisk.
464 #
465 # BUILD_KERNELS Additional kernels to build which are
466 # not placed into sets nor into the
467 # binary/kernel area of the release
468 # package. These are typically kernels
469 # that are built for inclusion only in
470 # installation disk/CD-ROM/tape images.
471 #
472 # A port may also specify KERNEL_SUFFIXES, which is an optional list
473 # of filename suffixes for kernels to include in the kernel sets and
474 # in the binary/kernel area of the release package (e.g. "netbsd" vs.
475 # "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels
476 # with these suffixes do not exist in the kernel build directory.
477 #
478 #
479 # A list of all the kernels to build, which can be overridden from
480 # external sources (such as make(1)'s environment or command line)
481 #
482 ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
483
484 GETKERNELAWK= awk '/^config/ {print $$2; found=1} \
485 END{ if (found == 0) print "netbsd"; }'
486
487 .if !target(snap_kern) # {
488
489 # build_kernels --
490 # Configure & compile kernels listed in ${ALL_KERNELS}
491 #
492 # The 'sync' is so that all writes during the build are pushed back
493 # to the disk. Not having it causes problems on some host systems
494 # (e.g. Linux) when building on NFS.
495 #
496 .if !defined(KERNELS_DONE) # {
497 .for configfile in ${ALL_KERNELS} # {
498 _KERNELS_TO_BUILD+=kern-${configfile}
499 kern-${configfile}: .PHONY
500 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \
501 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
502 .if ${MKUPDATE} == "no"
503 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
504 .endif
505 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
506 sync
507 .endfor # ALL_KERNELS # }
508 .endif # KERNELS_DONE # }
509
510 build_kernels: .PHONY ${_KERNELS_TO_BUILD}
511
512 # build_kernelsets --
513 # Create kernel sets from ${KERNEL_SETS} into
514 # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
515 #
516 .for configfile in ${KERNEL_SETS} # {
517 _KERNELSETS_TO_BUILD+=kernset-${configfile}
518 kernset-${configfile}: .PHONY
519 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
520 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
521 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
522 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \
523 pax_cmd="GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \
524 cd $${kerndir} && { \
525 kernels=; newest=; \
526 for kernel in $${kernlist}; do \
527 for s in "" $${kernsuffixes}; do \
528 ks="$${kernel}$${s}"; \
529 [ -f $${ks} ] || continue; \
530 kernels="$${kernels} $${ks}"; \
531 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \
532 newest=$${ks}; \
533 done; \
534 done; \
535 [ $${kern_tgz} -nt "$${newest}" ] || { \
536 echo "echo $${kernels} | $${pax_cmd}"; \
537 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
538 echo ". type=dir optional"; \
539 for kernel in $${kernels}; do \
540 echo "./$${kernel} type=file"; \
541 done ) | eval $${pax_cmd}; \
542 } \
543 }
544 .endfor # KERNEL_SETS # }
545
546 build_kernelsets: ${_KERNELSETS_TO_BUILD}
547
548 # build_releasekernels --
549 # Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
550 # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel
551 #
552 .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # {
553 _RELEASEKERNELS_TO_BUILD+=releasekern-${configfile}
554 releasekern-${configfile}: .PHONY
555 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
556 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
557 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
558 cd $${kerndir} && { \
559 for kernel in $${kernlist}; do \
560 for s in "" $${kernsuffixes}; do \
561 ks="$${kernel}$${s}"; \
562 [ ! -f $${ks} ] && continue; \
563 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${ks}-${configfile:C/.*\///}.gz"; \
564 [ $${knl_gz} -nt $${ks} ] && continue; \
565 echo "gzip -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \
566 gzip -c -9 < $${ks} > $${knl_gz}; \
567 done; \
568 done; \
569 }
570 .endfor # KERNEL_SETS EXTRA_KERNELS # }
571
572 build_releasekernels: ${_RELEASEKERNELS_TO_BUILD}
573
574 # snap_kern --
575 # build the kernels, then the sets & release kernels
576 #
577 snap_kern: check_DESTDIR check_RELEASEDIR .WAIT \
578 build_kernels .WAIT \
579 build_kernelsets build_releasekernels
580
581 .endif # !target(snap_kern) # }
582
583
584 # snap_md_post --
585 # Machine dependent distribution media operations.
586 # Overridden by etc.$MACHINE/Makefile.inc
587 #
588 snap_md_post: check_DESTDIR check_RELEASEDIR
589 # (empty -- look in the machine-dependent Makefile.inc)
590
591
592 clean:
593 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
594
595 .include <bsd.prog.mk>
596