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