Makefile revision 1.279 1 # $NetBSD: Makefile,v 1.279 2004/01/31 15:40:42 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/${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: .PHONY 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 (cd ${NETBSDSRCDIR}/distrib/sets && ${MAKE} makesetfiles)
149 .endif # !DISTRIBUTION_DONE
150
151
152 CLEANFILES+= MAKEDEV
153 MAKEDEV: .EXEC
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 NETBSDSRCDIR \
176 NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
177 OBJMACHINE \
178 RELEASEDIR TOOLCHAIN_MISSING TOOLDIR \
179 USETOOLS USR_OBJMACHINE \
180 X11SRCDIR
181
182 params: .PHONY
183 .for var in ${RELEASEVARS}
184 .if defined(${var})
185 @printf "%20s = '%-s'\n" ${var} ${${var}:Q}
186 .else
187 @printf "%20s = (undefined)\n" ${var}
188 .endif
189 .endfor
190
191 CLEANFILES+= etc-release
192 etc-release: .EXEC
193 ${_MKTARGET_CREATE}
194 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \
195 echo " $$(date -u)"; \
196 echo " $${USER-root}@$$(hostname)"; \
197 echo ; \
198 cat ${NETBSDSRCDIR}/sys/conf/copyright; \
199 echo ; \
200 echo "Build settings:"; \
201 (cd ${.CURDIR}; ${MAKE} ${MFLAGS} params); \
202 ) >${.OBJDIR}/${.TARGET}
203
204 install-etc-release: .PHONY etc-release
205 ${_MKMSG_INSTALL} etc/release
206 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
207 etc-release ${DESTDIR}/etc/release
208
209 # install-etc-files --
210 # Install etc (config) files; not performed by "make build"
211 #
212 install-etc-files: .PHONY check_DESTDIR MAKEDEV
213 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
214 ${BIN1} ${DESTDIR}/etc
215 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
216 ${BIN2} ${DESTDIR}/etc
217 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
218 ${BIN3} ${DESTDIR}/etc
219 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
220 aliases ${DESTDIR}/etc/mail
221 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
222 /dev/null ${DESTDIR}/etc/mail/local-host-names
223 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
224 crontab ${DESTDIR}/var/cron/tabs/root
225 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
226 master.passwd ${DESTDIR}/etc
227 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
228 ${DESTDIR}/etc/master.passwd
229 .if ${MKUNPRIVED} != "no"
230 ( \
231 for metaent in passwd pwd.db spwd.db; do \
232 echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
233 done; \
234 ) | ${METALOG.add}
235 .endif # MKUNPRIVED != no
236 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
237 MAKEDEV ${DESTDIR}/dev
238 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
239 MAKEDEV.local ${DESTDIR}/dev
240 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
241 minfree ${DESTDIR}/var/crash
242 .for file in cshrc login profile shrc
243 ${ETC_INSTALL_FILE} -o root -g wheel -m 644 \
244 root/dot.${file} ${DESTDIR}/root/.${file}
245 .endfor
246 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
247 root/dot.klogin ${DESTDIR}/root/.klogin
248 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile
249 ${ETC_INSTALL_LINK} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc
250 ${ETC_INSTALL_LINK} ${DESTDIR}/root/.profile ${DESTDIR}/.profile
251 (cd ${.CURDIR}/defaults; ${MAKE} install)
252 (cd ${.CURDIR}/mtree; ${MAKE} install)
253 .for file in ${NAMEDB}
254 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
255 namedb/${file} ${DESTDIR}/etc/namedb
256 .endfor
257 .for file in ${SSH}
258 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
259 ssh/${file} ${DESTDIR}/etc/ssh
260 .endfor
261 (cd ${.CURDIR}/powerd; ${MAKE} install)
262 (cd ${.CURDIR}/rc.d; ${MAKE} install)
263 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
264 postinstall ${DESTDIR}/etc
265 ${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
266 ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
267 ${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \
268 /usr/sbin/rmt ${DESTDIR}/etc/rmt
269 ${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 664 \
270 /dev/null ${DESTDIR}/etc/dumpdates
271 ${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 600 \
272 /dev/null ${DESTDIR}/etc/skeykeys
273 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
274 /dev/null ${DESTDIR}/var/at/at.deny
275 ${ETC_INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 \
276 /dev/null ${DESTDIR}/var/db/locate.database
277 ${ETC_INSTALL_FILE} -o uucp -g dialer -m 640 \
278 /dev/null ${DESTDIR}/var/log/aculog
279 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
280 /dev/null ${DESTDIR}/var/log/authlog
281 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
282 /dev/null ${DESTDIR}/var/log/cron
283 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \
284 /dev/null ${DESTDIR}/var/log/lastlog
285 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 640 \
286 /dev/null ${DESTDIR}/var/log/lpd-errs
287 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
288 /dev/null ${DESTDIR}/var/log/maillog
289 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
290 /dev/null ${DESTDIR}/var/log/messages
291 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
292 /dev/null ${DESTDIR}/var/log/secure
293 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
294 /dev/null ${DESTDIR}/var/log/sendmail.st
295 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
296 /dev/null ${DESTDIR}/var/log/wtmp
297 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
298 /dev/null ${DESTDIR}/var/log/wtmpx
299 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \
300 /dev/null ${DESTDIR}/var/log/xferlog
301 ${ETC_INSTALL_FILE} -o daemon -g staff -m 664 \
302 /dev/null ${DESTDIR}/var/msgs/bounds
303 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
304 /dev/null ${DESTDIR}/var/run/utmp
305 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \
306 /dev/null ${DESTDIR}/var/run/utmpx
307 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
308 /dev/null ${DESTDIR}/var/games/atc_score
309 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
310 /dev/null ${DESTDIR}/var/games/battlestar.log
311 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
312 /dev/null ${DESTDIR}/var/games/cfscores
313 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
314 /dev/null ${DESTDIR}/var/games/criblog
315 ${ETC_INSTALL_FILE} -o games -g games -m 660 \
316 /dev/null ${DESTDIR}/var/games/hackdir/perm
317 ${ETC_INSTALL_FILE} -o games -g games -m 660 \
318 /dev/null ${DESTDIR}/var/games/hackdir/record
319 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
320 /dev/null ${DESTDIR}/var/games/larn/llog12.0
321 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
322 /dev/null ${DESTDIR}/var/games/larn/lscore12.0
323 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
324 /dev/null ${DESTDIR}/var/games/larn/playerids
325 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
326 /dev/null ${DESTDIR}/var/games/robots_roll
327 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
328 /dev/null ${DESTDIR}/var/games/rogue.scores
329 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
330 /dev/null ${DESTDIR}/var/games/saillog
331 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
332 /dev/null ${DESTDIR}/var/games/snakerawscores
333 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
334 /dev/null ${DESTDIR}/var/games/snake.log
335 ${ETC_INSTALL_FILE} -o games -g games -m 664 \
336 /dev/null ${DESTDIR}/var/games/tetris.scores
337 (cd ${.CURDIR}/skel; ${MAKE} distribution)
338 (cd ${NETBSDSRCDIR}/usr.bin/mail; ${MAKE} distribution)
339 (cd ${NETBSDSRCDIR}/gnu/usr.sbin/postfix/; ${MAKE} distribution)
340 .if (${MKCRYPTO} != "no")
341 (cd ${NETBSDSRCDIR}/usr.bin/ssh; ${MAKE} distribution)
342 .endif
343 .if (${MKSENDMAIL} != "no")
344 (cd ${NETBSDSRCDIR}/gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
345 .endif
346
347
348 # install-obsolete-lists --
349 # Install var/db/obsolete set lists; this is performed by "make build"
350 #
351 OBSOLETE.dir= ${.OBJDIR}/obsolete.dir
352 OBSOLETE.files= base comp etc games man misc text
353
354 install-obsolete-lists: .PHONY
355 mkdir -p ${OBSOLETE.dir}
356 (cd ${NETBSDSRCDIR}/distrib/sets && \
357 MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
358 .for file in ${OBSOLETE.files}
359 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
360 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete
361 .endfor
362
363
364 # distrib-dirs --
365 # Populate $DESTDIR with directories needed by NetBSD
366 #
367 .if ${MKUNPRIVED} == "no"
368 TOOL_MTREE.unpriv=
369 .else
370 TOOL_MTREE.unpriv= -W
371 .endif
372
373 distrib-dirs: .PHONY check_DESTDIR
374 .if !defined(DISTRIBUTION_DONE)
375 ${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR}
376 .endif
377 ${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \
378 -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
379
380
381 # release, snapshot --
382 # Build a full distribution including kernels & install media.
383 #
384 release snapshot: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
385 distribution .WAIT \
386 snap_pre .WAIT snap_kern .WAIT \
387 snap_post .WAIT snap_md_post
388 (cd ${NETBSDSRCDIR}/distrib/sets; ${MAKE} sets)
389 ${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/binary/kernel '*.gz'
390
391
392 # iso-image --
393 # Standalone target to create a CDROM image after the release
394 # was composed. Should be run after "make release" in src and xsrc.
395 #
396 # Note: At least mkisofs 2.0 should be used.
397 #
398 CDROM.image=${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-${MACHINE}.iso
399 CDROM.dir= cdrom.dir
400 CDROM.pathlist= cdrom.pathlist
401
402 iso-image: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-md-post
403 ${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/installation/cdrom '*.iso'
404 @echo "iso-image created as: ${CDROM.image}"
405
406 iso-image-setup: .PHONY check_RELEASEDIR
407 rm -f ${CDROM.pathlist}
408 echo "${MACHINE}=${RELEASEDIR}/${MACHINE}" >> ${CDROM.pathlist}
409 mkdir -p ${CDROM.dir}
410 mkdir -p ${RELEASEDIR}/${MACHINE}/installation/cdrom
411
412 # iso-image-mi --
413 # Create the image after the MD operations have completed.
414 #
415 iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \
416 iso-image-setup .WAIT iso-image-md-pre
417 @if ! ${MKISOFS} --version; then \
418 echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \
419 false; \
420 fi
421 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
422 -o ${CDROM.image} ${CDROM.dir}
423
424 # iso-image-md-pre --
425 # Setup ${CDROM.dir} to produce a bootable CD image.
426 # Overridden by etc.$MACHINE/Makefile.inc
427 #
428 iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR
429 # (empty -- look in the machine-dependent Makefile.inc)
430
431 # iso-image-md-post --
432 # Fixup the CD-image to be bootable.
433 # Overridden by etc.$MACHINE/Makefile.inc
434 #
435 iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-mi
436 # (empty -- look in the machine-dependent Makefile.inc)
437
438
439 # snap_pre --
440 # Create ${RELEASEDIR} and necessary subdirectories.
441 #
442 snap_pre: .PHONY check_DESTDIR check_RELEASEDIR
443 ${INSTALL} -d -m 755 ${RELEASEDIR}
444 .if ${MKUPDATE} == "no"
445 # Could be a mount point, ignore the errors
446 -/bin/rm -rf ${RELEASEDIR}/${MACHINE}
447 .endif
448 ${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}
449 .for dir in ${INSTALLATION_DIRS}
450 ${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}/${dir}
451 .endfor
452
453 # snap_post --
454 # Build the install media and notes from distrib
455 #
456 snap_post: .PHONY check_DESTDIR check_RELEASEDIR
457 .if ${MKUPDATE} == "no"
458 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
459 .endif
460 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
461 ${MAKE} release
462
463 # snap_kern --
464 # This target builds the kernels specified by each port.
465 # A port may specify the following kernels:
466 #
467 # KERNEL_SETS The list of kernels that will be
468 # packaged into sets, named
469 # kern-${kernel}.tgz. These kernels
470 # are also placed in the binary/kernel
471 # area of the release package as
472 # netbsd-${kernel}.gz.
473 #
474 # EXTRA_KERNELS Additional kernels to place in the
475 # binary/kernel area of the release
476 # package as netbsd-${kernel}.gz, but
477 # which are not placed into sets. This
478 # allows a port to provide e.g. a netbootable
479 # installation kernel containing a ramdisk.
480 #
481 # BUILD_KERNELS Additional kernels to build which are
482 # not placed into sets nor into the
483 # binary/kernel area of the release
484 # package. These are typically kernels
485 # that are built for inclusion only in
486 # installation disk/CD-ROM/tape images.
487 #
488 # A port may also specify KERNEL_SUFFIXES, which is an optional list
489 # of filename suffixes for kernels to include in the kernel sets and
490 # in the binary/kernel area of the release package (e.g. "netbsd" vs.
491 # "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels
492 # with these suffixes do not exist in the kernel build directory.
493 #
494 #
495 # A list of all the kernels to build, which can be overridden from
496 # external sources (such as make(1)'s environment or command line)
497 #
498 ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
499
500 GETKERNELAWK= awk '/^config/ {print $$2; found=1} \
501 END{ if (found == 0) print "netbsd"; }'
502
503 .if !target(snap_kern) # {
504
505 # build_kernels --
506 # Configure & compile kernels listed in ${ALL_KERNELS}
507 #
508 .if !defined(KERNELS_DONE) # {
509 .for configfile in ${ALL_KERNELS} # {
510 _KERNELS_TO_BUILD+=kern-${configfile}
511 kern-${configfile}: .PHONY
512 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \
513 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
514 .if ${MKUPDATE} == "no"
515 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
516 .endif
517 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
518 .endfor # ALL_KERNELS # }
519 .endif # KERNELS_DONE # }
520
521 build_kernels: .PHONY ${_KERNELS_TO_BUILD}
522
523 # build_kernelsets --
524 # Create kernel sets from ${KERNEL_SETS} into
525 # ${RELEASEDIR}/${MACHINE}/binary/sets
526 #
527 .for configfile in ${KERNEL_SETS} # {
528 _KERNELSETS_TO_BUILD+=kernset-${configfile}
529 kernset-${configfile}: .PHONY
530 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
531 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
532 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
533 kern_tgz=${RELEASEDIR}/${MACHINE}/binary/sets/kern-${configfile}.tgz; \
534 pax_cmd="GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \
535 cd $${kerndir} && { \
536 kernels=; newest=; \
537 for kernel in $${kernlist}; do \
538 for s in "" $${kernsuffixes}; do \
539 ks="$${kernel}$${s}"; \
540 [ -f $${ks} ] || continue; \
541 kernels="$${kernels} $${ks}"; \
542 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \
543 newest=$${ks}; \
544 done; \
545 done; \
546 [ $${kern_tgz} -nt "$${newest}" ] || { \
547 echo "echo $${kernels} | $${pax_cmd}"; \
548 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
549 echo ". type=dir optional"; \
550 for kernel in $${kernels}; do \
551 echo "./$${kernel} type=file"; \
552 done ) | eval $${pax_cmd}; \
553 } \
554 }
555 .endfor # KERNEL_SETS # }
556
557 build_kernelsets: ${_KERNELSETS_TO_BUILD}
558
559 # build_releasekernels --
560 # Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
561 # ${RELEASEDIR}/${MACHINE}/binary/kernel
562 #
563 .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # {
564 _RELEASEKERNELS_TO_BUILD+=releasekern-${configfile}
565 releasekern-${configfile}: .PHONY
566 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
567 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
568 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
569 cd $${kerndir} && { \
570 for kernel in $${kernlist}; do \
571 for s in "" $${kernsuffixes}; do \
572 ks="$${kernel}$${s}"; \
573 [ ! -f $${ks} ] && continue; \
574 knl_gz="${RELEASEDIR}/${MACHINE}/binary/kernel/$${ks}-${configfile:C/.*\///}.gz"; \
575 [ $${knl_gz} -nt $${ks} ] && continue; \
576 echo "gzip -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \
577 gzip -c -9 < $${ks} > $${knl_gz}; \
578 done; \
579 done; \
580 }
581 .endfor # KERNEL_SETS EXTRA_KERNELS # }
582
583 build_releasekernels: ${_RELEASEKERNELS_TO_BUILD}
584
585 # snap_kern --
586 # build the kernels, then the sets & release kernels
587 #
588 snap_kern: check_DESTDIR check_RELEASEDIR .WAIT \
589 build_kernels .WAIT \
590 build_kernelsets build_releasekernels
591
592 .endif # !target(snap_kern) # }
593
594
595 # snap_md_post --
596 # Machine dependent distribution media operations.
597 # Overridden by etc.$MACHINE/Makefile.inc
598 #
599 snap_md_post: check_DESTDIR check_RELEASEDIR
600 # (empty -- look in the machine-dependent Makefile.inc)
601
602
603 clean:
604 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
605
606 .include <bsd.prog.mk>
607