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