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