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