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