Add Hama WLAN PCI Card 54 Mbps to recognized cards. Bump date.
[netbsd-mini2440.git] / etc / Makefile
blobfabf5cde985e2326ea2a79426219088bfc7b9d37
1 # $NetBSD: Makefile,v 1.375 2009/12/05 19:14:39 pooka Exp $
2 # from: @(#)Makefile 8.7 (Berkeley) 5/25/95
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.
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 # MKPOSTFIX; if not `no', install postfix configuration
20 # MKUNPRIVED; if not `no', allow non-root installs.
21 # MKUPDATE; if not `no', don't do a 'make clean' before kernel compile
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'
36 # For MK* vars
37 .include <bsd.own.mk>
39 .include <bsd.sys.mk> # for HOST_SH, TOOL_AWK, ...
40 .include <bsd.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ...
41 .include <bsd.endian.mk> # For TARGET_ENDIANNESS
43 .MAKEOVERRIDES+= USETOOLS
45 TZDIR= /usr/share/zoneinfo
46 LOCALTIME?= UTC
47 CKSUM?= ${TOOL_CKSUM}
48 MAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums
49 DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh
51 # Flags for creating ISO CDROM image
52 # mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools
53 # Note: At least mkisofs 2.0 should be used.
55 .if !defined(MKISOFS)
56 MKISOFS!= (which mkisofs || echo true)
57 .endif
58 DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s
59 # ISO 9660 volume ID. Note that this can only contain [A-Z0-9_].
60 ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z
61 MKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \
62 -V ${ISO_VOLID} \
63 -publisher "The NetBSD Project" \
64 -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom"
65 .if ${MKISOFS_FLAGS:N-v}
66 MKISOFS_FLAGS+= -quiet
67 .endif
70 # MD Makefile.inc may append MD targets to BIN[123]. Make sure all
71 # are empty, to preserve the old semantics of setting them below with "+=".
73 BIN1=
74 BIN2=
75 BIN3=
77 # Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}.
78 # MD Makefile.inc files can add to this.
79 # NOTE: Parent directories must be listed before subdirectories.
81 INSTALLATION_DIRS= binary binary/sets binary/kernel installation
83 .if exists(etc.${RELEASEMACHINE}/Makefile.inc)
84 .include "etc.${RELEASEMACHINE}/Makefile.inc"
85 .endif
87 # -rw-r--r--
88 BINOWN= root
89 BINGRP= wheel
90 UTMPGRP= utmp
91 BIN1+= bootptab changelist csh.cshrc csh.login \
92 csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \
93 ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \
94 locate.conf login.conf mailer.conf man.conf monthly monthly.conf \
95 mrouted.conf named.conf netconfig networks newsyslog.conf \
96 nsswitch.conf ntp.conf passwd.conf phones printcap profile protocols \
97 rbootd.conf rc rc.conf rc.local rc.subr rc.shutdown remote rpc \
98 security security.conf services shells shrc sysctl.conf syslog.conf \
99 weekly weekly.conf wscons.conf
101 # Use machine-specific disktab if it exists, or the MI one otherwise
102 .if exists(etc.${MACHINE}/disktab)
103 BIN1+= etc.${MACHINE}/disktab
104 .else
105 BIN1+= disktab
106 .endif
108 .if exists(etc.${MACHINE}/ld.so.conf)
109 BIN1+= etc.${MACHINE}/ld.so.conf
110 .endif
112 .if exists(etc.${MACHINE}/ttyaction)
113 BIN1+= etc.${MACHINE}/ttyaction
114 .endif
116 # -rw-rw-r--
117 .if !empty(DISTRIBVER:M*.99.*)
118 BIN2+= motd.current
119 FILESNAME_motd.current= motd
120 .elif !empty(DISTRIBVER:M*BETA*)
121 BIN2+= motd.beta
122 FILESNAME_motd.beta= motd
123 .elif !empty(DISTRIBVER:M*RC*)
124 BIN2+= motd.rc
125 FILESNAME_motd.rc= motd
126 .elif !empty(DISTRIBVER:M*STABLE*)
127 BIN2+= motd.stable
128 FILESNAME_motd.stable= motd
129 .else
130 BIN2+= motd
131 .endif
133 # -rw-------
134 BIN3+= hosts.equiv
136 SYSPKG= etc
137 ETC_PKG=-T etc_pkg
138 BASE_PKG=-T base_pkg
139 ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG}
140 ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG}
142 .if ${TARGET_ENDIANNESS} == "1234"
143 PWD_MKDB_ENDIAN= -L
144 .elif ${TARGET_ENDIANNESS} == "4321"
145 PWD_MKDB_ENDIAN= -B
146 .else
147 PWD_MKDB_ENDIAN=
148 .endif
151 # distribution --
152 # Build a distribution
154 distribution: .PHONY .MAKE check_DESTDIR distrib-dirs
155 .if !defined(DISTRIBUTION_DONE)
156 .if !defined(INSTALL_DONE)
157 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB=
158 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB=
159 .endif # !INSTALL_DONE
160 ${MAKEDIRTARGET} . install-etc-files
161 . if ${MKX11} != "no"
162 . if ${X11FLAVOUR} == "Xorg"
163 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution
164 . else
165 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/x11 distribution
166 . endif
167 . endif
168 . if ${MKEXTSRC} != "no"
169 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution
170 . endif
171 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles
172 .endif # !DISTRIBUTION_DONE
175 CLEANFILES+= MAKEDEV
176 MAKEDEV: .EXEC
177 ${_MKTARGET_CREATE}
178 MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
179 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \
180 ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
181 > ${.TARGET}
183 RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID \
184 DESTDIR EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \
185 INSTALLWORLDDIR \
186 KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \
187 MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \
188 MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
189 MKBFD MKBINUTILS MKCATPAGES \
190 MKCRYPTO MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKCVS \
191 MKDEBUG MKDEBUGLIB MKDOC MKDYNAMICROOT \
192 MKGCC MKGCCCMDS MKGDB \
193 MKHESIOD MKHOSTOBJ MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
194 MKKERBEROS MKLDAP MKLINKLIB MKLINT \
195 MKMAN MKMANZ MKMDNS MKNLS MKNVI MKOBJ MKOBJDIRS \
196 MKPAM MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
197 MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
198 MKUNPRIVED MKUPDATE MKX11 MKYP \
199 NBUILDJOBS NETBSDSRCDIR \
200 NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
201 OBJMACHINE \
202 RELEASEDIR RELEASEMACHINEDIR TOOLCHAIN_MISSING TOOLDIR \
203 USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \
204 USE_PAM USE_SKEY USE_YP \
205 USETOOLS USR_OBJMACHINE \
206 X11SRCDIR X11FLAVOUR
208 params: .PHONY
209 .for var in ${RELEASEVARS}
210 .if defined(${var})
211 @printf "%20s = '%-s'\n" ${var} ${${var}:Q}
212 .else
213 @printf "%20s = (undefined)\n" ${var}
214 .endif
215 .endfor
217 CLEANFILES+= etc-release
218 etc-release: .EXEC .MAKE
219 ${_MKTARGET_CREATE}
220 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \
221 echo ; \
222 cat ${NETBSDSRCDIR}/sys/conf/copyright; \
223 echo ; \
224 echo "Build settings:"; \
225 printf "%20s %s\n" "Build date" "$$(date -u)"; \
226 printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \
227 echo ; \
228 (cd ${.CURDIR}; ${MAKE} ${MFLAGS} -j1 params); \
229 ) >${.OBJDIR}/${.TARGET}
231 install-etc-release: .PHONY etc-release
232 ${_MKMSG_INSTALL} etc/release
233 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \
234 etc-release ${DESTDIR}/etc/release
237 FILESDIR= /etc
238 CONFIGFILES=
239 CONFIGSYMLINKS=
241 .for file in ${BIN1}
242 CONFIGFILES+= ${file}
243 FILESMODE_${file:T}= 644
244 .endfor
246 .for file in ${BIN2}
247 CONFIGFILES+= ${file}
248 FILESMODE_${file:T}= 664
249 .endfor
251 .for file in ${BIN3}
252 CONFIGFILES+= ${file}
253 FILESMODE_${file:T}= 600
254 .endfor
256 .if (${MKPOSTFIX} != "no")
257 CONFIGFILES+= aliases
258 FILESDIR_aliases= /etc/mail
259 FILESMODE_aliases= 644
260 .endif
262 CONFIGFILES+= MAKEDEV.local
263 FILESDIR_MAKEDEV.local= /dev
264 FILESMODE_MAKEDEV.local=${BINMODE}
266 CONFIGFILES+= crontab
267 FILESDIR_crontab= /var/cron/tabs
268 FILESNAME_crontab= root
269 FILESMODE_crontab= 600
271 CONFIGFILES+= minfree
272 FILESDIR_minfree= /var/crash
273 FILESMODE_minfree= 600
275 CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \
276 /usr/sbin/rmt /etc/rmt
279 # install-etc-files --
280 # Install etc (config) files; not performed by "make build"
282 install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV
283 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd
284 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \
285 master.passwd ${DESTDIR}/etc
286 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \
287 ${DESTDIR}/etc/master.passwd
288 .if ${MKUNPRIVED} != "no"
290 for metaent in passwd pwd.db spwd.db; do \
291 echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \
292 done; \
293 ) | ${METALOG.add}
294 .endif # MKUNPRIVED != no
295 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys
296 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
297 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc
298 .if exists(etc.${MACHINE}/boot.cfg)
299 ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg
300 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
301 ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/
302 .endif
303 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV
304 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \
305 MAKEDEV ${DESTDIR}/dev
306 .for owner group mode file in \
307 ${BINOWN} operator 664 /etc/dumpdates \
308 ${BINOWN} operator 600 /etc/skeykeys \
309 root wheel 600 /var/at/at.deny \
310 nobody ${BINGRP} 664 /var/db/locate.database \
311 ${BINOWN} ${BINGRP} 600 /var/log/authlog \
312 root wheel 600 /var/log/cron \
313 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \
314 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \
315 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \
316 ${BINOWN} ${BINGRP} 600 /var/log/maillog \
317 ${BINOWN} ${BINGRP} 644 /var/log/messages \
318 ${BINOWN} ${BINGRP} 600 /var/log/secure \
319 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \
320 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \
321 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \
322 daemon staff 664 /var/msgs/bounds \
323 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \
324 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \
325 games games 664 /var/games/atc_score \
326 games games 664 /var/games/battlestar.log \
327 games games 664 /var/games/cfscores \
328 games games 664 /var/games/criblog \
329 games games 660 /var/games/hackdir/perm \
330 games games 660 /var/games/hackdir/record \
331 games games 664 /var/games/larn/llog12.0 \
332 games games 664 /var/games/larn/lscore12.0 \
333 games games 664 /var/games/larn/playerids \
334 games games 664 /var/games/robots_roll \
335 games games 664 /var/games/rogue.scores \
336 games games 664 /var/games/saillog \
337 games games 664 /var/games/snakerawscores \
338 games games 664 /var/games/snake.log \
339 games games 664 /var/games/tetris.scores
340 ${_MKMSG_INSTALL} ${DESTDIR}${file}
341 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \
342 /dev/null ${DESTDIR}${file}
343 .endfor
344 .for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh
345 ${MAKEDIRTARGET} ${subdir} configinstall
346 .endfor
347 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall
348 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall
349 .if (${MKPF} != "no")
350 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall
351 .endif
352 .if (${MKCRYPTO} != "no")
353 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall
354 .endif
355 .if (${MKPOSTFIX} != "no")
356 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall
357 .endif
358 .if (${MKATF} != "no")
359 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall
360 .endif
363 # install-obsolete-lists --
364 # Install var/db/obsolete set lists; this is performed by "make build"
366 OBSOLETE.dir= ${.OBJDIR}/obsolete.dir
367 OBSOLETE.files= base comp etc games man misc tests text
368 .if ${MKKMOD} != "no"
369 OBSOLETE.files+= modules
370 .endif
371 .if ${MKX11} != "no"
372 OBSOLETE.files+= xbase xcomp xetc xfont xserver
373 .endif
375 install-obsolete-lists: .PHONY .MAKE
376 mkdir -p ${OBSOLETE.dir}
377 .if ${MKX11} != "no"
378 (cd ${NETBSDSRCDIR}/distrib/sets && \
379 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir})
380 .else
381 (cd ${NETBSDSRCDIR}/distrib/sets && \
382 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir})
383 .endif
384 .for file in ${OBSOLETE.files}
385 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file}
386 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \
387 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete
388 .endfor
391 # distrib-dirs --
392 # Populate $DESTDIR with directories needed by NetBSD
394 distrib-dirs: .PHONY check_DESTDIR
395 cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs
398 # release, snapshot --
399 # Build a full distribution including kernels & install media.
401 release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post
402 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets
403 ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \
404 ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@}
405 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz'
408 # iso-image --
409 # Standalone target to create a CDROM image after the release
410 # was composed. Should be run after "make release" in src and xsrc.
411 # The do-iso-image is to be called from etc.$MACHINE/Makefile.inc
413 # Note: At least mkisofs 2.0 should be used.
415 CDROM_NAME_ADD?=
416 CDROM.image?=${RELEASEDIR}/iso/${MACHINE}cd.iso
417 CDROM.dir= ${.OBJDIR}/cdrom.dir
418 CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist
420 iso-image:
422 .if ${MKISOFS} != true
423 do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post
424 ${MAKESUMS} -t ${RELEASEDIR}/iso/ '*.iso'
425 @echo "iso-image created as: ${CDROM.image}"
426 .else
427 do-iso-image:
428 @echo iso-image: mkisofs not found
429 .endif
431 iso-image-setup: .PHONY check_RELEASEDIR
432 rm -f ${CDROM.pathlist}
433 .for extra in README SOURCE_DATE source
434 .if exists(${RELEASEDIR}/${extra})
435 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist}
436 .endif
437 .endfor
438 echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist}
439 mkdir -p ${CDROM.dir}
440 mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom
442 # iso-image-mi --
443 # Create the image after the MD operations have completed.
445 iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre
446 @if ! ${MKISOFS} --version; then \
447 echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \
448 false; \
450 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \
451 -o ${CDROM.image} ${CDROM.dir}
453 # iso-image-md-pre --
454 # Setup ${CDROM.dir} to produce a bootable CD image.
455 # Overridden by etc.$MACHINE/Makefile.inc
457 iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup
458 # (empty -- look in the machine-dependent Makefile.inc)
460 # iso-image-md-post --
461 # Fixup the CD-image to be bootable.
462 # Overridden by etc.$MACHINE/Makefile.inc
464 iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi
465 # (empty -- look in the machine-dependent Makefile.inc)
468 # snap_pre --
469 # Create ${RELEASEDIR} and necessary subdirectories.
471 snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution
472 ${INSTALL} -d -m 755 ${RELEASEDIR}
473 .if ${MKUPDATE} == "no"
474 # Could be a mount point, ignore the errors
475 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR}
476 .endif
477 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}
478 .for dir in ${INSTALLATION_DIRS}
479 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir}
480 .endfor
482 # snap_post --
483 # Build the install media and notes from distrib
485 snap_post: .PHONY .MAKE build_kernelsets build_releasekernels
486 .if ${MKUPDATE} == "no"
487 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir
488 .endif
489 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \
490 ${MAKE} release
492 # build kernels --
493 # This target builds the kernels specified by each port.
494 # A port may specify the following kernels:
496 # KERNEL_SETS The list of kernels that will be
497 # packaged into sets, named
498 # kern-${kernel}.tgz. These kernels
499 # are also placed in the binary/kernel
500 # area of the release package as
501 # netbsd-${kernel}.gz.
503 # EXTRA_KERNELS Additional kernels to place in the
504 # binary/kernel area of the release
505 # package as netbsd-${kernel}.gz, but
506 # which are not placed into sets. This
507 # allows a port to provide e.g. a netbootable
508 # installation kernel containing a ramdisk.
510 # BUILD_KERNELS Additional kernels to build which are
511 # not placed into sets nor into the
512 # binary/kernel area of the release
513 # package. These are typically kernels
514 # that are built for inclusion only in
515 # installation disk/CD-ROM/tape images.
517 # A port may also specify KERNEL_SUFFIXES, which is an optional list
518 # of filename suffixes for kernels to include in the kernel sets and
519 # in the binary/kernel area of the release package (e.g. "netbsd" vs.
520 # "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels
521 # with these suffixes do not exist in the kernel build directory.
524 # A list of all the kernels to build, which can be overridden from
525 # external sources (such as make(1)'s environment or command line)
527 ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS}
529 GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \
530 END{ if (found == 0) print "netbsd"; }'
532 build_kernels: .PHONY
533 # Configure & compile kernels listed in ${ALL_KERNELS}
535 # The 'sync' is so that all writes during the build are pushed back
536 # to the disk. Not having it causes problems on some host systems
537 # (e.g. Linux) when building on NFS.
539 .if !defined(KERNELS_DONE) # {
540 .for configfile in ${ALL_KERNELS} # {
541 build_kernels: kern-${configfile}
542 kern-${configfile}: .PHONY .MAKE
543 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \
544 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile}
545 .if ${MKUPDATE} == "no"
546 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean
547 .endif
548 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE}
549 sync
550 .endfor # ALL_KERNELS # }
551 .endif # KERNELS_DONE # }
553 build_kernelsets: .PHONY
554 # Create kernel sets from ${KERNEL_SETS} into
555 # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
557 .for configfile in ${KERNEL_SETS} # {
558 build_kernelsets: kernset-${configfile}
559 kernset-${configfile}: .PHONY build_kernels snap_pre
560 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \
561 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
562 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
563 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \
564 pax_cmd="GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \
565 cd $${kerndir} && { \
566 kernels=; newest=; \
567 for kernel in $${kernlist}; do \
568 for s in "" $${kernsuffixes}; do \
569 ks="$${kernel}$${s}"; \
570 [ -f $${ks} ] || continue; \
571 kernels="$${kernels} $${ks}"; \
572 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \
573 newest=$${ks}; \
574 done; \
575 done; \
576 [ $${kern_tgz} -nt "$${newest}" ] || { \
577 echo "echo $${kernels} | $${pax_cmd}"; \
578 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
579 echo ". type=dir optional"; \
580 for kernel in $${kernels}; do \
581 echo "./$${kernel} type=file"; \
582 done ) | eval $${pax_cmd}; \
585 .endfor # KERNEL_SETS # }
587 build_releasekernels: .PHONY
588 # Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into
589 # ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel
591 .for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # {
592 build_releasekernels: releasekern-${configfile}
593 releasekern-${configfile}: .PHONY build_kernels snap_pre
594 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \
595 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \
596 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
597 cd $${kerndir} && { \
598 for kernel in $${kernlist}; do \
599 for s in "" $${kernsuffixes}; do \
600 ks="$${kernel}$${s}"; \
601 [ ! -f $${ks} ] && continue; \
602 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${ks}-${configfile:C/.*\///}.gz"; \
603 [ $${knl_gz} -nt $${ks} ] && continue; \
604 rm -f $${knl_gz}; \
605 echo "gzip -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \
606 gzip -c -9 < $${ks} > $${knl_gz}; \
607 done; \
608 done; \
610 .endfor # KERNEL_SETS EXTRA_KERNELS # }
612 # snap_md_post --
613 # Machine dependent distribution media operations.
614 # Overridden by etc.$MACHINE/Makefile.inc
616 snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post
617 # (empty -- look in the machine-dependent Makefile.inc)
620 clean:
621 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir}
623 SUBDIR= rc.d mtree
625 .include <bsd.prog.mk>
626 .include <bsd.subdir.mk>
628 test:
629 @echo ${OBSOLETE.files}