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