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