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