Makefile revision 1.464
1# $NetBSD: Makefile,v 1.464 2022/05/30 15:06:55 rin 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!= ${TOOL_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+= auto_master 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 named.conf netconfig networks newsyslog.conf \ 109 nsswitch.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.if ${MKMROUTING} != "no" 115BIN1+= mrouted.conf 116.endif 117 118.if ${MKNTP} != "no" 119BIN1+= ntp.conf 120.endif 121 122# Use machine-specific disktab if it exists, or the MI one otherwise 123.if exists(etc.${MACHINE}/disktab) 124BIN1+= etc.${MACHINE}/disktab 125.else 126BIN1+= disktab 127.endif 128 129.if exists(etc.${MACHINE}/ld.so.conf) && \ 130 empty(MACHINE_ARCH:M*arm*hf*) && empty(MACHINE_ARCH:Maarch64*) && \ 131 ${MACHINE_ARCH} != "powerpc64" 132BIN1+= etc.${MACHINE}/ld.so.conf 133.endif 134 135.if exists(etc.${MACHINE}/ttyaction) 136BIN1+= etc.${MACHINE}/ttyaction 137.endif 138 139# -rw-rw-r-- 140BIN2+= motd 141FILESBUILD_motd= YES 142 143# -rw------- 144BIN3+= hosts.equiv wpa_supplicant.conf 145 146SYSPKG= etc 147ETC_PKG=-T etc_pkg 148BASE_PKG=-T base_pkg 149ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} 150ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} 151 152.if ${TARGET_ENDIANNESS} == "1234" 153PWD_MKDB_ENDIAN= -L 154.elif ${TARGET_ENDIANNESS} == "4321" 155PWD_MKDB_ENDIAN= -B 156.else 157PWD_MKDB_ENDIAN= 158.endif 159 160 161# distribution -- 162# Build a distribution 163# 164distribution: .PHONY .MAKE check_DESTDIR distrib-dirs 165.if !defined(DISTRIBUTION_DONE) 166.if !defined(INSTALL_DONE) 167 ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB= 168 ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB= 169.endif # !INSTALL_DONE 170 ${MAKEDIRTARGET} . install-debugkernels 171 ${MAKEDIRTARGET} . install-etc-files 172. if ${MKX11} != "no" 173 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution 174. endif 175. if ${MKEXTSRC} != "no" 176 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution 177. endif 178 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles 179.endif # !DISTRIBUTION_DONE 180 181 182# motd is copied from a different ${MOTD_SOURCE} depending on DISTRIBVER 183# 184.if !empty(DISTRIBVER:M*.99.*) 185MOTD_SOURCE= motd.current 186.elif !empty(DISTRIBVER:M*BETA*) 187MOTD_SOURCE= motd.beta 188.elif !empty(DISTRIBVER:M*RC*) 189MOTD_SOURCE= motd.rc 190.else 191MOTD_SOURCE= motd.default 192.endif 193CLEANFILES+= motd 194motd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS} 195 ${_MKTARGET_CREATE} 196 ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET} 197 198CLEANFILES+= MAKEDEV 199MAKEDEV_MACHINE=${"${MACHINE_CPU}" == "aarch64":?${MACHINE_CPU}:${MACHINE}} 200MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 201 ${.CURDIR}/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf 202 ${_MKTARGET_CREATE} 203 MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 204 NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ 205 ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 206 > ${.TARGET} 207 208.include "${NETBSDSRCDIR}/etc/Makefile.params" 209 210CLEANFILES+= etc-release 211etc-release: .EXEC .MAKE 212 ${_MKTARGET_CREATE} 213 @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \ 214 echo ; \ 215 cat ${NETBSDSRCDIR}/sys/conf/copyright; \ 216 echo ; \ 217 echo "Build information:"; \ 218 printf "%20s %s\n" "Build date" "${BUILD_DATE}"; \ 219 printf "%20s %s\n" "Built by" "${BUILDER}"; \ 220 if [ -n "${BUILDID}" ]; then \ 221 printf "%20s %s\n" "Build ID" "${BUILDID}" ; \ 222 fi ; \ 223 if [ -n "${BUILDINFO}" ]; then \ 224 echo ; \ 225 info="$$(printf "%b" ${BUILDINFO:Q})" ; \ 226 printf "%s\n" "$${info}" \ 227 | ${TOOL_SED} -e 's/^/ /' ; \ 228 fi ; \ 229 echo ; \ 230 echo "Build settings:"; \ 231 echo ; \ 232 ${PRINT_PARAMS} ; \ 233 ) >${.OBJDIR}/${.TARGET} 234 235install-etc-release: .PHONY etc-release 236 ${_MKMSG_INSTALL} etc/release 237 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \ 238 etc-release ${DESTDIR}/etc/release 239 240 241FILESDIR= /etc 242CONFIGFILES= 243CONFIGSYMLINKS= 244 245.for file in ${BIN1} 246CONFIGFILES+= ${file} 247FILESMODE_${file:T}= 644 248.endfor 249 250.for file in ${BIN2} 251CONFIGFILES+= ${file} 252FILESMODE_${file:T}= 664 253.endfor 254 255.for file in ${BIN3} 256CONFIGFILES+= ${file} 257FILESMODE_${file:T}= 600 258.endfor 259 260.if (${MKPOSTFIX} != "no") 261CONFIGFILES+= aliases 262FILESDIR_aliases= /etc/mail 263FILESMODE_aliases= 644 264.endif 265 266CONFIGFILES+= MAKEDEV.local 267FILESDIR_MAKEDEV.local= /dev 268FILESMODE_MAKEDEV.local=${BINMODE} 269 270CONFIGFILES+= crontab 271FILESDIR_crontab= /var/cron/tabs 272FILESNAME_crontab= root 273FILESMODE_crontab= 600 274 275CONFIGFILES+= minfree 276FILESDIR_minfree= /var/crash 277FILESMODE_minfree= 600 278 279CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \ 280 /usr/sbin/rmt /etc/rmt 281 282 283# install-etc-files -- 284# Install etc (config) files; not performed by "make build" 285# 286install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV 287 ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd 288 ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 289 master.passwd ${DESTDIR}/etc 290 ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ 291 ${DESTDIR}/etc/master.passwd 292.if ${MKUNPRIVED} != "no" 293 ( \ 294 mode=0600; \ 295 for metaent in spwd.db passwd pwd.db; do \ 296 echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=wheel tags=etc_pkg"; \ 297 mode=0644; \ 298 done; \ 299 ) | ${METALOG.add} 300.endif # MKUNPRIVED != no 301 ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys 302.if exists(${.CURDIR}/etc.${MACHINE}/ttys) 303 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 304 ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc 305.else 306 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 307 ${.CURDIR}/etc.${MACHINE_CPU}/ttys ${DESTDIR}/etc 308.endif 309.if exists(etc.${MACHINE}/boot.cfg) 310 ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg 311 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 312 ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/ 313.endif 314 ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV 315 ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 316 MAKEDEV ${DESTDIR}/dev 317.for owner group mode file in \ 318 ${BINOWN} operator 664 /etc/dumpdates \ 319 ${BINOWN} operator 600 /etc/skeykeys \ 320 root wheel 600 /var/at/at.deny \ 321 root wheel 644 /var/db/locate.database \ 322 ${BINOWN} ${BINGRP} 600 /var/log/authlog \ 323 root wheel 600 /var/log/cron \ 324 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \ 325 ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \ 326 ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \ 327 ${BINOWN} ${BINGRP} 600 /var/log/maillog \ 328 ${BINOWN} ${BINGRP} 644 /var/log/messages \ 329 ${BINOWN} ${BINGRP} 600 /var/log/secure \ 330 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \ 331 ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \ 332 ${BINOWN} ${BINGRP} 600 /var/log/xferlog \ 333 daemon staff 664 /var/msgs/bounds \ 334 ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \ 335 ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \ 336 games games 664 /var/games/atc_score \ 337 games games 664 /var/games/battlestar.log \ 338 games games 664 /var/games/cfscores \ 339 games games 664 /var/games/criblog \ 340 games games 660 /var/games/hackdir/perm \ 341 games games 660 /var/games/hackdir/record \ 342 games games 664 /var/games/larn/llog12.0 \ 343 games games 664 /var/games/larn/lscore12.0 \ 344 games games 664 /var/games/larn/playerids \ 345 games games 664 /var/games/robots_roll \ 346 games games 664 /var/games/rogue.scores \ 347 games games 664 /var/games/saillog \ 348 games games 664 /var/games/snakerawscores \ 349 games games 664 /var/games/snake.log \ 350 games games 664 /var/games/tetris.scores 351 ${_MKMSG_INSTALL} ${DESTDIR}${file} 352 if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ 353 ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ 354 /dev/null ${DESTDIR}${file}; \ 355 else true; fi 356.endfor 357.for subdir in . defaults autofs bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh 358 ${MAKEDIRTARGET} ${subdir} configinstall 359.endfor 360 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall 361 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall 362.if (${MKPF} != "no") 363 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall 364.endif 365 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall 366.if (${MKPOSTFIX} != "no") 367 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall 368.endif 369.if (${MKATF} != "no") 370 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall 371.endif 372.if (${MKKYUA} != "no") 373 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua configinstall 374.endif 375 376 377# install-obsolete-lists -- 378# Install var/db/obsolete set lists; this is performed by "make build" 379# 380OBSOLETE.dir= ${.OBJDIR}/obsolete.dir 381OBSOLETE.files= base comp etc games gpufw man misc rescue text 382.if ${MKDEBUG} != "no" 383OBSOLETE.files+= debug 384.endif 385.if ${MKDTB} != "no" 386OBSOLETE.files+= dtb 387.endif 388.if ${MKKMOD} != "no" 389OBSOLETE.files+= modules 390.endif 391.if ${MKATF} != "no" 392OBSOLETE.files+= tests 393.endif 394.if ${MKX11} != "no" 395OBSOLETE.files+= xbase xcomp xetc xfont xserver 396.if ${MKDEBUG} != "no" 397OBSOLETE.files+= xdebug 398.endif 399.endif 400 401# XXX make "makeobsolete" set wise; then generate files respectively 402install-obsolete-lists: .PHONY .MAKE 403 mkdir -p ${OBSOLETE.dir} 404.if ${MKX11} != "no" 405 (cd ${NETBSDSRCDIR}/distrib/sets && \ 406 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir}) 407.else 408 (cd ${NETBSDSRCDIR}/distrib/sets && \ 409 AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) 410.endif 411.for file in ${OBSOLETE.files} 412 ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file} 413 if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \ 414 ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \ 415 ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 416 ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \ 417 else true; fi 418.endfor 419 420 421# distrib-dirs -- 422# Populate $DESTDIR with directories needed by NetBSD 423# 424distrib-dirs: .PHONY check_DESTDIR 425 cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs 426 427COMPRESS_PROGRAM=${"${USE_XZ_SETS:Uno}"!="no":?${TOOL_XZ}:${TOOL_GZIP}} 428XZ_OPT=-9 429TAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?tar.xz:tgz} 430 431# release, snapshot -- 432# Build a full distribution including kernels & install media. 433# 434release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post 435 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets 436 ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \ 437 ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.${TAR_SUFF}@} 438 ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz' 439 440 441# iso-image -- 442# Standalone target to create a CDROM image after the release 443# was composed. Should be run after "make release" in src and xsrc. 444# The do-iso-image is to be called from etc.$MACHINE/Makefile.inc 445# 446# Note: At least mkisofs 2.0 should be used. 447# 448CDROM_NAME_ADD?= 449CDROM_IMAGE?=${RELEASEDIR}/images/NetBSD-${DISTRIBVER}-${MACHINE}.iso 450CDROM.dir= ${.OBJDIR}/cdrom.dir 451CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist 452 453iso-image: 454 455.if ${MKISOFS} != true 456do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post 457 ${MAKESUMS} -t ${RELEASEDIR}/images/ '*.iso' 458 @echo "iso-image created as: ${CDROM_IMAGE}" 459.else 460do-iso-image: 461 @echo iso-image: mkisofs not found 462.endif 463 464iso-image-setup: .PHONY check_RELEASEDIR 465 rm -f ${CDROM.pathlist} 466.for extra in README SOURCE_DATE source 467.if exists(${RELEASEDIR}/${extra}) 468 echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist} 469.endif 470.endfor 471 echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist} 472 mkdir -p ${CDROM.dir} 473 474check_imagedir: 475 mkdir -p ${RELEASEDIR}/images 476 477# iso-image-mi -- 478# Create the image after the MD operations have completed. 479# 480iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre check_imagedir 481 @if ! ${MKISOFS} --version; then \ 482 echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \ 483 false; \ 484 fi 485 ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ 486 -o ${CDROM_IMAGE} ${CDROM.dir} 487 488# iso-image-md-pre -- 489# Setup ${CDROM.dir} to produce a bootable CD image. 490# Overridden by etc.$MACHINE/Makefile.inc 491# 492iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup 493# (empty -- look in the machine-dependent Makefile.inc) 494 495# iso-image-md-post -- 496# Fixup the CD-image to be bootable. 497# Overridden by etc.$MACHINE/Makefile.inc 498# 499iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi 500# (empty -- look in the machine-dependent Makefile.inc) 501 502 503# live-image -- 504# Standalone target to create live images after the release was composed. 505# Should be run after "make release" in src and xsrc. 506# LIVEIMG_RELEASEDIR specifies where to install live images and 507# it can be set in MD etc.${MACHINE}/Makefile.inc. 508# 509LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images 510 511live-image: .PHONY check_DESTDIR check_RELEASEDIR 512 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \ 513 LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR} 514 ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz' 515 516# install-image -- 517# Standalone target to create installation images 518# after the release was composed. 519# Should be run after "make release" in src and xsrc. 520# INSTIMG_RELEASEDIR specifies where to install live images and 521# it can be set in MD etc.${MACHINE}/Makefile.inc. 522# 523INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images 524 525install-image: .PHONY check_DESTDIR check_RELEASEDIR 526 ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \ 527 INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR} 528 ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz' 529 530# snap_pre -- 531# Create ${RELEASEDIR} and necessary subdirectories. 532# 533snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution 534 ${INSTALL} -d -m 755 ${RELEASEDIR} 535.if ${MKUPDATE} == "no" 536# Could be a mount point, ignore the errors 537 -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR} 538.endif 539 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} 540.for dir in ${INSTALLATION_DIRS} 541 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} 542.endfor 543 544# snap_post -- 545# Build the install media and notes from distrib 546# 547snap_post: .PHONY .MAKE build_kernelsets build_releasekernels 548.if ${MKUPDATE} == "no" 549 cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 550.endif 551 cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 552 ${MAKE} release 553 554# build kernels -- 555# This target builds the kernels specified by each port. 556# A port may specify the following kernels: 557# 558# KERNEL_SETS The list of kernels that will be 559# packaged into sets, named 560# kern-${kernel}.tgz (or .tar.xz). 561# These kernels are also placed in the 562# binary/kernel area of the release package 563# as netbsd-${kernel}.gz. 564# 565# EXTRA_KERNELS Additional kernels to place in the 566# binary/kernel area of the release 567# package as netbsd-${kernel}.gz, but 568# which are not placed into sets. This 569# allows a port to provide e.g. a netbootable 570# installation kernel containing a ramdisk. 571# 572# BUILD_KERNELS Additional kernels to build which are 573# not placed into sets nor into the 574# binary/kernel area of the release 575# package. These are typically kernels 576# that are built for inclusion only in 577# installation disk/CD-ROM/tape images. 578# 579# A port may also specify KERNEL_SUFFIXES, which is an optional list 580# of filename suffixes for kernels to include in the kernel sets and 581# in the binary/kernel area of the release package (e.g. "netbsd" vs. 582# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels 583# with these suffixes do not exist in the kernel build directory. 584# 585# 586# A list of all the kernels to build, which can be overridden from 587# external sources (such as make(1)'s environment or command line) 588# 589ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} 590.export ALL_KERNELS 591 592GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \ 593 END{ if (found == 0) print "netbsd"; }' 594 595build_kernels: .PHONY 596# Configure & compile kernels listed in ${ALL_KERNELS} 597# 598.if !defined(KERNELS_DONE) # { 599.for configfile in ${ALL_KERNELS:O:u} # { 600build_kernels: kern-${configfile} 601kern-${configfile}: .PHONY .MAKE 602 cd ${KERNCONFDIR} && ${TOOL_CONFIG} ${CONFIGOPTS} -s ${KERNSRCDIR} \ 603 ${MKDEBUGKERNEL == "yes" :? -DDEBUG=-g :} \ 604 -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 605.if ${MKUPDATE} == "no" 606 ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} distclean 607.endif 608 ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} depend && \ 609 ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} && \ 610 ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} debuginstall 611.endfor # ALL_KERNELS # } 612.endif # KERNELS_DONE # } 613 614build_kernelsets: .PHONY 615# Create kernel sets from ${KERNEL_SETS} into 616# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 617# 618.for configfile in ${KERNEL_SETS:O:u} # { 619.for configsel in ${ALL_KERNELS:O:u} 620.if ${configfile} == ${configsel} 621build_kernelsets: kernset-${configfile} 622kernset-${configfile}: .PHONY build_kernels snap_pre 623 @kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \ 624 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 625 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 626 kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.${TAR_SUFF}; \ 627 pax_cmd="GZIP=${GZIP_FLAGS:Q} XZ_OPT=${XZ_OPT:Q} ${TOOL_PAX} ${PAX_TIMESTAMP} --use-compress-program ${COMPRESS_PROGRAM:Q} -O -w -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ 628 cd $${kerndir} && { \ 629 kernels=; newest=; \ 630 for kernel in $${kernlist}; do \ 631 for s in "" $${kernsuffixes}; do \ 632 ks="$${kernel}$${s}"; \ 633 [ -f $${ks} ] || continue; \ 634 kernels="$${kernels} $${ks}"; \ 635 [ -z "$${newest}" -o $${ks} \ 636 -nt "$${newest}" ] && newest=$${ks}; \ 637 [ ${MKDEBUGKERNEL} = "no" -o \ 638 ! -f $${ks}.gdb ] && continue; \ 639 kernels="$${kernels} $${ks}.gdb"; \ 640 done; \ 641 done; \ 642 [ $${kern_tgz} -nt "$${newest}" ] || { \ 643 echo "echo $${kernels} | $${pax_cmd}"; \ 644 if [ ${KERNEL_DIR} = "yes" ]; then \ 645 tmpdir=kernel$$; \ 646 trap "rm -fr $${tmpdir}" 0 1 2 3 15; \ 647 mkdir -p $${tmpdir}/netbsd; \ 648 d=./netbsd; \ 649 cd $${tmpdir}; \ 650 else \ 651 d=.; \ 652 fi; \ 653 ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 654 echo ". type=dir optional"; \ 655 if [ ${KERNEL_DIR} = "yes" ]; then \ 656 echo "./netbsd type=dir optional"; \ 657 fi; \ 658 for kernel in $${kernels}; do \ 659 if [ ${KERNEL_DIR} = "yes" ]; then \ 660 newname=$$(echo $${kernel} | \ 661 ${TOOL_SED} -e s/netbsd/kernel/); \ 662 ln ../$${kernel} ./netbsd/$${newname}; \ 663 else \ 664 newname=$${kernel}; \ 665 fi; \ 666 echo "$${d}/$${newname} type=file"; \ 667 done ) | eval $${pax_cmd}; \ 668 if [ ${KERNEL_DIR} = "yes" ]; then \ 669 mv $${kern_tgz} ..; \ 670 fi; \ 671 } \ 672 } 673.endif 674.endfor 675.endfor # KERNEL_SETS # } 676 677build_releasekernels: .PHONY 678# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 679# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel 680# 681.for configfile in ${KERNEL_SETS:O:u} ${EXTRA_KERNELS:O:u} # { 682.for configsel in ${ALL_KERNELS:O:u} 683.if ${configfile} == ${configsel} 684build_releasekernels: releasekern-${configfile} 685releasekern-${configfile}: .PHONY build_kernels snap_pre 686 @kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \ 687 kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 688 kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 689 dest="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel"; \ 690 cd $${kerndir} && { \ 691 for kernel in $${kernlist}; do \ 692 for s in "" $${kernsuffixes}; do \ 693 ks="$${kernel}$${s}"; \ 694 [ ! -f $${ks} ] && continue; \ 695 knl_gz="$${dest}/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \ 696 [ $${knl_gz} -nt $${ks} ] && continue; \ 697 rm -f $${knl_gz}; \ 698 echo "${TOOL_GZIP} ${GZIP_FLAGS} -c < $${kerndir}/$${ks} > $${knl_gz}"; \ 699 ${TOOL_GZIP} ${GZIP_FLAGS} -c < $${ks} > $${knl_gz}; \ 700 done; \ 701 done; \ 702 } 703.endif 704.endfor 705.endfor # KERNEL_SETS EXTRA_KERNELS # } 706 707# install-debugkernels: 708# Create fake kernel debug files to satisfy the sets requirements 709# They will be later replaced with the real ones if we are building 710# kernels. This mess is needed because checkflist runs before the 711# kernels are built. It should really run before the sets are build. 712install-debugkernels: 713.if ${MKDEBUG:Uno} == "yes" 714 @for i in $$(${NETBSDSRCDIR}/distrib/sets/makeflist debug | \ 715 ${TOOL_GREP} -E '^./usr/libdata/debug/(nfs)?netbsd-'); do \ 716 echo touch ${DESTDIR}/$$i; \ 717 touch ${DESTDIR}/$$i; \ 718 done 719. for k in ${ALL_KERNELS} 720install-debugkernels: ${DESTDIR}${DEBUGDIR}/netbsd-${k}.debug 721 722${DESTDIR}${DEBUGDIR}/netbsd-${k}.debug: 723 ${_MKTARGET_INSTALL} 724 touch ${.TARGET} 725. endfor 726.endif 727 728# snap_md_post -- 729# Machine dependent distribution media operations. 730# Overridden by etc.$MACHINE/Makefile.inc 731# 732snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post 733# (empty -- look in the machine-dependent Makefile.inc) 734 735 736clean: 737 -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 738 739SUBDIR= defaults rc.d mtree 740 741.include <bsd.prog.mk> 742.include <bsd.subdir.mk> 743 744test: 745 @echo ${OBSOLETE.files} 746