Makefile revision 1.414
1# $NetBSD: Makefile,v 1.414 2014/06/14 12:26:26 apb 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# MKPOSTFIX; if not `no', install postfix 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.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ... 40.include <bsd.endian.mk> # For TARGET_ENDIANNESS 41 42.MAKEOVERRIDES+= USETOOLS 43 44TZDIR= /usr/share/zoneinfo 45LOCALTIME?= UTC 46CKSUM?= ${TOOL_CKSUM} 47MAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums 48DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 49 50# Flags for creating ISO CDROM image 51# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools 52# Note: At least mkisofs 2.0 should be used. 53# 54.if !defined(MKISOFS) 55MKISOFS!= (which mkisofs || echo true) 2>/dev/null 56.endif 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_${DISTRIBREV} | tr a-z A-Z 60MKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \ 61 -V ${ISO_VOLID} \ 62 -publisher "The NetBSD Project" \ 63 -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom" 64.if ${MKISOFS_FLAGS:N-v} 65MKISOFS_FLAGS+= -quiet 66.endif 67 68 69# MD Makefile.inc may append MD targets to BIN[123]. Make sure all 70# are empty, to preserve the old semantics of setting them below with "+=". 71# 72BIN1= 73BIN2= 74BIN3= 75 76# Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}. 77# MD Makefile.inc files can add to this. 78# NOTE: Parent directories must be listed before subdirectories. 79# 80INSTALLATION_DIRS= binary binary/sets binary/kernel installation 81 82.if exists(etc.${RELEASEMACHINE}/Makefile.inc) 83.include "etc.${RELEASEMACHINE}/Makefile.inc" 84.endif 85 86# -rw-r--r-- 87BINOWN= root 88BINGRP= wheel 89UTMPGRP= utmp 90BIN1+= bootptab changelist csh.cshrc csh.login \ 91 csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \ 92 ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \ 93 locate.conf login.conf mailer.conf man.conf monthly monthly.conf \ 94 mrouted.conf named.conf netconfig networks newsyslog.conf \ 95 nsswitch.conf ntp.conf passwd.conf pkgpath.conf phones printcap \ 96 profile protocols rbootd.conf rc rc.conf rc.local rc.subr \ 97 rc.shutdown remote rpc security security.conf services shells \ 98 shrc sysctl.conf syslog.conf weekly weekly.conf wscons.conf 99 100# Use machine-specific disktab if it exists, or the MI one otherwise 101.if exists(etc.${MACHINE}/disktab) 102BIN1+= etc.${MACHINE}/disktab 103.else 104BIN1+= disktab 105.endif 106 107.if exists(etc.${MACHINE}/ld.so.conf) && empty(MACHINE_ARCH:M*arm*hf*) 108BIN1+= etc.${MACHINE}/ld.so.conf 109.endif 110 111.if exists(etc.${MACHINE}/ttyaction) 112BIN1+= etc.${MACHINE}/ttyaction 113.endif 114 115# -rw-rw-r-- 116BIN2+= motd 117FILESBUILD_motd= YES 118 119# -rw------- 120BIN3+= hosts.equiv 121 122SYSPKG= etc 123ETC_PKG=-T etc_pkg 124BASE_PKG=-T base_pkg 125ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} 126ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} 127 128.if ${TARGET_ENDIANNESS} == "1234" 129PWD_MKDB_ENDIAN= -L 130.elif ${TARGET_ENDIANNESS} == "4321" 131PWD_MKDB_ENDIAN= -B 132.else 133PWD_MKDB_ENDIAN= 134.endif 135 136 137# distribution -- 138# Build a distribution 139# 140distribution: .PHONY .MAKE check_DESTDIR distrib-dirs 141.if !defined(DISTRIBUTION_DONE) 142.if !defined(INSTALL_DONE) 143 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB= 144 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB= 145.endif # !INSTALL_DONE 146 ${MAKEDIRTARGET} . install-etc-files 147. if ${MKX11} != "no" 148. if ${X11FLAVOUR} == "Xorg" 149 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution 150. else 151 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/x11 distribution 152. endif 153. endif 154. if ${MKEXTSRC} != "no" 155 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution 156. endif 157 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles 158.endif # !DISTRIBUTION_DONE 159 160 161# motd is copied from a different ${MOTD_SOURCE} depending on DISTRIBVER 162# 163.if !empty(DISTRIBVER:M*.99.*) 164MOTD_SOURCE= motd.current 165.elif !empty(DISTRIBVER:M*BETA*) 166MOTD_SOURCE= motd.beta 167.elif !empty(DISTRIBVER:M*RC*) 168MOTD_SOURCE= motd.rc 169.elif !empty(DISTRIBVER:M*STABLE*) 170MOTD_SOURCE= motd.stable 171.else 172MOTD_SOURCE= motd.default 173.endif 174CLEANFILES+= motd 175motd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS} 176 ${_MKTARGET_CREATE} 177 ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET} 178 179CLEANFILES+= MAKEDEV 180MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 181 ${.CURDIR}/etc.${MACHINE}/MAKEDEV.conf 182 ${_MKTARGET_CREATE} 183 MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 184 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ 185 ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 186 > ${.TARGET} 187 188.include "${NETBSDSRCDIR}/etc/Makefile.params" 189CLEANFILES+= etc-release 190etc-release: .EXEC .MAKE 191 ${_MKTARGET_CREATE} 192 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \ 193 echo ; \ 194 cat ${NETBSDSRCDIR}/sys/conf/copyright; \ 195 echo ; \ 196 echo "Build settings:"; \ 197 printf "%20s %s\n" "Build date" "$$(date -u)"; \ 198 printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \ 199 if [ -n "${BUILDID}" ]; then \ 200 printf "%20s %s\n" "Build ID:" "${BUILDID}" ; \ 201 fi ; \ 202 echo ; \ 203 ${PRINT_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 212FILESDIR= /etc 213CONFIGFILES= 214CONFIGSYMLINKS= 215 216.for file in ${BIN1} 217CONFIGFILES+= ${file} 218FILESMODE_${file:T}= 644 219.endfor 220 221.for file in ${BIN2} 222CONFIGFILES+= ${file} 223FILESMODE_${file:T}= 664 224.endfor 225 226.for file in ${BIN3} 227CONFIGFILES+= ${file} 228FILESMODE_${file:T}= 600 229.endfor 230 231.if (${MKPOSTFIX} != "no") 232CONFIGFILES+= aliases 233FILESDIR_aliases= /etc/mail 234FILESMODE_aliases= 644 235.endif 236 237CONFIGFILES+= MAKEDEV.local 238FILESDIR_MAKEDEV.local= /dev 239FILESMODE_MAKEDEV.local=${BINMODE} 240 241CONFIGFILES+= crontab 242FILESDIR_crontab= /var/cron/tabs 243FILESNAME_crontab= root 244FILESMODE_crontab= 600 245 246CONFIGFILES+= minfree 247FILESDIR_minfree= /var/crash 248FILESMODE_minfree= 600 249 250CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \ 251 /usr/sbin/rmt /etc/rmt 252 253 254# install-etc-files -- 255# Install etc (config) files; not performed by "make build" 256# 257install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV 258 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd 259 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 260 master.passwd ${DESTDIR}/etc 261 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ 262 ${DESTDIR}/etc/master.passwd 263.if ${MKUNPRIVED} != "no" 264 ( \ 265 mode=0600; \ 266 for metaent in spwd.db passwd pwd.db; do \ 267 echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=wheel tags=etc_pkg"; \ 268 mode=0644; \ 269 done; \ 270 ) | ${METALOG.add} 271.endif # MKUNPRIVED != no 272 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys 273 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 274 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc 275.if exists(etc.${MACHINE}/boot.cfg) 276 ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg 277 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 278 ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/ 279.endif 280 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV 281 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 282 MAKEDEV ${DESTDIR}/dev 283.for owner group mode file in \ 284 ${BINOWN} operator 664 /etc/dumpdates \ 285 ${BINOWN} operator 600 /etc/skeykeys \ 286 root wheel 600 /var/at/at.deny \ 287 root wheel 644 /var/db/locate.database \ 288 ${BINOWN} ${BINGRP} 600 /var/log/authlog \ 289 root wheel 600 /var/log/cron \ 290 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \ 291 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \ 292 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \ 293 ${BINOWN} ${BINGRP} 600 /var/log/maillog \ 294 ${BINOWN} ${BINGRP} 644 /var/log/messages \ 295 ${BINOWN} ${BINGRP} 600 /var/log/secure \ 296 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \ 297 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \ 298 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \ 299 daemon staff 664 /var/msgs/bounds \ 300 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \ 301 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \ 302 games games 664 /var/games/atc_score \ 303 games games 664 /var/games/battlestar.log \ 304 games games 664 /var/games/cfscores \ 305 games games 664 /var/games/criblog \ 306 games games 660 /var/games/hackdir/perm \ 307 games games 660 /var/games/hackdir/record \ 308 games games 664 /var/games/larn/llog12.0 \ 309 games games 664 /var/games/larn/lscore12.0 \ 310 games games 664 /var/games/larn/playerids \ 311 games games 664 /var/games/robots_roll \ 312 games games 664 /var/games/rogue.scores \ 313 games games 664 /var/games/saillog \ 314 games games 664 /var/games/snakerawscores \ 315 games games 664 /var/games/snake.log \ 316 games games 664 /var/games/tetris.scores 317 ${_MKMSG_INSTALL} ${DESTDIR}${file} 318 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ 319 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ 320 /dev/null ${DESTDIR}${file}; \ 321 else true; fi 322.endfor 323.for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh 324 ${MAKEDIRTARGET} ${subdir} configinstall 325.endfor 326 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall 327 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall 328.if (${MKPF} != "no") 329 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall 330.endif 331.if (${MKCRYPTO} != "no") 332 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall 333.endif 334.if (${MKPOSTFIX} != "no") 335 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall 336.endif 337.if (${MKATF} != "no") 338 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall 339.endif 340.if (${MKKYUA} != "no") 341 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua 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.if ${MKDEBUG} != "no" 351OBSOLETE.files+= debug 352.endif 353.if ${MKKMOD} != "no" 354OBSOLETE.files+= modules 355.endif 356.if ${MKATF} != "no" 357OBSOLETE.files+= tests 358.endif 359.if ${MKX11} != "no" 360OBSOLETE.files+= xbase xcomp xetc xfont xserver 361.endif 362 363# XXX make "makeobsolete" set wise; then generate files respectively 364install-obsolete-lists: .PHONY .MAKE 365 mkdir -p ${OBSOLETE.dir} 366.if ${MKX11} != "no" 367 (cd ${NETBSDSRCDIR}/distrib/sets && \ 368 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir}) 369.else 370 (cd ${NETBSDSRCDIR}/distrib/sets && \ 371 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) 372.endif 373.for file in ${OBSOLETE.files} 374 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file} 375 if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \ 376 ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \ 377 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 378 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \ 379 else true; fi 380.endfor 381 382 383# distrib-dirs -- 384# Populate $DESTDIR with directories needed by NetBSD 385# 386distrib-dirs: .PHONY check_DESTDIR 387 cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs 388 389 390# release, snapshot -- 391# Build a full distribution including kernels & install media. 392# 393release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post 394 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets 395 ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \ 396 ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@} 397 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz' 398 399 400# iso-image -- 401# Standalone target to create a CDROM image after the release 402# was composed. Should be run after "make release" in src and xsrc. 403# The do-iso-image is to be called from etc.$MACHINE/Makefile.inc 404# 405# Note: At least mkisofs 2.0 should be used. 406# 407CDROM_NAME_ADD?= 408CDROM_IMAGE?=${RELEASEDIR}/iso/NetBSD-${DISTRIBVER}-${MACHINE}.iso 409CDROM.dir= ${.OBJDIR}/cdrom.dir 410CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist 411 412iso-image: 413 414.if ${MKISOFS} != true 415do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post 416 ${MAKESUMS} -t ${RELEASEDIR}/iso/ '*.iso' 417 @echo "iso-image created as: ${CDROM_IMAGE}" 418.else 419do-iso-image: 420 @echo iso-image: mkisofs not found 421.endif 422 423iso-image-setup: .PHONY check_RELEASEDIR 424 rm -f ${CDROM.pathlist} 425.for extra in README SOURCE_DATE source 426.if exists(${RELEASEDIR}/${extra}) 427 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist} 428.endif 429.endfor 430 echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist} 431 mkdir -p ${CDROM.dir} 432 mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom 433 434# iso-image-mi -- 435# Create the image after the MD operations have completed. 436# 437iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre 438 @if ! ${MKISOFS} --version; then \ 439 echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \ 440 false; \ 441 fi 442 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ 443 -o ${CDROM_IMAGE} ${CDROM.dir} 444 445# iso-image-md-pre -- 446# Setup ${CDROM.dir} to produce a bootable CD image. 447# Overridden by etc.$MACHINE/Makefile.inc 448# 449iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup 450# (empty -- look in the machine-dependent Makefile.inc) 451 452# iso-image-md-post -- 453# Fixup the CD-image to be bootable. 454# Overridden by etc.$MACHINE/Makefile.inc 455# 456iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi 457# (empty -- look in the machine-dependent Makefile.inc) 458 459 460# live-image -- 461# Standalone target to create live images after the release was composed. 462# Should be run after "make release" in src and xsrc. 463# LIVEIMG_RELEASEDIR specifies where to install live images and 464# it can be set in MD etc.${MACHINE}/Makefile.inc. 465# 466LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images 467 468live-image: .PHONY check_DESTDIR check_RELEASEDIR 469 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \ 470 LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR} 471 ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz' 472 473# install-image -- 474# Standalone target to create installation images 475# after the release was composed. 476# Should be run after "make release" in src and xsrc. 477# INSTIMG_RELEASEDIR specifies where to install live images and 478# it can be set in MD etc.${MACHINE}/Makefile.inc. 479# 480INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images 481 482install-image: .PHONY check_DESTDIR check_RELEASEDIR 483 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \ 484 INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR} 485 ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz' 486 487# snap_pre -- 488# Create ${RELEASEDIR} and necessary subdirectories. 489# 490snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution 491 ${INSTALL} -d -m 755 ${RELEASEDIR} 492.if ${MKUPDATE} == "no" 493# Could be a mount point, ignore the errors 494 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR} 495.endif 496 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} 497.for dir in ${INSTALLATION_DIRS} 498 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} 499.endfor 500 501# snap_post -- 502# Build the install media and notes from distrib 503# 504snap_post: .PHONY .MAKE build_kernelsets build_releasekernels 505.if ${MKUPDATE} == "no" 506 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 507.endif 508 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 509 ${MAKE} release 510 511# build kernels -- 512# This target builds the kernels specified by each port. 513# A port may specify the following kernels: 514# 515# KERNEL_SETS The list of kernels that will be 516# packaged into sets, named 517# kern-${kernel}.tgz. These kernels 518# are also placed in the binary/kernel 519# area of the release package as 520# netbsd-${kernel}.gz. 521# 522# EXTRA_KERNELS Additional kernels to place in the 523# binary/kernel area of the release 524# package as netbsd-${kernel}.gz, but 525# which are not placed into sets. This 526# allows a port to provide e.g. a netbootable 527# installation kernel containing a ramdisk. 528# 529# BUILD_KERNELS Additional kernels to build which are 530# not placed into sets nor into the 531# binary/kernel area of the release 532# package. These are typically kernels 533# that are built for inclusion only in 534# installation disk/CD-ROM/tape images. 535# 536# A port may also specify KERNEL_SUFFIXES, which is an optional list 537# of filename suffixes for kernels to include in the kernel sets and 538# in the binary/kernel area of the release package (e.g. "netbsd" vs. 539# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels 540# with these suffixes do not exist in the kernel build directory. 541# 542# 543# A list of all the kernels to build, which can be overridden from 544# external sources (such as make(1)'s environment or command line) 545# 546ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} 547.export ALL_KERNELS 548 549GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \ 550 END{ if (found == 0) print "netbsd"; }' 551 552build_kernels: .PHONY 553# Configure & compile kernels listed in ${ALL_KERNELS} 554# 555# The 'sync' is so that all writes during the build are pushed back 556# to the disk. Not having it causes problems on some host systems 557# (e.g. Linux) when building on NFS. 558# 559.if !defined(KERNELS_DONE) # { 560.for configfile in ${ALL_KERNELS} # { 561build_kernels: kern-${configfile} 562kern-${configfile}: .PHONY .MAKE 563 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \ 564 -U DEBUG -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 565.if ${MKUPDATE} == "no" 566 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean 567.endif 568 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} 569 sync 570.endfor # ALL_KERNELS # } 571.endif # KERNELS_DONE # } 572 573build_kernelsets: .PHONY 574# Create kernel sets from ${KERNEL_SETS} into 575# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 576# 577.for configfile in ${KERNEL_SETS} # { 578.for configsel in ${ALL_KERNELS} 579.if ${configfile} == ${configsel} 580build_kernelsets: kernset-${configfile} 581kernset-${configfile}: .PHONY build_kernels snap_pre 582 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \ 583 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 584 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 585 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \ 586 pax_cmd="COMPRESS_PROGRAM=${TOOL_GZIP:Q} GZIP=-9n ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ 587 cd $${kerndir} && { \ 588 kernels=; newest=; \ 589 for kernel in $${kernlist}; do \ 590 for s in "" $${kernsuffixes}; do \ 591 ks="$${kernel}$${s}"; \ 592 [ -f $${ks} ] || continue; \ 593 kernels="$${kernels} $${ks}"; \ 594 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \ 595 newest=$${ks}; \ 596 done; \ 597 done; \ 598 [ $${kern_tgz} -nt "$${newest}" ] || { \ 599 echo "echo $${kernels} | $${pax_cmd}"; \ 600 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 601 echo ". type=dir optional"; \ 602 for kernel in $${kernels}; do \ 603 echo "./$${kernel} type=file"; \ 604 done ) | eval $${pax_cmd}; \ 605 } \ 606 } 607.endif 608.endfor 609.endfor # KERNEL_SETS # } 610 611build_releasekernels: .PHONY 612# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 613# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel 614# 615.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # { 616.for configsel in ${ALL_KERNELS} 617.if ${configfile} == ${configsel} 618build_releasekernels: releasekern-${configfile} 619releasekern-${configfile}: .PHONY build_kernels snap_pre 620 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \ 621 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 622 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 623 cd $${kerndir} && { \ 624 for kernel in $${kernlist}; do \ 625 for s in "" $${kernsuffixes}; do \ 626 ks="$${kernel}$${s}"; \ 627 [ ! -f $${ks} ] && continue; \ 628 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \ 629 [ $${knl_gz} -nt $${ks} ] && continue; \ 630 rm -f $${knl_gz}; \ 631 echo "${TOOL_GZIP} -nc -9 < $${kerndir}/$${ks} > $${knl_gz}"; \ 632 ${TOOL_GZIP} -nc -9 < $${ks} > $${knl_gz}; \ 633 done; \ 634 done; \ 635 } 636.endif 637.endfor 638.endfor # KERNEL_SETS EXTRA_KERNELS # } 639 640# snap_md_post -- 641# Machine dependent distribution media operations. 642# Overridden by etc.$MACHINE/Makefile.inc 643# 644snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post 645# (empty -- look in the machine-dependent Makefile.inc) 646 647 648clean: 649 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 650 651SUBDIR= defaults rc.d mtree 652 653.include <bsd.prog.mk> 654.include <bsd.subdir.mk> 655 656test: 657 @echo ${OBSOLETE.files} 658