Makefile revision 1.272
1# $NetBSD: Makefile,v 1.272 2004/01/06 07:25:40 lukem 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# MKSENDMAIL; if not `no', install sendmail 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/${MACHINE}. 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 44.MAKEOVERRIDES+= USETOOLS 45 46TZDIR= /usr/share/zoneinfo 47LOCALTIME?= UTC 48MAKESUMS= CKSUM=${TOOL_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/cdrecord 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_${MACHINE}_${DISTRIBREV} | tr a-z A-Z 59MKISOFS_FLAGS+= -J -l \ 60 -r -T -v \ 61 -V ${ISO_VOLID} \ 62 -P "The NetBSD Project" \ 63 -m "${RELEASEDIR}/${MACHINE}/installation/cdrom" 64 65# MD Makefile.inc may append MD targets to BIN[123]. Make sure all 66# are empty, to preserve the old semantics of setting them below with "=". 67# 68BIN1= 69BIN2= 70BIN3= 71 72# Directories to build in ${RELEASEDIR}/${MACHINE}. 73# MD Makefile.inc files can add to this. 74# NOTE: Parent directories must be listed before subdirectories. 75# 76INSTALLATION_DIRS= binary binary/sets binary/kernel installation 77 78.if exists(etc.${MACHINE}/Makefile.inc) 79.include "etc.${MACHINE}/Makefile.inc" 80.endif 81 82# -rw-r--r-- 83BINOWN= root 84BINGRP= wheel 85UTMPGRP= utmp 86BIN1+= bootptab changelist csh.cshrc csh.login csh.logout daily \ 87 daily.conf dm.conf floppytab ftpchroot ftpusers \ 88 gettytab group hosts hosts.lpd inetd.conf lkm.conf \ 89 mailer.conf man.conf monthly monthly.conf mrouted.conf \ 90 netconfig networks newsyslog.conf nsswitch.conf ntp.conf \ 91 passwd.conf phones printcap profile protocols rbootd.conf rc rc.conf \ 92 rc.lkm rc.local rc.subr rc.shutdown remote rpc \ 93 security security.conf services shells sysctl.conf syslog.conf \ 94 weekly weekly.conf wscons.conf \ 95 etc.${MACHINE}/ttys 96 97# Use machine-specific disktab if it exists, or the MI one otherwise 98.if exists(etc.${MACHINE}/disktab) 99BIN1+= etc.${MACHINE}/disktab 100.else 101BIN1+= disktab 102.endif 103 104.if exists(etc.${MACHINE}/ld.so.conf) 105BIN1+= etc.${MACHINE}/ld.so.conf 106.endif 107 108.if exists(etc.${MACHINE}/ttyaction) 109BIN1+= etc.${MACHINE}/ttyaction 110.endif 111 112# -rw-rw-r-- 113BIN2+= motd 114 115# -rw------- 116BIN3+= hosts.equiv 117 118ETC_PKG=-T etc_pkg 119BASE_PKG=-T base_pkg 120ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} 121ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} 122ETC_INSTALL_LINK=cd ${.CURDIR} && ${INSTALL_LINK} ${ETC_PKG} 123ETC_INSTALL_SYMLINK=cd ${.CURDIR} && ${INSTALL_SYMLINK} ${ETC_PKG} 124 125NAMEDB= 127 root.cache named.conf localhost loopback.v6 126 127.if ${TARGET_ENDIANNESS} == "1234" 128PWD_MKDB_ENDIAN= -L 129.elif ${TARGET_ENDIANNESS} == "4321" 130PWD_MKDB_ENDIAN= -B 131.else 132PWD_MKDB_ENDIAN= 133.endif 134 135 136# distribution -- 137# Build a distribution 138# 139distribution: check_DESTDIR .WAIT distrib-dirs 140.if !defined(DISTRIBUTION_DONE) 141.if !defined(INSTALL_DONE) 142 (cd ${NETBSDSRCDIR}; ${MAKE} _DISTRIB= includes) 143 (cd ${NETBSDSRCDIR}; ${MAKE} _DISTRIB= install) 144.endif # !INSTALL_DONE 145 (cd ${.CURDIR}; ${MAKE} install-etc-files) 146.endif # !DISTRIBUTION_DONE 147 148 149.PHONY: MAKEDEV 150CLEANFILES+= MAKEDEV 151MAKEDEV: 152 ${_MKTARGET_CREATE} 153 MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 154 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ 155 awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET} 156 157 158RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID \ 159 DESTDIR EXTERNAL_TOOLCHAIN \ 160 INSTALLWORLDDIR \ 161 KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \ 162 MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \ 163 MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \ 164 MKCATPAGES MKCRYPTO MKDOC MKHOSTOBJ MKINFO \ 165 MKLINT MKMAN MKNLS MKOBJ MKOBJDIRS \ 166 MKPIC MKPICINSTALL MKPROFILE MKSHARE \ 167 MKUNPRIVED MKUPDATE \ 168 NBUILDJOBS \ 169 NOCLEANDIR NODISTRIBDIRS NOINCLUDES \ 170 RELEASEDIR TOOLCHAIN_MISSING TOOLDIR USETOOLS 171 172.PHONY: etc-release install-etc-release 173CLEANFILES+= etc-release 174etc-release: 175 ${_MKTARGET_CREATE} 176 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \ 177 echo " $$(date -u) $${USER-root}@$$(hostname)"; \ 178 echo ; \ 179 cat ${NETBSDSRCDIR}/sys/conf/copyright; \ 180 echo ; \ 181 echo "Build settings:"; \ 182 ) >${.TARGET} 183.for var in ${RELEASEVARS} 184.if defined(${var}) 185 @printf "%20s = '%-s'\n" ${var} ${${var}:Q} >> ${.TARGET} 186.else 187 @printf "%20s = (undefined)\n" ${var} >> ${.TARGET} 188.endif 189.endfor 190 191install-etc-release: etc-release 192 ${_MKMSG_INSTALL} etc/release 193 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \ 194 etc-release ${DESTDIR}/etc/release 195 196# install-etc-files -- 197# Install etc (config) files; not performed by "make build" 198# 199install-etc-files: check_DESTDIR MAKEDEV 200 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 201 ${BIN1} ${DESTDIR}/etc 202 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \ 203 ${BIN2} ${DESTDIR}/etc 204 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \ 205 ${BIN3} ${DESTDIR}/etc 206 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 207 aliases ${DESTDIR}/etc/mail 208 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 209 /dev/null ${DESTDIR}/etc/mail/local-host-names 210 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 211 crontab ${DESTDIR}/var/cron/tabs/root 212 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 213 master.passwd ${DESTDIR}/etc 214 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ 215 ${DESTDIR}/etc/master.passwd 216.if ${MKUNPRIVED} != "no" 217 ( \ 218 for metaent in passwd pwd.db spwd.db; do \ 219 echo "./etc/$${metaent} type=file mode=0644 uname=root gname=wheel tags=etc_pkg"; \ 220 done; \ 221 ) | ${METALOG.add} 222.endif # MKUNPRIVED != no 223 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 224 MAKEDEV ${DESTDIR}/dev 225 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 226 MAKEDEV.local ${DESTDIR}/dev 227 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 228 minfree ${DESTDIR}/var/crash 229.for file in cshrc login profile shrc 230 ${ETC_INSTALL_FILE} -o root -g wheel -m 644 \ 231 root/dot.${file} ${DESTDIR}/root/.${file} 232.endfor 233 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 234 root/dot.klogin ${DESTDIR}/root/.klogin 235 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile 236 ${ETC_INSTALL_LINK} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc 237 ${ETC_INSTALL_LINK} ${DESTDIR}/root/.profile ${DESTDIR}/.profile 238 (cd ${.CURDIR}/defaults; ${MAKE} install) 239 (cd ${.CURDIR}/mtree; ${MAKE} install) 240.for file in ${NAMEDB} 241 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 242 namedb/${file} ${DESTDIR}/etc/namedb 243.endfor 244 (cd ${.CURDIR}/powerd; ${MAKE} install) 245 (cd ${.CURDIR}/rc.d; ${MAKE} install) 246 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ 247 postinstall ${DESTDIR}/etc 248 ${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \ 249 ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime 250 ${ETC_INSTALL_SYMLINK} -o root -g wheel -m 755 \ 251 /usr/sbin/rmt ${DESTDIR}/etc/rmt 252 ${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 664 \ 253 /dev/null ${DESTDIR}/etc/dumpdates 254 ${ETC_INSTALL_FILE} -o ${BINOWN} -g operator -m 600 \ 255 /dev/null ${DESTDIR}/etc/skeykeys 256 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 257 /dev/null ${DESTDIR}/var/at/at.deny 258 ${ETC_INSTALL_FILE} -o nobody -g ${BINGRP} -m 664 \ 259 /dev/null ${DESTDIR}/var/db/locate.database 260 ${ETC_INSTALL_FILE} -o uucp -g dialer -m 640 \ 261 /dev/null ${DESTDIR}/var/log/aculog 262 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \ 263 /dev/null ${DESTDIR}/var/log/authlog 264 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 265 /dev/null ${DESTDIR}/var/log/cron 266 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 664 \ 267 /dev/null ${DESTDIR}/var/log/lastlog 268 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 640 \ 269 /dev/null ${DESTDIR}/var/log/lpd-errs 270 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \ 271 /dev/null ${DESTDIR}/var/log/maillog 272 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 273 /dev/null ${DESTDIR}/var/log/messages 274 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \ 275 /dev/null ${DESTDIR}/var/log/secure 276 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 277 /dev/null ${DESTDIR}/var/log/sendmail.st 278 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 279 /dev/null ${DESTDIR}/var/log/wtmp 280 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 281 /dev/null ${DESTDIR}/var/log/wtmpx 282 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 600 \ 283 /dev/null ${DESTDIR}/var/log/xferlog 284 ${ETC_INSTALL_FILE} -o daemon -g staff -m 664 \ 285 /dev/null ${DESTDIR}/var/msgs/bounds 286 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \ 287 /dev/null ${DESTDIR}/var/run/utmp 288 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${UTMPGRP} -m 664 \ 289 /dev/null ${DESTDIR}/var/run/utmpx 290 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 291 /dev/null ${DESTDIR}/var/games/atc_score 292 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 293 /dev/null ${DESTDIR}/var/games/battlestar.log 294 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 295 /dev/null ${DESTDIR}/var/games/cfscores 296 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 297 /dev/null ${DESTDIR}/var/games/criblog 298 ${ETC_INSTALL_FILE} -o games -g games -m 660 \ 299 /dev/null ${DESTDIR}/var/games/hackdir/perm 300 ${ETC_INSTALL_FILE} -o games -g games -m 660 \ 301 /dev/null ${DESTDIR}/var/games/hackdir/record 302 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 303 /dev/null ${DESTDIR}/var/games/larn/llog12.0 304 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 305 /dev/null ${DESTDIR}/var/games/larn/lscore12.0 306 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 307 /dev/null ${DESTDIR}/var/games/larn/playerids 308 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 309 /dev/null ${DESTDIR}/var/games/robots_roll 310 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 311 /dev/null ${DESTDIR}/var/games/rogue.scores 312 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 313 /dev/null ${DESTDIR}/var/games/saillog 314 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 315 /dev/null ${DESTDIR}/var/games/snakerawscores 316 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 317 /dev/null ${DESTDIR}/var/games/snake.log 318 ${ETC_INSTALL_FILE} -o games -g games -m 664 \ 319 /dev/null ${DESTDIR}/var/games/tetris.scores 320 (cd ${.CURDIR}/skel; ${MAKE} distribution) 321 (cd ${NETBSDSRCDIR}/usr.bin/mail; ${MAKE} distribution) 322 (cd ${NETBSDSRCDIR}/gnu/usr.sbin/postfix/; ${MAKE} distribution) 323.if (${MKCRYPTO} != "no") 324 (cd ${NETBSDSRCDIR}/usr.bin/ssh; ${MAKE} distribution) 325.endif 326.if (${MKSENDMAIL} != "no") 327 (cd ${NETBSDSRCDIR}/gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution) 328.endif 329 330 331# install-obsolete-lists -- 332# Install var/db/obsolete set lists; this is performed by "make build" 333# 334OBSOLETE.dir= ${.OBJDIR}/obsolete.dir 335OBSOLETE.files= base comp etc games man misc text 336 337install-obsolete-lists: 338 mkdir -p ${OBSOLETE.dir} 339 (cd ${NETBSDSRCDIR}/distrib/sets && \ 340 MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) 341.for file in ${OBSOLETE.files} 342 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 343 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete 344.endfor 345 346 347# distrib-dirs -- 348# Populate $DESTDIR with directories needed by NetBSD 349# 350.if ${MKUNPRIVED} == "no" 351TOOL_MTREE.unpriv= 352.else 353TOOL_MTREE.unpriv= -W 354.endif 355 356distrib-dirs: check_DESTDIR 357.if !defined(DISTRIBUTION_DONE) 358 ${INSTALL_DIR} -o root -g wheel -m 755 ${BASE_PKG} ${DESTDIR} 359.endif 360 ${TOOL_MTREE} -def ${.CURDIR}/mtree/NetBSD.dist -N ${.CURDIR} \ 361 -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv} 362 363 364# release, snapshot -- 365# Build a full distribution including kernels & install media. 366# 367release snapshot: check_DESTDIR check_RELEASEDIR .WAIT \ 368 distribution .WAIT \ 369 snap_pre .WAIT snap_kern .WAIT \ 370 snap_post .WAIT snap_md_post 371 (cd ${NETBSDSRCDIR}/distrib/sets; ${MAKE} sets) 372 ${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/binary/kernel '*.gz' 373 374 375# iso-image -- 376# Standalone target to create a CDROM image after the release 377# was composed. Should be run after "make release" in src and xsrc. 378# 379# Note: At least mkisofs 2.0 should be used. 380# 381CDROM.image=${RELEASEDIR}/${MACHINE}/installation/cdrom/netbsd-${MACHINE}.iso 382CDROM.dir= cdrom.dir 383CDROM.pathlist= cdrom.pathlist 384 385iso-image: check_DESTDIR check_RELEASEDIR .WAIT iso-image-md-post 386 ${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/installation/cdrom '*.iso' 387 @echo "iso-image created as: ${CDROM.image}" 388 389iso-image-setup: check_RELEASEDIR 390 rm -f ${CDROM.pathlist} 391 echo "${MACHINE}=${RELEASEDIR}/${MACHINE}" >> ${CDROM.pathlist} 392 mkdir -p ${CDROM.dir} 393 mkdir -p ${RELEASEDIR}/${MACHINE}/installation/cdrom 394 395# iso-image-mi -- 396# Create the image after the MD operations have completed. 397# 398iso-image-mi: check_DESTDIR check_RELEASEDIR .WAIT \ 399 iso-image-setup .WAIT iso-image-md-pre 400 @if ! ${MKISOFS} --version; then \ 401 echo "install pkgsrc/sysutils/cdrecord and run 'make iso-image'." ; \ 402 false; \ 403 fi 404 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ 405 -o ${CDROM.image} ${CDROM.dir} 406 407# iso-image-md-pre -- 408# Setup ${CDROM.dir} to produce a bootable CD image. 409# Overridden by etc.$MACHINE/Makefile.inc 410# 411iso-image-md-pre: check_DESTDIR check_RELEASEDIR 412# (empty -- look in the machine-dependent Makefile.inc) 413 414# iso-image-md-post -- 415# Fixup the CD-image to be bootable. 416# Overridden by etc.$MACHINE/Makefile.inc 417# 418iso-image-md-post: check_DESTDIR check_RELEASEDIR .WAIT iso-image-mi 419# (empty -- look in the machine-dependent Makefile.inc) 420 421 422# snap_pre -- 423# Create ${RELEASEDIR} and necessary subdirectories. 424# 425snap_pre: check_DESTDIR check_RELEASEDIR 426 ${INSTALL} -d -m 755 ${RELEASEDIR} 427.if ${MKUPDATE} == "no" 428# Could be a mount point, ignore the errors 429 -/bin/rm -rf ${RELEASEDIR}/${MACHINE} 430.endif 431 ${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE} 432.for dir in ${INSTALLATION_DIRS} 433 ${INSTALL} -d -m 755 ${RELEASEDIR}/${MACHINE}/${dir} 434.endfor 435 436# snap_post -- 437# Build the install media and notes from distrib 438# 439snap_post: check_DESTDIR check_RELEASEDIR 440.if ${MKUPDATE} == "no" 441 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 442.endif 443 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 444 ${MAKE} release 445 446# snap_kern -- 447# This target builds the kernels specified by each port. 448# A port may specify the following kernels: 449# 450# KERNEL_SETS The list of kernels that will be 451# packaged into sets, named 452# kern-${kernel}.tgz. These kernels 453# are also placed in the binary/kernel 454# area of the release package as 455# netbsd-${kernel}.gz. 456# 457# EXTRA_KERNELS Additional kernels to place in the 458# binary/kernel area of the release 459# package as netbsd-${kernel}.gz, but 460# which are not placed into sets. This 461# allows a port to provide e.g. a netbootable 462# installation kernel containing a ramdisk. 463# 464# BUILD_KERNELS Additional kernels to build which are 465# not placed into sets nor into the 466# binary/kernel area of the release 467# package. These are typically kernels 468# that are built for inclusion only in 469# installation disk/CD-ROM/tape images. 470# 471# A port may also specify KERNEL_SUFFIXES, which is an optional list 472# of filename suffixes for kernels to include in the kernel sets and 473# in the binary/kernel area of the release package (e.g. "netbsd" vs. 474# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels 475# with these suffixes do not exist in the kernel build directory. 476# 477# 478# A list of all the kernels to build, which can be overridden from 479# external sources (such as make(1)'s environment or command line) 480# 481ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} 482 483GETKERNELAWK= awk '/^config/ {print $$2; found=1} \ 484 END{ if (found == 0) print "netbsd"; }' 485 486.if !target(snap_kern) # { 487 488# build_kernels -- 489# Configure & compile kernels listed in ${ALL_KERNELS} 490# 491.if !defined(KERNELS_DONE) # { 492.for configfile in ${ALL_KERNELS} # { 493_KERNELS_TO_BUILD+=kern-${configfile} 494kern-${configfile}: 495 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \ 496 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 497.if ${MKUPDATE} == "no" 498 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean 499.endif 500 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} 501.endfor # ALL_KERNELS # } 502.endif # KERNELS_DONE # } 503 504build_kernels: ${_KERNELS_TO_BUILD} 505 506# build_kernelsets -- 507# Create kernel sets from ${KERNEL_SETS} into 508# ${RELEASEDIR}/${MACHINE}/binary/sets 509# 510.for configfile in ${KERNEL_SETS} # { 511_KERNELSETS_TO_BUILD+=kernset-${configfile} 512kernset-${configfile}: 513 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile}`; \ 514 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 515 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 516 kern_tgz=${RELEASEDIR}/${MACHINE}/binary/sets/kern-${configfile}.tgz; \ 517 pax_cmd="GZIP=-9 ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ 518 cd $${kerndir} && { \ 519 kernels=; newest=; \ 520 for kernel in $${kernlist}; do \ 521 for s in "" $${kernsuffixes}; do \ 522 ks="$${kernel}$${s}"; \ 523 [ -f $${ks} ] || continue; \ 524 kernels="$${kernels} $${ks}"; \ 525 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \ 526 newest=$${ks}; \ 527 done; \ 528 done; \ 529 [ $${kern_tgz} -nt "$${newest}" ] || { \ 530 echo "echo $${kernels} | $${pax_cmd}"; \ 531 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 532 echo ". type=dir optional"; \ 533 for kernel in $${kernels}; do \ 534 echo "./$${kernel} type=file"; \ 535 done ) | eval $${pax_cmd}; \ 536 } \ 537 } 538.endfor # KERNEL_SETS # } 539 540build_kernelsets: ${_KERNELSETS_TO_BUILD} 541 542# build_releasekernels -- 543# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 544# ${RELEASEDIR}/${MACHINE}/binary/kernel 545# 546.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # { 547_RELEASEKERNELS_TO_BUILD+=releasekern-${configfile} 548releasekern-${configfile}: 549 @ kernlist=`${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}`; \ 550 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 551 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 552 cd $${kerndir} && { \ 553 for kernel in $${kernlist}; do \ 554 for s in "" $${kernsuffixes}; do \ 555 ks="$${kernel}$${s}"; \ 556 [ ! -f $${ks} ] && continue; \ 557 knl_gz="${RELEASEDIR}/${MACHINE}/binary/kernel/$${ks}-${configfile:C/.*\///}.gz"; \ 558 [ $${knl_gz} -nt $${ks} ] && continue; \ 559 echo "gzip -c -9 < $${kerndir}/$${ks} > $${knl_gz}"; \ 560 gzip -c -9 < $${ks} > $${knl_gz}; \ 561 done; \ 562 done; \ 563 } 564.endfor # KERNEL_SETS EXTRA_KERNELS # } 565 566build_releasekernels: ${_RELEASEKERNELS_TO_BUILD} 567 568# snap_kern -- 569# build the kernels, then the sets & release kernels 570# 571snap_kern: check_DESTDIR check_RELEASEDIR .WAIT \ 572 build_kernels .WAIT \ 573 build_kernelsets build_releasekernels 574 575.endif # !target(snap_kern) # } 576 577 578# snap_md_post -- 579# Machine dependent distribution media operations. 580# Overridden by etc.$MACHINE/Makefile.inc 581# 582snap_md_post: check_DESTDIR check_RELEASEDIR 583# (empty -- look in the machine-dependent Makefile.inc) 584 585 586clean: 587 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 588 589.include <bsd.prog.mk> 590