Makefile revision 1.334
1# $NetBSD: Makefile,v 1.334 2006/08/05 13:07:30 jmmv 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 mailer.conf man.conf monthly monthly.conf mrouted.conf named.conf \ 93 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 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.else 125BIN2+= motd 126.endif 127 128# -rw------- 129BIN3+= hosts.equiv 130 131SYSPKG= etc 132ETC_PKG=-T etc_pkg 133BASE_PKG=-T base_pkg 134ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} 135ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} 136 137.if ${TARGET_ENDIANNESS} == "1234" 138PWD_MKDB_ENDIAN= -L 139.elif ${TARGET_ENDIANNESS} == "4321" 140PWD_MKDB_ENDIAN= -B 141.else 142PWD_MKDB_ENDIAN= 143.endif 144 145 146# distribution -- 147# Build a distribution 148# 149distribution: .PHONY .MAKE check_DESTDIR distrib-dirs 150.if !defined(DISTRIBUTION_DONE) 151.if !defined(INSTALL_DONE) 152 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB= 153 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB= 154.endif # !INSTALL_DONE 155 ${MAKEDIRTARGET} . install-etc-files 156.if ${MKX11} != "no" 157 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/x11 distribution 158.endif 159 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles 160.endif # !DISTRIBUTION_DONE 161 162 163CLEANFILES+= MAKEDEV 164MAKEDEV: .EXEC 165 ${_MKTARGET_CREATE} 166 MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 167 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ 168 awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET} 169 170RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID \ 171 DESTDIR EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \ 172 INSTALLWORLDDIR \ 173 KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \ 174 MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \ 175 MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \ 176 MKBFD MKCATPAGES \ 177 MKCRYPTO MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKCVS \ 178 MKDEBUG MKDEBUGLIB MKDOC MKDYNAMICROOT \ 179 MKGCC MKGCCCMDS MKGDB \ 180 MKHESIOD MKHOSTOBJ MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \ 181 MKKERBEROS MKLINKLIB MKLINT \ 182 MKMAN MKMANZ MKNLS MKOBJ MKOBJDIRS \ 183 MKPAM MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \ 184 MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \ 185 MKUNPRIVED MKUPDATE MKUUCP MKX11 MKYP \ 186 NBUILDJOBS NETBSDSRCDIR \ 187 NOCLEANDIR NODISTRIBDIRS NOINCLUDES \ 188 OBJMACHINE \ 189 RELEASEDIR TOOLCHAIN_MISSING TOOLDIR \ 190 USETOOLS USR_OBJMACHINE \ 191 X11SRCDIR 192 193params: .PHONY 194.for var in ${RELEASEVARS} 195.if defined(${var}) 196 @printf "%20s = '%-s'\n" ${var} ${${var}:Q} 197.else 198 @printf "%20s = (undefined)\n" ${var} 199.endif 200.endfor 201 202CLEANFILES+= etc-release 203etc-release: .EXEC .MAKE 204 ${_MKTARGET_CREATE} 205 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \ 206 echo ; \ 207 cat ${NETBSDSRCDIR}/sys/conf/copyright; \ 208 echo ; \ 209 echo "Build settings:"; \ 210 printf "%20s %s\n" "Build date" "$$(date -u)"; \ 211 printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \ 212 echo ; \ 213 (cd ${.CURDIR}; ${MAKE} ${MFLAGS} -j1 params); \ 214 ) >${.OBJDIR}/${.TARGET} 215 216install-etc-release: .PHONY etc-release 217 ${_MKMSG_INSTALL} etc/release 218 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \ 219 etc-release ${DESTDIR}/etc/release 220 221 222FILESDIR= /etc 223CONFIGFILES= 224CONFIGSYMLINKS= 225 226.for file in ${BIN1} 227CONFIGFILES+= ${file} 228FILESMODE_${file:T}= 644 229.endfor 230 231.for file in ${BIN2} 232CONFIGFILES+= ${file} 233FILESMODE_${file:T}= 664 234.endfor 235 236.for file in ${BIN3} 237CONFIGFILES+= ${file} 238FILESMODE_${file:T}= 600 239.endfor 240 241.if (${MKPOSTFIX} != "no") 242CONFIGFILES+= aliases 243FILESDIR_aliases= /etc/mail 244FILESMODE_aliases= 644 245.endif 246 247CONFIGFILES+= MAKEDEV.local 248FILESDIR_MAKEDEV.local= /dev 249FILESMODE_MAKEDEV.local=${BINMODE} 250 251CONFIGFILES+= crontab 252FILESDIR_crontab= /var/cron/tabs 253FILESNAME_crontab= root 254FILESMODE_crontab= 600 255 256CONFIGFILES+= minfree 257FILESDIR_minfree= /var/crash 258FILESMODE_minfree= 600 259 260CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \ 261 /usr/sbin/rmt /etc/rmt 262 263 264# install-etc-files -- 265# Install etc (config) files; not performed by "make build" 266# 267install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV 268 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd 269 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 270 master.passwd ${DESTDIR}/etc 271 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ 272 ${DESTDIR}/etc/master.passwd 273.if ${MKUNPRIVED} != "no" 274 ( \ 275 for metaent in passwd pwd.db spwd.db; do \ 276 echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \ 277 done; \ 278 ) | ${METALOG.add} 279.endif # MKUNPRIVED != no 280 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys 281 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 282 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc 283 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV 284 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 285 MAKEDEV ${DESTDIR}/dev 286.for owner group mode file in \ 287 ${BINOWN} operator 664 /etc/dumpdates \ 288 ${BINOWN} operator 600 /etc/skeykeys \ 289 root wheel 600 /var/at/at.deny \ 290 nobody ${BINGRP} 664 /var/db/locate.database \ 291 uucp dialer 640 /var/log/aculog \ 292 ${BINOWN} ${BINGRP} 600 /var/log/authlog \ 293 root wheel 600 /var/log/cron \ 294 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \ 295 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \ 296 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \ 297 ${BINOWN} ${BINGRP} 600 /var/log/maillog \ 298 ${BINOWN} ${BINGRP} 644 /var/log/messages \ 299 ${BINOWN} ${BINGRP} 600 /var/log/secure \ 300 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \ 301 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \ 302 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \ 303 daemon staff 664 /var/msgs/bounds \ 304 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \ 305 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \ 306 games games 664 /var/games/atc_score \ 307 games games 664 /var/games/battlestar.log \ 308 games games 664 /var/games/cfscores \ 309 games games 664 /var/games/criblog \ 310 games games 660 /var/games/hackdir/perm \ 311 games games 660 /var/games/hackdir/record \ 312 games games 664 /var/games/larn/llog12.0 \ 313 games games 664 /var/games/larn/lscore12.0 \ 314 games games 664 /var/games/larn/playerids \ 315 games games 664 /var/games/robots_roll \ 316 games games 664 /var/games/rogue.scores \ 317 games games 664 /var/games/saillog \ 318 games games 664 /var/games/snakerawscores \ 319 games games 664 /var/games/snake.log \ 320 games games 664 /var/games/tetris.scores 321 ${_MKMSG_INSTALL} ${DESTDIR}${file} 322 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ 323 /dev/null ${DESTDIR}${file} 324.endfor 325.for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh 326 ${MAKEDIRTARGET} ${subdir} configinstall 327.endfor 328 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall 329.if (${MKPF} != "no") 330 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall 331.endif 332.if (${MKCRYPTO} != "no") 333 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/ssh configinstall 334.endif 335.if (${MKPOSTFIX} != "no") 336 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/gnu/usr.sbin/postfix configinstall 337.endif 338 339 340# install-obsolete-lists -- 341# Install var/db/obsolete set lists; this is performed by "make build" 342# 343OBSOLETE.dir= ${.OBJDIR}/obsolete.dir 344OBSOLETE.files= base comp etc games man misc text 345.if ${MKX11} != "no" 346OBSOLETE.files+= xbase xcomp xetc xfont xserver 347.endif 348 349install-obsolete-lists: .PHONY .MAKE 350 mkdir -p ${OBSOLETE.dir} 351.if ${MKX11} != "no" 352 (cd ${NETBSDSRCDIR}/distrib/sets && \ 353 MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir}) 354.else 355 (cd ${NETBSDSRCDIR}/distrib/sets && \ 356 MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) 357.endif 358.for file in ${OBSOLETE.files} 359 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file} 360 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 361 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete 362.endfor 363 364 365# distrib-dirs -- 366# Populate $DESTDIR with directories needed by NetBSD 367# 368.if ${MKUNPRIVED} == "no" 369TOOL_MTREE.unpriv= 370.else 371TOOL_MTREE.unpriv= -W 372.endif 373 374distrib-dirs: .PHONY check_DESTDIR 375.if !defined(DISTRIBUTION_DONE) # { 376# XXX: If METALOG=${DESTDIR}/METALOG (as is normal), and if ${DESTDIR} 377# does not yet exist (as often happens), then the INSTALL_DIR command 378# immediately below will create ${DESTDIR} but will fail to register 379# an entry for "." in the metalog. We ignore the problem, because the 380# TOOL_MTREE commands a little further below will soon register an entry 381# for "." in the metalog. 382 ${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR} 383# XXX: It would be nice if a single mtree invocation could both 384# append to the metalog and do real work. Instead, we have to 385# repeat the command twice in slightly different ways. 386 ${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \ 387 -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv} 388.if ${MKUNPRIVED} != "no" # { 389 ${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \ 390 -p ${DESTDIR}/ -C -k all | \ 391 awk '/ optional/ {next} // {print}' | ${METALOG.add} 392.endif # MKUNPRIVED # } 393.endif # DISTRIBUTION_DONE # } 394 395# release, snapshot -- 396# Build a full distribution including kernels & install media. 397# 398release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post 399 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets 400 ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \ 401 ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@} 402 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz' 403 404 405# iso-image -- 406# Standalone target to create a CDROM image after the release 407# was composed. Should be run after "make release" in src and xsrc. 408# 409# Note: At least mkisofs 2.0 should be used. 410# 411CDROM_NAME_ADD?= 412CDROM.image=${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom/netbsd-${MACHINE}${CDROM_NAME_ADD}.iso 413CDROM.dir= ${.OBJDIR}/cdrom.dir 414CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist 415 416iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post 417 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom '*.iso' 418 @echo "iso-image created as: ${CDROM.image}" 419 420iso-image-setup: .PHONY check_RELEASEDIR 421 rm -f ${CDROM.pathlist} 422.for extra in README SOURCE_DATE source 423.if exists(${RELEASEDIR}/${extra}) 424 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist} 425.endif 426.endfor 427 echo "${MACHINE}=${RELEASEDIR}/${RELEASEMACHINEDIR}" >> ${CDROM.pathlist} 428 mkdir -p ${CDROM.dir} 429 mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom 430 431# iso-image-mi -- 432# Create the image after the MD operations have completed. 433# 434iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR 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 iso-image-setup 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 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 distribution 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 .MAKE build_kernelsets build_releasekernels 475.if ${MKUPDATE} == "no" 476 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 477.endif 478 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 479 ${MAKE} release 480 481# build kernels -- 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 521build_kernels: .PHONY 522# Configure & compile kernels listed in ${ALL_KERNELS} 523# 524# The 'sync' is so that all writes during the build are pushed back 525# to the disk. Not having it causes problems on some host systems 526# (e.g. Linux) when building on NFS. 527# 528.if !defined(KERNELS_DONE) # { 529.for configfile in ${ALL_KERNELS} # { 530build_kernels: kern-${configfile} 531kern-${configfile}: .PHONY .MAKE 532 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \ 533 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 534.if ${MKUPDATE} == "no" 535 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean 536.endif 537 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} 538 sync 539.endfor # ALL_KERNELS # } 540.endif # KERNELS_DONE # } 541 542build_kernelsets: .PHONY 543# Create kernel sets from ${KERNEL_SETS} into 544# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 545# 546.for configfile in ${KERNEL_SETS} # { 547build_kernelsets: kernset-${configfile} 548kernset-${configfile}: .PHONY build_kernels snap_pre 549 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \ 550 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 551 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 552 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \ 553 pax_cmd="GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ 554 cd $${kerndir} && { \ 555 kernels=; newest=; \ 556 for kernel in $${kernlist}; do \ 557 for s in "" $${kernsuffixes}; do \ 558 ks="$${kernel}$${s}"; \ 559 [ -f $${ks} ] || continue; \ 560 kernels="$${kernels} $${ks}"; \ 561 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \ 562 newest=$${ks}; \ 563 done; \ 564 done; \ 565 [ $${kern_tgz} -nt "$${newest}" ] || { \ 566 echo "echo $${kernels} | $${pax_cmd}"; \ 567 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 568 echo ". type=dir optional"; \ 569 for kernel in $${kernels}; do \ 570 echo "./$${kernel} type=file"; \ 571 done ) | eval $${pax_cmd}; \ 572 } \ 573 } 574.endfor # KERNEL_SETS # } 575 576build_releasekernels: .PHONY 577# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 578# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel 579# 580.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # { 581build_releasekernels: releasekern-${configfile} 582releasekern-${configfile}: .PHONY build_kernels snap_pre 583 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \ 584 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 585 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 586 cd $${kerndir} && { \ 587 for kernel in $${kernlist}; do \ 588 for s in "" $${kernsuffixes}; do \ 589 ks="$${kernel}$${s}"; \ 590 [ ! -f $${ks} ] && continue; \ 591 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${ks}-${configfile:C/.*\///}.gz"; \ 592 [ $${knl_gz} -nt $${ks} ] && continue; \ 593 echo "gzip -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \ 594 gzip -c -9 < $${ks} > $${knl_gz}; \ 595 done; \ 596 done; \ 597 } 598.endfor # KERNEL_SETS EXTRA_KERNELS # } 599 600# snap_md_post -- 601# Machine dependent distribution media operations. 602# Overridden by etc.$MACHINE/Makefile.inc 603# 604snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post 605# (empty -- look in the machine-dependent Makefile.inc) 606 607 608clean: 609 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 610 611.include <bsd.prog.mk> 612 613test: 614 @echo ${OBSOLETE.files} 615