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