Makefile revision 1.310
1# $NetBSD: Makefile,v 1.310 2005/03/25 20:15:20 tron 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 45.MAKEOVERRIDES+= USETOOLS 46 47TZDIR= /usr/share/zoneinfo 48LOCALTIME?= UTC 49CKSUM?= ${TOOL_CKSUM} 50MAKESUMS= CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums 51DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 52 53# Flags for creating ISO CDROM image 54# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrecord 55# Note: At least mkisofs 2.0 should be used. 56# 57MKISOFS?= mkisofs 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 -P "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 mailer.conf man.conf monthly monthly.conf mrouted.conf \ 95 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 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-- 117BIN2+= motd 118 119# -rw------- 120BIN3+= hosts.equiv 121 122SYSPKG= etc 123ETC_PKG=-T etc_pkg 124BASE_PKG=-T base_pkg 125ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} 126ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} 127 128.if ${TARGET_ENDIANNESS} == "1234" 129PWD_MKDB_ENDIAN= -L 130.elif ${TARGET_ENDIANNESS} == "4321" 131PWD_MKDB_ENDIAN= -B 132.else 133PWD_MKDB_ENDIAN= 134.endif 135 136 137# distribution -- 138# Build a distribution 139# 140distribution: .PHONY check_DESTDIR .WAIT distrib-dirs 141.if !defined(DISTRIBUTION_DONE) 142.if !defined(INSTALL_DONE) 143 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB= 144 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB= 145.endif # !INSTALL_DONE 146 ${MAKEDIRTARGET} . install-etc-files 147.if ${MKX11} != "no" 148 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/x11 distribution 149.endif 150 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles 151.endif # !DISTRIBUTION_DONE 152 153 154CLEANFILES+= MAKEDEV 155MAKEDEV: .EXEC 156 ${_MKTARGET_CREATE} 157 MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 158 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ 159 awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET} 160 161RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID \ 162 DESTDIR EXTERNAL_TOOLCHAIN \ 163 INSTALLWORLDDIR \ 164 KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \ 165 MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \ 166 MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \ 167 MKBFD MKCATPAGES \ 168 MKCRYPTO MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKCVS \ 169 MKDOC MKDYNAMICROOT MKGCC MKGCCCMDS MKGDB \ 170 MKHESIOD MKHOSTOBJ MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \ 171 MKKERBEROS4 MKKERBEROS MKLINKLIB MKLINT \ 172 MKMAN MKMANZ MKNLS MKOBJ MKOBJDIRS \ 173 MKPAM MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \ 174 MKSENDMAIL MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \ 175 MKUNPRIVED MKUPDATE MKUUCP MKX11 MKYP \ 176 NBUILDJOBS NETBSDSRCDIR \ 177 NOCLEANDIR NODISTRIBDIRS NOINCLUDES \ 178 OBJMACHINE \ 179 RELEASEDIR TOOLCHAIN_MISSING TOOLDIR \ 180 USETOOLS USR_OBJMACHINE \ 181 X11SRCDIR 182 183params: .PHONY 184.for var in ${RELEASEVARS} 185.if defined(${var}) 186 @printf "%20s = '%-s'\n" ${var} ${${var}:Q} 187.else 188 @printf "%20s = (undefined)\n" ${var} 189.endif 190.endfor 191 192CLEANFILES+= etc-release 193etc-release: .EXEC 194 ${_MKTARGET_CREATE} 195 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \ 196 echo ; \ 197 cat ${NETBSDSRCDIR}/sys/conf/copyright; \ 198 echo ; \ 199 echo "Build settings:"; \ 200 printf "%20s %s\n" "Build date" "$$(date -u)"; \ 201 printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \ 202 echo ; \ 203 (cd ${.CURDIR}; ${MAKE} ${MFLAGS} -j1 params); \ 204 ) >${.OBJDIR}/${.TARGET} 205 206install-etc-release: .PHONY etc-release 207 ${_MKMSG_INSTALL} etc/release 208 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \ 209 etc-release ${DESTDIR}/etc/release 210 211 212FILESDIR= /etc 213CONFIGFILES= 214CONFIGSYMLINKS= 215 216.for file in ${BIN1} 217CONFIGFILES+= ${file} 218FILESMODE_${file:T}= 644 219.endfor 220 221.for file in ${BIN2} 222CONFIGFILES+= ${file} 223FILESMODE_${file:T}= 664 224.endfor 225 226.for file in ${BIN3} 227CONFIGFILES+= ${file} 228FILESMODE_${file:T}= 600 229.endfor 230 231CONFIGFILES+= postinstall 232FILESMODE_postinstall= ${BINMODE} 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} ${BINGRP} 664 /var/log/lastlog \ 287 ${BINOWN} ${BINGRP} 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} ${BINGRP} 644 /var/log/wtmp \ 294 ${BINOWN} ${BINGRP} 644 /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 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 xfont 343.if ${MACHINE} == "amd64" || \ 344 ${MACHINE} == "cats" || \ 345 ${MACHINE} == "i386" || \ 346 ${MACHINE} == "macppc" || \ 347 ${MACHINE} == "sgimips" 348OBSOLETE.files+= xserver 349.endif 350.endif 351 352install-obsolete-lists: .PHONY 353 mkdir -p ${OBSOLETE.dir} 354.if ${MKX11} != "no" 355 (cd ${NETBSDSRCDIR}/distrib/sets && \ 356 MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir}) 357.else 358 (cd ${NETBSDSRCDIR}/distrib/sets && \ 359 MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) 360.endif 361.for file in ${OBSOLETE.files} 362 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file} 363 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 364 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete 365.endfor 366 367 368# distrib-dirs -- 369# Populate $DESTDIR with directories needed by NetBSD 370# 371.if ${MKUNPRIVED} == "no" 372TOOL_MTREE.unpriv= 373.else 374TOOL_MTREE.unpriv= -W 375.endif 376 377distrib-dirs: .PHONY check_DESTDIR 378.if !defined(DISTRIBUTION_DONE) 379 ${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR} 380.endif 381 ${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \ 382 -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv} 383 384 385# release, snapshot -- 386# Build a full distribution including kernels & install media. 387# 388release snapshot: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \ 389 distribution .WAIT \ 390 snap_pre .WAIT snap_kern .WAIT \ 391 snap_post .WAIT snap_md_post 392 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets 393 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz' 394 395 396# iso-image -- 397# Standalone target to create a CDROM image after the release 398# was composed. Should be run after "make release" in src and xsrc. 399# 400# Note: At least mkisofs 2.0 should be used. 401# 402CDROM_NAME_ADD?= 403CDROM.image=${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom/netbsd-${MACHINE}${CDROM_NAME_ADD}.iso 404CDROM.dir= cdrom.dir 405CDROM.pathlist= cdrom.pathlist 406 407iso-image: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-md-post 408 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom '*.iso' 409 @echo "iso-image created as: ${CDROM.image}" 410 411iso-image-setup: .PHONY check_RELEASEDIR 412 rm -f ${CDROM.pathlist} 413.for extra in README SOURCE_DATE source 414.if exists(${RELEASEDIR}/${extra}) 415 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist} 416.endif 417.endfor 418 echo "${MACHINE}=${RELEASEDIR}/${RELEASEMACHINEDIR}" >> ${CDROM.pathlist} 419 mkdir -p ${CDROM.dir} 420 mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom 421 422# iso-image-mi -- 423# Create the image after the MD operations have completed. 424# 425iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR .WAIT \ 426 iso-image-setup .WAIT iso-image-md-pre 427 @if ! ${MKISOFS} --version; then \ 428 echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \ 429 false; \ 430 fi 431 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ 432 -o ${CDROM.image} ${CDROM.dir} 433 434# iso-image-md-pre -- 435# Setup ${CDROM.dir} to produce a bootable CD image. 436# Overridden by etc.$MACHINE/Makefile.inc 437# 438iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR 439# (empty -- look in the machine-dependent Makefile.inc) 440 441# iso-image-md-post -- 442# Fixup the CD-image to be bootable. 443# Overridden by etc.$MACHINE/Makefile.inc 444# 445iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR .WAIT iso-image-mi 446# (empty -- look in the machine-dependent Makefile.inc) 447 448 449# snap_pre -- 450# Create ${RELEASEDIR} and necessary subdirectories. 451# 452snap_pre: .PHONY check_DESTDIR check_RELEASEDIR 453 ${INSTALL} -d -m 755 ${RELEASEDIR} 454.if ${MKUPDATE} == "no" 455# Could be a mount point, ignore the errors 456 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR} 457.endif 458 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} 459.for dir in ${INSTALLATION_DIRS} 460 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} 461.endfor 462 463# snap_post -- 464# Build the install media and notes from distrib 465# 466snap_post: .PHONY check_DESTDIR check_RELEASEDIR 467.if ${MKUPDATE} == "no" 468 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 469.endif 470 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 471 ${MAKE} release 472 473# snap_kern -- 474# This target builds the kernels specified by each port. 475# A port may specify the following kernels: 476# 477# KERNEL_SETS The list of kernels that will be 478# packaged into sets, named 479# kern-${kernel}.tgz. These kernels 480# are also placed in the binary/kernel 481# area of the release package as 482# netbsd-${kernel}.gz. 483# 484# EXTRA_KERNELS Additional kernels to place in the 485# binary/kernel area of the release 486# package as netbsd-${kernel}.gz, but 487# which are not placed into sets. This 488# allows a port to provide e.g. a netbootable 489# installation kernel containing a ramdisk. 490# 491# BUILD_KERNELS Additional kernels to build which are 492# not placed into sets nor into the 493# binary/kernel area of the release 494# package. These are typically kernels 495# that are built for inclusion only in 496# installation disk/CD-ROM/tape images. 497# 498# A port may also specify KERNEL_SUFFIXES, which is an optional list 499# of filename suffixes for kernels to include in the kernel sets and 500# in the binary/kernel area of the release package (e.g. "netbsd" vs. 501# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels 502# with these suffixes do not exist in the kernel build directory. 503# 504# 505# A list of all the kernels to build, which can be overridden from 506# external sources (such as make(1)'s environment or command line) 507# 508ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} 509 510GETKERNELAWK= awk '/^config/ {print $$2; found=1} \ 511 END{ if (found == 0) print "netbsd"; }' 512 513.if !target(snap_kern) # { 514 515# build_kernels -- 516# Configure & compile kernels listed in ${ALL_KERNELS} 517# 518# The 'sync' is so that all writes during the build are pushed back 519# to the disk. Not having it causes problems on some host systems 520# (e.g. Linux) when building on NFS. 521# 522.if !defined(KERNELS_DONE) # { 523.for configfile in ${ALL_KERNELS} # { 524_KERNELS_TO_BUILD+=kern-${configfile} 525kern-${configfile}: .PHONY 526 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \ 527 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 528.if ${MKUPDATE} == "no" 529 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean 530.endif 531 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} 532 sync 533.endfor # ALL_KERNELS # } 534.endif # KERNELS_DONE # } 535 536build_kernels: .PHONY ${_KERNELS_TO_BUILD} 537 538# build_kernelsets -- 539# Create kernel sets from ${KERNEL_SETS} into 540# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 541# 542.for configfile in ${KERNEL_SETS} # { 543_KERNELSETS_TO_BUILD+=kernset-${configfile} 544kernset-${configfile}: .PHONY 545 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \ 546 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 547 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 548 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \ 549 pax_cmd="GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ 550 cd $${kerndir} && { \ 551 kernels=; newest=; \ 552 for kernel in $${kernlist}; do \ 553 for s in "" $${kernsuffixes}; do \ 554 ks="$${kernel}$${s}"; \ 555 [ -f $${ks} ] || continue; \ 556 kernels="$${kernels} $${ks}"; \ 557 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \ 558 newest=$${ks}; \ 559 done; \ 560 done; \ 561 [ $${kern_tgz} -nt "$${newest}" ] || { \ 562 echo "echo $${kernels} | $${pax_cmd}"; \ 563 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 564 echo ". type=dir optional"; \ 565 for kernel in $${kernels}; do \ 566 echo "./$${kernel} type=file"; \ 567 done ) | eval $${pax_cmd}; \ 568 } \ 569 } 570.endfor # KERNEL_SETS # } 571 572build_kernelsets: ${_KERNELSETS_TO_BUILD} 573 574# build_releasekernels -- 575# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 576# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel 577# 578.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # { 579_RELEASEKERNELS_TO_BUILD+=releasekern-${configfile} 580releasekern-${configfile}: .PHONY 581 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \ 582 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 583 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 584 cd $${kerndir} && { \ 585 for kernel in $${kernlist}; do \ 586 for s in "" $${kernsuffixes}; do \ 587 ks="$${kernel}$${s}"; \ 588 [ ! -f $${ks} ] && continue; \ 589 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${ks}-${configfile:C/.*\///}.gz"; \ 590 [ $${knl_gz} -nt $${ks} ] && continue; \ 591 echo "gzip -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \ 592 gzip -c -9 < $${ks} > $${knl_gz}; \ 593 done; \ 594 done; \ 595 } 596.endfor # KERNEL_SETS EXTRA_KERNELS # } 597 598build_releasekernels: ${_RELEASEKERNELS_TO_BUILD} 599 600# snap_kern -- 601# build the kernels, then the sets & release kernels 602# 603snap_kern: check_DESTDIR check_RELEASEDIR .WAIT \ 604 build_kernels .WAIT \ 605 build_kernelsets build_releasekernels 606 607.endif # !target(snap_kern) # } 608 609 610# snap_md_post -- 611# Machine dependent distribution media operations. 612# Overridden by etc.$MACHINE/Makefile.inc 613# 614snap_md_post: check_DESTDIR check_RELEASEDIR 615# (empty -- look in the machine-dependent Makefile.inc) 616 617 618clean: 619 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 620 621.include <bsd.prog.mk> 622 623test: 624 @echo ${OBSOLETE.files} 625