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