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