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