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