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