Makefile revision 1.429
1# $NetBSD: Makefile,v 1.429 2017/06/18 01:03:30 christos 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# MKPOSTFIX; if not `no', install postfix configuration 19# MKUNPRIVED; if not `no', allow non-root installs. 20# MKUPDATE; if not `no', don't do a 'make clean' before kernel compile 21# 22# Targets: 23# distribution: makes a full NetBSD distribution in DESTDIR. If 24# INSTALL_DONE is set, it will not do a `make install.' 25# if DISTRIBUTION_DONE is set, it will not do anything. 26# distrib-dirs: creates an empty NetBSD directory tree in DESTDIR. 27# Called by distribution. 28# snapshot: calls distribution, above, and then tars up the files 29# into a release(7) format in RELEASEDIR/${RELEASEMACHINEDIR}. 30# Any port-dependent stuff for this target is found in 31# etc.${MACHINE}/Makefile.inc. 32# release: a synonym for `snapshot' 33# 34 35# For MK* vars 36.include <bsd.own.mk> 37 38.include <bsd.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ... 39.include <bsd.endian.mk> # For TARGET_ENDIANNESS 40 41.MAKEOVERRIDES+= USETOOLS 42 43TZDIR= /usr/share/zoneinfo 44LOCALTIME?= UTC 45CKSUM?= ${TOOL_CKSUM} 46MAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums 47DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 48 49GZIP_FLAGS= -9 ${GZIP_N_FLAG} 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) 2>/dev/null 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# Reproducible build parameters 70.if ${MKREPRO:Uno} == "no" 71BUILDER!= echo $${USER-root}@$$(hostname) 72.else 73BUILDER= builder@localhost.NetBSD.org 74.endif 75.if ${MKREPRO_TIMESTAMP:Uno} == "no" 76PAX_TIMESTAMP= 77BUILD_DATE!= date -u 78.else 79PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}" 80BUILD_DATE!= date -u -r "${MKREPRO_TIMESTAMP}" 81.endif 82 83# MD Makefile.inc may append MD targets to BIN[123]. Make sure all 84# are empty, to preserve the old semantics of setting them below with "+=". 85# 86BIN1= 87BIN2= 88BIN3= 89 90# Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}. 91# MD Makefile.inc files can add to this. 92# NOTE: Parent directories must be listed before subdirectories. 93# 94INSTALLATION_DIRS= binary binary/sets binary/kernel installation 95 96.if exists(etc.${RELEASEMACHINE}/Makefile.inc) 97.include "etc.${RELEASEMACHINE}/Makefile.inc" 98.endif 99 100# -rw-r--r-- 101BINOWN= root 102BINGRP= wheel 103UTMPGRP= utmp 104BIN1+= bootptab changelist csh.cshrc csh.login \ 105 csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \ 106 ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \ 107 locate.conf login.conf mailer.conf man.conf monthly monthly.conf \ 108 mrouted.conf named.conf netconfig networks newsyslog.conf \ 109 nsswitch.conf ntp.conf passwd.conf pkgpath.conf phones printcap \ 110 profile protocols rbootd.conf rc rc.conf rc.local rc.subr \ 111 rc.shutdown remote rpc security security.conf services shells \ 112 shrc sysctl.conf syslog.conf weekly weekly.conf wscons.conf 113 114# Use machine-specific disktab if it exists, or the MI one otherwise 115.if exists(etc.${MACHINE}/disktab) 116BIN1+= etc.${MACHINE}/disktab 117.else 118BIN1+= disktab 119.endif 120 121.if exists(etc.${MACHINE}/ld.so.conf) && empty(MACHINE_ARCH:M*arm*hf*) 122BIN1+= etc.${MACHINE}/ld.so.conf 123.endif 124 125.if exists(etc.${MACHINE}/ttyaction) 126BIN1+= etc.${MACHINE}/ttyaction 127.endif 128 129# -rw-rw-r-- 130BIN2+= motd 131FILESBUILD_motd= YES 132 133# -rw------- 134BIN3+= hosts.equiv 135 136SYSPKG= etc 137ETC_PKG=-T etc_pkg 138BASE_PKG=-T base_pkg 139ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} 140ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} 141 142.if ${TARGET_ENDIANNESS} == "1234" 143PWD_MKDB_ENDIAN= -L 144.elif ${TARGET_ENDIANNESS} == "4321" 145PWD_MKDB_ENDIAN= -B 146.else 147PWD_MKDB_ENDIAN= 148.endif 149 150 151# distribution -- 152# Build a distribution 153# 154distribution: .PHONY .MAKE check_DESTDIR distrib-dirs 155.if !defined(DISTRIBUTION_DONE) 156.if !defined(INSTALL_DONE) 157 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB= 158 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB= 159.endif # !INSTALL_DONE 160 ${MAKEDIRTARGET} . install-etc-files 161. if ${MKX11} != "no" 162 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution 163. endif 164. if ${MKEXTSRC} != "no" 165 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution 166. endif 167 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles 168.endif # !DISTRIBUTION_DONE 169 170 171# motd is copied from a different ${MOTD_SOURCE} depending on DISTRIBVER 172# 173.if !empty(DISTRIBVER:M*.99.*) 174MOTD_SOURCE= motd.current 175.elif !empty(DISTRIBVER:M*BETA*) 176MOTD_SOURCE= motd.beta 177.elif !empty(DISTRIBVER:M*RC*) 178MOTD_SOURCE= motd.rc 179.elif !empty(DISTRIBVER:M*STABLE*) 180MOTD_SOURCE= motd.stable 181.else 182MOTD_SOURCE= motd.default 183.endif 184CLEANFILES+= motd 185motd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS} 186 ${_MKTARGET_CREATE} 187 ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET} 188 189CLEANFILES+= MAKEDEV 190MAKEDEV_MACHINE=${"${MACHINE_CPU}" == "aarch64":?${MACHINE_CPU}:${MACHINE}} 191MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 192 ${.CURDIR}/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf 193 ${_MKTARGET_CREATE} 194 MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 195 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ 196 ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 197 > ${.TARGET} 198 199.include "${NETBSDSRCDIR}/etc/Makefile.params" 200 201CLEANFILES+= etc-release 202etc-release: .EXEC .MAKE 203 ${_MKTARGET_CREATE} 204 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \ 205 echo ; \ 206 cat ${NETBSDSRCDIR}/sys/conf/copyright; \ 207 echo ; \ 208 echo "Build information:"; \ 209 printf "%20s %s\n" "Build date" "${BUILD_DATE}"; \ 210 printf "%20s %s\n" "Built by" "${BUILDER}"; \ 211 if [ -n "${BUILDID}" ]; then \ 212 printf "%20s %s\n" "Build ID" "${BUILDID}" ; \ 213 fi ; \ 214 if [ -n "${BUILDINFO}" ]; then \ 215 echo ; \ 216 info="$$(printf "%b" ${BUILDINFO:Q})" ; \ 217 printf "%s\n" "$${info}" \ 218 | ${TOOL_SED} -e 's/^/ /' ; \ 219 fi ; \ 220 echo ; \ 221 echo "Build settings:"; \ 222 echo ; \ 223 ${PRINT_PARAMS} ; \ 224 ) >${.OBJDIR}/${.TARGET} 225 226install-etc-release: .PHONY etc-release 227 ${_MKMSG_INSTALL} etc/release 228 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \ 229 etc-release ${DESTDIR}/etc/release 230 231 232FILESDIR= /etc 233CONFIGFILES= 234CONFIGSYMLINKS= 235 236.for file in ${BIN1} 237CONFIGFILES+= ${file} 238FILESMODE_${file:T}= 644 239.endfor 240 241.for file in ${BIN2} 242CONFIGFILES+= ${file} 243FILESMODE_${file:T}= 664 244.endfor 245 246.for file in ${BIN3} 247CONFIGFILES+= ${file} 248FILESMODE_${file:T}= 600 249.endfor 250 251.if (${MKPOSTFIX} != "no") 252CONFIGFILES+= aliases 253FILESDIR_aliases= /etc/mail 254FILESMODE_aliases= 644 255.endif 256 257CONFIGFILES+= MAKEDEV.local 258FILESDIR_MAKEDEV.local= /dev 259FILESMODE_MAKEDEV.local=${BINMODE} 260 261CONFIGFILES+= crontab 262FILESDIR_crontab= /var/cron/tabs 263FILESNAME_crontab= root 264FILESMODE_crontab= 600 265 266CONFIGFILES+= minfree 267FILESDIR_minfree= /var/crash 268FILESMODE_minfree= 600 269 270CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \ 271 /usr/sbin/rmt /etc/rmt 272 273 274# install-etc-files -- 275# Install etc (config) files; not performed by "make build" 276# 277install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV 278 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd 279 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 280 master.passwd ${DESTDIR}/etc 281 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ 282 ${DESTDIR}/etc/master.passwd 283.if ${MKUNPRIVED} != "no" 284 ( \ 285 mode=0600; \ 286 for metaent in spwd.db passwd pwd.db; do \ 287 echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=wheel tags=etc_pkg"; \ 288 mode=0644; \ 289 done; \ 290 ) | ${METALOG.add} 291.endif # MKUNPRIVED != no 292 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys 293.if exists(${.CURDIR}/etc.${MACHINE}/ttys) 294 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 295 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc 296.else 297 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 298 ${.CURDIR}/etc.${MACHINE_CPU}/ttys ${DESTDIR}/etc 299.endif 300.if exists(etc.${MACHINE}/boot.cfg) 301 ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg 302 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 303 ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/ 304.endif 305 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV 306 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 307 MAKEDEV ${DESTDIR}/dev 308.for owner group mode file in \ 309 ${BINOWN} operator 664 /etc/dumpdates \ 310 ${BINOWN} operator 600 /etc/skeykeys \ 311 root wheel 600 /var/at/at.deny \ 312 root wheel 644 /var/db/locate.database \ 313 ${BINOWN} ${BINGRP} 600 /var/log/authlog \ 314 root wheel 600 /var/log/cron \ 315 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \ 316 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \ 317 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \ 318 ${BINOWN} ${BINGRP} 600 /var/log/maillog \ 319 ${BINOWN} ${BINGRP} 644 /var/log/messages \ 320 ${BINOWN} ${BINGRP} 600 /var/log/secure \ 321 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \ 322 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \ 323 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \ 324 daemon staff 664 /var/msgs/bounds \ 325 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \ 326 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \ 327 games games 664 /var/games/atc_score \ 328 games games 664 /var/games/battlestar.log \ 329 games games 664 /var/games/cfscores \ 330 games games 664 /var/games/criblog \ 331 games games 660 /var/games/hackdir/perm \ 332 games games 660 /var/games/hackdir/record \ 333 games games 664 /var/games/larn/llog12.0 \ 334 games games 664 /var/games/larn/lscore12.0 \ 335 games games 664 /var/games/larn/playerids \ 336 games games 664 /var/games/robots_roll \ 337 games games 664 /var/games/rogue.scores \ 338 games games 664 /var/games/saillog \ 339 games games 664 /var/games/snakerawscores \ 340 games games 664 /var/games/snake.log \ 341 games games 664 /var/games/tetris.scores 342 ${_MKMSG_INSTALL} ${DESTDIR}${file} 343 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ 344 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ 345 /dev/null ${DESTDIR}${file}; \ 346 else true; fi 347.endfor 348.for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh 349 ${MAKEDIRTARGET} ${subdir} configinstall 350.endfor 351 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall 352 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall 353.if (${MKPF} != "no") 354 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall 355.endif 356 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall 357.if (${MKPOSTFIX} != "no") 358 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall 359.endif 360.if (${MKATF} != "no") 361 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall 362.endif 363.if (${MKKYUA} != "no") 364 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua configinstall 365.endif 366 367 368# install-obsolete-lists -- 369# Install var/db/obsolete set lists; this is performed by "make build" 370# 371OBSOLETE.dir= ${.OBJDIR}/obsolete.dir 372OBSOLETE.files= base comp etc games man misc text 373.if ${MKDEBUG} != "no" 374OBSOLETE.files+= debug 375.endif 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}/images/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}/images/ '*.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 456check_imagedir: 457 mkdir -p ${RELEASEDIR}/images 458 459# iso-image-mi -- 460# Create the image after the MD operations have completed. 461# 462iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre check_imagedir 463 @if ! ${MKISOFS} --version; then \ 464 echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \ 465 false; \ 466 fi 467 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ 468 -o ${CDROM_IMAGE} ${CDROM.dir} 469 470# iso-image-md-pre -- 471# Setup ${CDROM.dir} to produce a bootable CD image. 472# Overridden by etc.$MACHINE/Makefile.inc 473# 474iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup 475# (empty -- look in the machine-dependent Makefile.inc) 476 477# iso-image-md-post -- 478# Fixup the CD-image to be bootable. 479# Overridden by etc.$MACHINE/Makefile.inc 480# 481iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi 482# (empty -- look in the machine-dependent Makefile.inc) 483 484 485# live-image -- 486# Standalone target to create live images after the release was composed. 487# Should be run after "make release" in src and xsrc. 488# LIVEIMG_RELEASEDIR specifies where to install live images and 489# it can be set in MD etc.${MACHINE}/Makefile.inc. 490# 491LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images 492 493live-image: .PHONY check_DESTDIR check_RELEASEDIR 494 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \ 495 LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR} 496 ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz' 497 498# install-image -- 499# Standalone target to create installation images 500# after the release was composed. 501# Should be run after "make release" in src and xsrc. 502# INSTIMG_RELEASEDIR specifies where to install live images and 503# it can be set in MD etc.${MACHINE}/Makefile.inc. 504# 505INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images 506 507install-image: .PHONY check_DESTDIR check_RELEASEDIR 508 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \ 509 INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR} 510 ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz' 511 512# snap_pre -- 513# Create ${RELEASEDIR} and necessary subdirectories. 514# 515snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution 516 ${INSTALL} -d -m 755 ${RELEASEDIR} 517.if ${MKUPDATE} == "no" 518# Could be a mount point, ignore the errors 519 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR} 520.endif 521 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} 522.for dir in ${INSTALLATION_DIRS} 523 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} 524.endfor 525 526# snap_post -- 527# Build the install media and notes from distrib 528# 529snap_post: .PHONY .MAKE build_kernelsets build_releasekernels 530.if ${MKUPDATE} == "no" 531 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 532.endif 533 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 534 ${MAKE} release 535 536# build kernels -- 537# This target builds the kernels specified by each port. 538# A port may specify the following kernels: 539# 540# KERNEL_SETS The list of kernels that will be 541# packaged into sets, named 542# kern-${kernel}.tgz. These kernels 543# are also placed in the binary/kernel 544# area of the release package as 545# netbsd-${kernel}.gz. 546# 547# EXTRA_KERNELS Additional kernels to place in the 548# binary/kernel area of the release 549# package as netbsd-${kernel}.gz, but 550# which are not placed into sets. This 551# allows a port to provide e.g. a netbootable 552# installation kernel containing a ramdisk. 553# 554# BUILD_KERNELS Additional kernels to build which are 555# not placed into sets nor into the 556# binary/kernel area of the release 557# package. These are typically kernels 558# that are built for inclusion only in 559# installation disk/CD-ROM/tape images. 560# 561# A port may also specify KERNEL_SUFFIXES, which is an optional list 562# of filename suffixes for kernels to include in the kernel sets and 563# in the binary/kernel area of the release package (e.g. "netbsd" vs. 564# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels 565# with these suffixes do not exist in the kernel build directory. 566# 567# 568# A list of all the kernels to build, which can be overridden from 569# external sources (such as make(1)'s environment or command line) 570# 571ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} 572.export ALL_KERNELS 573 574GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \ 575 END{ if (found == 0) print "netbsd"; }' 576 577build_kernels: .PHONY 578# Configure & compile kernels listed in ${ALL_KERNELS} 579# 580# The 'sync' is so that all writes during the build are pushed back 581# to the disk. Not having it causes problems on some host systems 582# (e.g. Linux) when building on NFS. 583# 584.if !defined(KERNELS_DONE) # { 585.for configfile in ${ALL_KERNELS:O:u} # { 586build_kernels: kern-${configfile} 587kern-${configfile}: .PHONY .MAKE 588 cd ${KERNCONFDIR} && ${TOOL_CONFIG} ${CONFIGOPTS} -s ${KERNSRCDIR} \ 589 -U DEBUG -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 590.if ${MKUPDATE} == "no" 591 ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} distclean 592.endif 593 ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} depend && \ 594 ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} 595 sync 596.endfor # ALL_KERNELS # } 597.endif # KERNELS_DONE # } 598 599build_kernelsets: .PHONY 600# Create kernel sets from ${KERNEL_SETS} into 601# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 602# 603.for configfile in ${KERNEL_SETS:O:u} # { 604.for configsel in ${ALL_KERNELS:O:u} 605.if ${configfile} == ${configsel} 606build_kernelsets: kernset-${configfile} 607kernset-${configfile}: .PHONY build_kernels snap_pre 608 @ set -x; kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \ 609 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 610 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 611 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \ 612 pax_cmd="GZIP=${GZIP_FLAGS:Q} ${TOOL_PAX} ${PAX_TIMESTAMP} --use-compress-program ${TOOL_GZIP:Q} -O -w -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ 613 cd $${kerndir} && { \ 614 kernels=; newest=; \ 615 for kernel in $${kernlist}; do \ 616 for s in "" $${kernsuffixes}; do \ 617 ks="$${kernel}$${s}"; \ 618 [ -f $${ks} ] || continue; \ 619 kernels="$${kernels} $${ks}"; \ 620 [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \ 621 newest=$${ks}; \ 622 done; \ 623 done; \ 624 [ $${kern_tgz} -nt "$${newest}" ] || { \ 625 echo "echo $${kernels} | $${pax_cmd}"; \ 626 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 627 echo ". type=dir optional"; \ 628 dtblist=$$(${MAKE} -V DTB); \ 629 for dtb in $${dtblist}; do \ 630 echo "./$${dtb} type=file"; \ 631 done; \ 632 for kernel in $${kernels}; do \ 633 echo "./$${kernel} type=file"; \ 634 done ) | eval $${pax_cmd}; \ 635 } \ 636 } 637.endif 638.endfor 639.endfor # KERNEL_SETS # } 640 641build_releasekernels: .PHONY 642# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 643# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel 644# 645.for configfile in ${KERNEL_SETS:O:u} ${EXTRA_KERNELS:O:u} # { 646.for configsel in ${ALL_KERNELS:O:u} 647.if ${configfile} == ${configsel} 648build_releasekernels: releasekern-${configfile} 649releasekern-${configfile}: .PHONY build_kernels snap_pre 650 @ set -x; kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \ 651 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 652 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 653 dest="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel"; \ 654 cd $${kerndir} && { \ 655 dtblist=$$(${MAKE} -V DTB); \ 656 for dtb in $${dtblist}; do \ 657 [ ! -f $${dtb} ] && continue; \ 658 dtb_gz="$${dest}/$${dtb}.gz"; \ 659 [ $${dtb_gz} -nt $${dtb} ] && continue; \ 660 rm -f $${dtb_gz}; \ 661 echo "${TOOL_GZIP} ${GZIP_FLAGS} -c < $${kerndir}/$${dtb} > $${dtb_gz}"; \ 662 ${TOOL_GZIP} ${GZIP_FLAGS} -c < $${dtb} > $${dtb_gz}; \ 663 done; \ 664 for kernel in $${kernlist}; do \ 665 for s in "" $${kernsuffixes}; do \ 666 ks="$${kernel}$${s}"; \ 667 [ ! -f $${ks} ] && continue; \ 668 knl_gz="$${dest}/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \ 669 [ $${knl_gz} -nt $${ks} ] && continue; \ 670 rm -f $${knl_gz}; \ 671 echo "${TOOL_GZIP} ${GZIP_FLAGS} -c < $${kerndir}/$${ks} > $${knl_gz}"; \ 672 ${TOOL_GZIP} ${GZIP_FLAGS} -c < $${ks} > $${knl_gz}; \ 673 done; \ 674 done; \ 675 } 676.endif 677.endfor 678.endfor # KERNEL_SETS EXTRA_KERNELS # } 679 680# snap_md_post -- 681# Machine dependent distribution media operations. 682# Overridden by etc.$MACHINE/Makefile.inc 683# 684snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post 685# (empty -- look in the machine-dependent Makefile.inc) 686 687 688clean: 689 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 690 691SUBDIR= defaults rc.d mtree 692 693.include <bsd.prog.mk> 694.include <bsd.subdir.mk> 695 696test: 697 @echo ${OBSOLETE.files} 698