Makefile revision 1.413
1# $NetBSD: Makefile,v 1.413 2014/05/05 19:10:00 martin 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 echo ; \ 200 ${PRINT_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 209FILESDIR= /etc 210CONFIGFILES= 211CONFIGSYMLINKS= 212 213.for file in ${BIN1} 214CONFIGFILES+= ${file} 215FILESMODE_${file:T}= 644 216.endfor 217 218.for file in ${BIN2} 219CONFIGFILES+= ${file} 220FILESMODE_${file:T}= 664 221.endfor 222 223.for file in ${BIN3} 224CONFIGFILES+= ${file} 225FILESMODE_${file:T}= 600 226.endfor 227 228.if (${MKPOSTFIX} != "no") 229CONFIGFILES+= aliases 230FILESDIR_aliases= /etc/mail 231FILESMODE_aliases= 644 232.endif 233 234CONFIGFILES+= MAKEDEV.local 235FILESDIR_MAKEDEV.local= /dev 236FILESMODE_MAKEDEV.local=${BINMODE} 237 238CONFIGFILES+= crontab 239FILESDIR_crontab= /var/cron/tabs 240FILESNAME_crontab= root 241FILESMODE_crontab= 600 242 243CONFIGFILES+= minfree 244FILESDIR_minfree= /var/crash 245FILESMODE_minfree= 600 246 247CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \ 248 /usr/sbin/rmt /etc/rmt 249 250 251# install-etc-files -- 252# Install etc (config) files; not performed by "make build" 253# 254install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV 255 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd 256 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 257 master.passwd ${DESTDIR}/etc 258 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ 259 ${DESTDIR}/etc/master.passwd 260.if ${MKUNPRIVED} != "no" 261 ( \ 262 mode=0600; \ 263 for metaent in spwd.db passwd pwd.db; do \ 264 echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=wheel tags=etc_pkg"; \ 265 mode=0644; \ 266 done; \ 267 ) | ${METALOG.add} 268.endif # MKUNPRIVED != no 269 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys 270 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 271 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc 272.if exists(etc.${MACHINE}/boot.cfg) 273 ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg 274 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 275 ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/ 276.endif 277 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV 278 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 279 MAKEDEV ${DESTDIR}/dev 280.for owner group mode file in \ 281 ${BINOWN} operator 664 /etc/dumpdates \ 282 ${BINOWN} operator 600 /etc/skeykeys \ 283 root wheel 600 /var/at/at.deny \ 284 root wheel 644 /var/db/locate.database \ 285 ${BINOWN} ${BINGRP} 600 /var/log/authlog \ 286 root wheel 600 /var/log/cron \ 287 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \ 288 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \ 289 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \ 290 ${BINOWN} ${BINGRP} 600 /var/log/maillog \ 291 ${BINOWN} ${BINGRP} 644 /var/log/messages \ 292 ${BINOWN} ${BINGRP} 600 /var/log/secure \ 293 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \ 294 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \ 295 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \ 296 daemon staff 664 /var/msgs/bounds \ 297 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \ 298 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \ 299 games games 664 /var/games/atc_score \ 300 games games 664 /var/games/battlestar.log \ 301 games games 664 /var/games/cfscores \ 302 games games 664 /var/games/criblog \ 303 games games 660 /var/games/hackdir/perm \ 304 games games 660 /var/games/hackdir/record \ 305 games games 664 /var/games/larn/llog12.0 \ 306 games games 664 /var/games/larn/lscore12.0 \ 307 games games 664 /var/games/larn/playerids \ 308 games games 664 /var/games/robots_roll \ 309 games games 664 /var/games/rogue.scores \ 310 games games 664 /var/games/saillog \ 311 games games 664 /var/games/snakerawscores \ 312 games games 664 /var/games/snake.log \ 313 games games 664 /var/games/tetris.scores 314 ${_MKMSG_INSTALL} ${DESTDIR}${file} 315 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ 316 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ 317 /dev/null ${DESTDIR}${file}; \ 318 else true; fi 319.endfor 320.for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh 321 ${MAKEDIRTARGET} ${subdir} configinstall 322.endfor 323 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall 324 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall 325.if (${MKPF} != "no") 326 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall 327.endif 328.if (${MKCRYPTO} != "no") 329 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall 330.endif 331.if (${MKPOSTFIX} != "no") 332 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall 333.endif 334.if (${MKATF} != "no") 335 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall 336.endif 337.if (${MKKYUA} != "no") 338 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua configinstall 339.endif 340 341 342# install-obsolete-lists -- 343# Install var/db/obsolete set lists; this is performed by "make build" 344# 345OBSOLETE.dir= ${.OBJDIR}/obsolete.dir 346OBSOLETE.files= base comp etc games man misc text 347.if ${MKDEBUG} != "no" 348OBSOLETE.files+= debug 349.endif 350.if ${MKKMOD} != "no" 351OBSOLETE.files+= modules 352.endif 353.if ${MKATF} != "no" 354OBSOLETE.files+= tests 355.endif 356.if ${MKX11} != "no" 357OBSOLETE.files+= xbase xcomp xetc xfont xserver 358.endif 359 360# XXX make "makeobsolete" set wise; then generate files respectively 361install-obsolete-lists: .PHONY .MAKE 362 mkdir -p ${OBSOLETE.dir} 363.if ${MKX11} != "no" 364 (cd ${NETBSDSRCDIR}/distrib/sets && \ 365 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir}) 366.else 367 (cd ${NETBSDSRCDIR}/distrib/sets && \ 368 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) 369.endif 370.for file in ${OBSOLETE.files} 371 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file} 372 if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \ 373 ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \ 374 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 375 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \ 376 else true; fi 377.endfor 378 379 380# distrib-dirs -- 381# Populate $DESTDIR with directories needed by NetBSD 382# 383distrib-dirs: .PHONY check_DESTDIR 384 cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs 385 386 387# release, snapshot -- 388# Build a full distribution including kernels & install media. 389# 390release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post 391 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets 392 ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \ 393 ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@} 394 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz' 395 396 397# iso-image -- 398# Standalone target to create a CDROM image after the release 399# was composed. Should be run after "make release" in src and xsrc. 400# The do-iso-image is to be called from etc.$MACHINE/Makefile.inc 401# 402# Note: At least mkisofs 2.0 should be used. 403# 404CDROM_NAME_ADD?= 405CDROM_IMAGE?=${RELEASEDIR}/iso/NetBSD-${DISTRIBVER}-${MACHINE}.iso 406CDROM.dir= ${.OBJDIR}/cdrom.dir 407CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist 408 409iso-image: 410 411.if ${MKISOFS} != true 412do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post 413 ${MAKESUMS} -t ${RELEASEDIR}/iso/ '*.iso' 414 @echo "iso-image created as: ${CDROM_IMAGE}" 415.else 416do-iso-image: 417 @echo iso-image: mkisofs not found 418.endif 419 420iso-image-setup: .PHONY check_RELEASEDIR 421 rm -f ${CDROM.pathlist} 422.for extra in README SOURCE_DATE source 423.if exists(${RELEASEDIR}/${extra}) 424 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist} 425.endif 426.endfor 427 echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist} 428 mkdir -p ${CDROM.dir} 429 mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom 430 431# iso-image-mi -- 432# Create the image after the MD operations have completed. 433# 434iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre 435 @if ! ${MKISOFS} --version; then \ 436 echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \ 437 false; \ 438 fi 439 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ 440 -o ${CDROM_IMAGE} ${CDROM.dir} 441 442# iso-image-md-pre -- 443# Setup ${CDROM.dir} to produce a bootable CD image. 444# Overridden by etc.$MACHINE/Makefile.inc 445# 446iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup 447# (empty -- look in the machine-dependent Makefile.inc) 448 449# iso-image-md-post -- 450# Fixup the CD-image to be bootable. 451# Overridden by etc.$MACHINE/Makefile.inc 452# 453iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi 454# (empty -- look in the machine-dependent Makefile.inc) 455 456 457# live-image -- 458# Standalone target to create live images after the release was composed. 459# Should be run after "make release" in src and xsrc. 460# LIVEIMG_RELEASEDIR specifies where to install live images and 461# it can be set in MD etc.${MACHINE}/Makefile.inc. 462# 463LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images 464 465live-image: .PHONY check_DESTDIR check_RELEASEDIR 466 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \ 467 LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR} 468 ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz' 469 470# install-image -- 471# Standalone target to create installation images 472# after the release was composed. 473# Should be run after "make release" in src and xsrc. 474# INSTIMG_RELEASEDIR specifies where to install live images and 475# it can be set in MD etc.${MACHINE}/Makefile.inc. 476# 477INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images 478 479install-image: .PHONY check_DESTDIR check_RELEASEDIR 480 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \ 481 INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR} 482 ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz' 483 484# snap_pre -- 485# Create ${RELEASEDIR} and necessary subdirectories. 486# 487snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution 488 ${INSTALL} -d -m 755 ${RELEASEDIR} 489.if ${MKUPDATE} == "no" 490# Could be a mount point, ignore the errors 491 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR} 492.endif 493 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} 494.for dir in ${INSTALLATION_DIRS} 495 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} 496.endfor 497 498# snap_post -- 499# Build the install media and notes from distrib 500# 501snap_post: .PHONY .MAKE build_kernelsets build_releasekernels 502.if ${MKUPDATE} == "no" 503 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 504.endif 505 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 506 ${MAKE} release 507 508# build kernels -- 509# This target builds the kernels specified by each port. 510# A port may specify the following kernels: 511# 512# KERNEL_SETS The list of kernels that will be 513# packaged into sets, named 514# kern-${kernel}.tgz. These kernels 515# are also placed in the binary/kernel 516# area of the release package as 517# netbsd-${kernel}.gz. 518# 519# EXTRA_KERNELS Additional kernels to place in the 520# binary/kernel area of the release 521# package as netbsd-${kernel}.gz, but 522# which are not placed into sets. This 523# allows a port to provide e.g. a netbootable 524# installation kernel containing a ramdisk. 525# 526# BUILD_KERNELS Additional kernels to build which are 527# not placed into sets nor into the 528# binary/kernel area of the release 529# package. These are typically kernels 530# that are built for inclusion only in 531# installation disk/CD-ROM/tape images. 532# 533# A port may also specify KERNEL_SUFFIXES, which is an optional list 534# of filename suffixes for kernels to include in the kernel sets and 535# in the binary/kernel area of the release package (e.g. "netbsd" vs. 536# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels 537# with these suffixes do not exist in the kernel build directory. 538# 539# 540# A list of all the kernels to build, which can be overridden from 541# external sources (such as make(1)'s environment or command line) 542# 543ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} 544.export ALL_KERNELS 545 546GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \ 547 END{ if (found == 0) print "netbsd"; }' 548 549build_kernels: .PHONY 550# Configure & compile kernels listed in ${ALL_KERNELS} 551# 552# The 'sync' is so that all writes during the build are pushed back 553# to the disk. Not having it causes problems on some host systems 554# (e.g. Linux) when building on NFS. 555# 556.if !defined(KERNELS_DONE) # { 557.for configfile in ${ALL_KERNELS} # { 558build_kernels: kern-${configfile} 559kern-${configfile}: .PHONY .MAKE 560 cd ${KERNCONFDIR} && ${TOOL_CONFIG} -s ${KERNSRCDIR} \ 561 -U DEBUG -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 562.if ${MKUPDATE} == "no" 563 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean 564.endif 565 cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} 566 sync 567.endfor # ALL_KERNELS # } 568.endif # KERNELS_DONE # } 569 570build_kernelsets: .PHONY 571# Create kernel sets from ${KERNEL_SETS} into 572# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 573# 574.for configfile in ${KERNEL_SETS} # { 575.for configsel in ${ALL_KERNELS} 576.if ${configfile} == ${configsel} 577build_kernelsets: kernset-${configfile} 578kernset-${configfile}: .PHONY build_kernels snap_pre 579 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \ 580 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 581 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 582 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \ 583 pax_cmd="COMPRESS_PROGRAM=${TOOL_GZIP:Q} GZIP=-9n ${TOOL_PAX} -O -zw -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ 584 cd $${kerndir} && { \ 585 kernels=; newest=; \ 586 for kernel in $${kernlist}; do \ 587 for s in "" $${kernsuffixes}; do \ 588 ks="$${kernel}$${s}"; \ 589 [ -f $${ks} ] || continue; \ 590 kernels="$${kernels} $${ks}"; \ 591 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \ 592 newest=$${ks}; \ 593 done; \ 594 done; \ 595 [ $${kern_tgz} -nt "$${newest}" ] || { \ 596 echo "echo $${kernels} | $${pax_cmd}"; \ 597 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 598 echo ". type=dir optional"; \ 599 for kernel in $${kernels}; do \ 600 echo "./$${kernel} type=file"; \ 601 done ) | eval $${pax_cmd}; \ 602 } \ 603 } 604.endif 605.endfor 606.endfor # KERNEL_SETS # } 607 608build_releasekernels: .PHONY 609# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 610# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel 611# 612.for configfile in ${KERNEL_SETS} ${EXTRA_KERNELS} # { 613.for configsel in ${ALL_KERNELS} 614.if ${configfile} == ${configsel} 615build_releasekernels: releasekern-${configfile} 616releasekern-${configfile}: .PHONY build_kernels snap_pre 617 @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \ 618 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 619 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 620 cd $${kerndir} && { \ 621 for kernel in $${kernlist}; do \ 622 for s in "" $${kernsuffixes}; do \ 623 ks="$${kernel}$${s}"; \ 624 [ ! -f $${ks} ] && continue; \ 625 knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \ 626 [ $${knl_gz} -nt $${ks} ] && continue; \ 627 rm -f $${knl_gz}; \ 628 echo "${TOOL_GZIP} -nc -9 < $${kerndir}/$${ks} > $${knl_gz}"; \ 629 ${TOOL_GZIP} -nc -9 < $${ks} > $${knl_gz}; \ 630 done; \ 631 done; \ 632 } 633.endif 634.endfor 635.endfor # KERNEL_SETS EXTRA_KERNELS # } 636 637# snap_md_post -- 638# Machine dependent distribution media operations. 639# Overridden by etc.$MACHINE/Makefile.inc 640# 641snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post 642# (empty -- look in the machine-dependent Makefile.inc) 643 644 645clean: 646 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 647 648SUBDIR= defaults rc.d mtree 649 650.include <bsd.prog.mk> 651.include <bsd.subdir.mk> 652 653test: 654 @echo ${OBSOLETE.files} 655