Makefile revision 1.464
11.464Srin# $NetBSD: Makefile,v 1.464 2022/05/30 15:06:55 rin Exp $ 21.66Smikel# from: @(#)Makefile 8.7 (Berkeley) 5/25/95 31.1Scgd 41.96Scjs# Environment variables without default values: 51.96Scjs# DESTDIR must be set before anything in this file will work. 61.96Scjs# RELEASEDIR is where the tarred up stuff for a snapshot or 71.96Scjs# release will be placed. 81.96Scjs# 91.96Scjs# Environment variables with default values: 101.96Scjs# LOCALTIME will set the default local time for the system you 111.96Scjs# build; it determines what /etc/localtime is symlink'd to. 121.96Scjs# KERNSRCDIR points to kernel source; it is set by default to ../sys, 131.96Scjs# but can be overridden. 141.96Scjs# KERNOBJDIR is the kernel build directory, it defaults to 151.172Sjlam# ${KERNSRCDIR}/arch/${MACHINE}/compile, but can be overridden. 161.96Scjs# KERNCONFDIR is where the configuration files for kernels are found; 171.96Scjs# default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden. 181.304Slukem# MKPOSTFIX; if not `no', install postfix configuration 191.270Slukem# MKUNPRIVED; if not `no', allow non-root installs. 201.255Slukem# MKUPDATE; if not `no', don't do a 'make clean' before kernel compile 211.154Sthorpej# 221.96Scjs# Targets: 231.96Scjs# distribution: makes a full NetBSD distribution in DESTDIR. If 241.96Scjs# INSTALL_DONE is set, it will not do a `make install.' 251.182Schs# if DISTRIBUTION_DONE is set, it will not do anything. 261.96Scjs# distrib-dirs: creates an empty NetBSD directory tree in DESTDIR. 271.96Scjs# Called by distribution. 281.96Scjs# snapshot: calls distribution, above, and then tars up the files 291.286Scl# into a release(7) format in RELEASEDIR/${RELEASEMACHINEDIR}. 301.241Slukem# Any port-dependent stuff for this target is found in 311.241Slukem# etc.${MACHINE}/Makefile.inc. 321.106Scjs# release: a synonym for `snapshot' 331.242Slukem# 341.199Stv 351.270Slukem# For MK* vars 361.90Skim.include <bsd.own.mk> 371.187Sjmc 381.260Slukem.include <bsd.kernobj.mk> # For KERNSRCDIR, KERNOBJDIR, ... 391.260Slukem.include <bsd.endian.mk> # For TARGET_ENDIANNESS 401.252Slukem 411.187Sjmc.MAKEOVERRIDES+= USETOOLS 421.90Skim 431.23ScgdTZDIR= /usr/share/zoneinfo 441.157SkleinkLOCALTIME?= UTC 451.283SagcCKSUM?= ${TOOL_CKSUM} 461.330SchristosMAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums 471.266SlukemDISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh 481.19Sderaadt 491.419SapbGZIP_FLAGS= -9 ${GZIP_N_FLAG} 501.419Sapb 511.161Shubertf# Flags for creating ISO CDROM image 521.320Sapb# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools 531.242Slukem# Note: At least mkisofs 2.0 should be used. 541.242Slukem# 551.341Sbouyer.if !defined(MKISOFS) 561.407SuebayasiMKISOFS!= (which mkisofs || echo true) 2>/dev/null 571.341Sbouyer.endif 581.260SlukemDISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s 591.224Sbjh21# ISO 9660 volume ID. Note that this can only contain [A-Z0-9_]. 601.306SmartinISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z 611.306SmartinMKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \ 621.224Sbjh21 -V ${ISO_VOLID} \ 631.331Slukem -publisher "The NetBSD Project" \ 641.286Scl -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom" 651.306Smartin.if ${MKISOFS_FLAGS:N-v} 661.306SmartinMKISOFS_FLAGS+= -quiet 671.306Smartin.endif 681.306Smartin 691.426Schristos# Reproducible build parameters 701.426Schristos.if ${MKREPRO:Uno} == "no" 711.426SchristosBUILDER!= echo $${USER-root}@$$(hostname) 721.426Schristos.else 731.426SchristosBUILDER= builder@localhost.NetBSD.org 741.426Schristos.endif 751.426Schristos.if ${MKREPRO_TIMESTAMP:Uno} == "no" 761.426SchristosPAX_TIMESTAMP= 771.426SchristosBUILD_DATE!= date -u 781.426Schristos.else 791.426SchristosPAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}" 801.450SchristosBUILD_DATE!= ${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" 811.426Schristos.endif 821.1Scgd 831.80Sjonathan# MD Makefile.inc may append MD targets to BIN[123]. Make sure all 841.316Shubertf# are empty, to preserve the old semantics of setting them below with "+=". 851.242Slukem# 861.200SlukemBIN1= 871.80SjonathanBIN2= 881.80SjonathanBIN3= 891.80Sjonathan 901.286Scl# Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}. 911.241Slukem# MD Makefile.inc files can add to this. 921.117Ssimonb# NOTE: Parent directories must be listed before subdirectories. 931.242Slukem# 941.217SlukemINSTALLATION_DIRS= binary binary/sets binary/kernel installation 951.117Ssimonb 961.286Scl.if exists(etc.${RELEASEMACHINE}/Makefile.inc) 971.286Scl.include "etc.${RELEASEMACHINE}/Makefile.inc" 981.71Scjs.endif 991.32Sjtc 1001.21Scgd# -rw-r--r-- 1011.21ScgdBINOWN= root 1021.21ScgdBINGRP= wheel 1031.227SperryUTMPGRP= utmp 1041.432SchristosBIN1+= auto_master bootptab changelist csh.cshrc csh.login \ 1051.345Sadrianp csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \ 1061.370Smbalmer ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \ 1071.345Sadrianp locate.conf login.conf mailer.conf man.conf monthly monthly.conf \ 1081.459Snia named.conf netconfig networks newsyslog.conf \ 1091.461Snia nsswitch.conf passwd.conf pkgpath.conf phones printcap \ 1101.408Sagc profile protocols rbootd.conf rc rc.conf rc.local rc.subr \ 1111.408Sagc rc.shutdown remote rpc security security.conf services shells \ 1121.408Sagc shrc sysctl.conf syslog.conf weekly weekly.conf wscons.conf 1131.291Slukem 1141.460Snia.if ${MKMROUTING} != "no" 1151.459SniaBIN1+= mrouted.conf 1161.459Snia.endif 1171.459Snia 1181.461Snia.if ${MKNTP} != "no" 1191.462SniaBIN1+= ntp.conf 1201.461Snia.endif 1211.461Snia 1221.242Slukem# Use machine-specific disktab if it exists, or the MI one otherwise 1231.236Sjdolecek.if exists(etc.${MACHINE}/disktab) 1241.236SjdolecekBIN1+= etc.${MACHINE}/disktab 1251.236Sjdolecek.else 1261.236SjdolecekBIN1+= disktab 1271.236Sjdolecek.endif 1281.105Smycroft 1291.433Sryo.if exists(etc.${MACHINE}/ld.so.conf) && \ 1301.464Srin empty(MACHINE_ARCH:M*arm*hf*) && empty(MACHINE_ARCH:Maarch64*) && \ 1311.464Srin ${MACHINE_ARCH} != "powerpc64" 1321.234SjdolecekBIN1+= etc.${MACHINE}/ld.so.conf 1331.152Sperry.endif 1341.152Sperry 1351.234Sjdolecek.if exists(etc.${MACHINE}/ttyaction) 1361.234SjdolecekBIN1+= etc.${MACHINE}/ttyaction 1371.105Smycroft.endif 1381.1Scgd 1391.46Sderaadt# -rw-rw-r-- 1401.80SjonathanBIN2+= motd 1411.400SapbFILESBUILD_motd= YES 1421.1Scgd 1431.77Smycroft# -rw------- 1441.438SroyBIN3+= hosts.equiv wpa_supplicant.conf 1451.77Smycroft 1461.291SlukemSYSPKG= etc 1471.230SperryETC_PKG=-T etc_pkg 1481.230SperryBASE_PKG=-T base_pkg 1491.242SlukemETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} 1501.261SclETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} 1511.230Sperry 1521.191Stv.if ${TARGET_ENDIANNESS} == "1234" 1531.252SlukemPWD_MKDB_ENDIAN= -L 1541.191Stv.elif ${TARGET_ENDIANNESS} == "4321" 1551.252SlukemPWD_MKDB_ENDIAN= -B 1561.170Sjdolecek.else 1571.252SlukemPWD_MKDB_ENDIAN= 1581.191Stv.endif 1591.149Ssjg 1601.149Ssjg 1611.242Slukem# distribution -- 1621.242Slukem# Build a distribution 1631.242Slukem# 1641.324Sdsldistribution: .PHONY .MAKE check_DESTDIR distrib-dirs 1651.182Schs.if !defined(DISTRIBUTION_DONE) 1661.87Sperry.if !defined(INSTALL_DONE) 1671.285Slukem ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB= 1681.285Slukem ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB= 1691.200Slukem.endif # !INSTALL_DONE 1701.456Schristos ${MAKEDIRTARGET} . install-debugkernels 1711.285Slukem ${MAKEDIRTARGET} . install-etc-files 1721.360Smrg. if ${MKX11} != "no" 1731.358Slukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution 1741.360Smrg. endif 1751.374Suebayasi. if ${MKEXTSRC} != "no" 1761.374Suebayasi ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution 1771.374Suebayasi. endif 1781.285Slukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles 1791.200Slukem.endif # !DISTRIBUTION_DONE 1801.193Sthorpej 1811.266Slukem 1821.400Sapb# motd is copied from a different ${MOTD_SOURCE} depending on DISTRIBVER 1831.400Sapb# 1841.400Sapb.if !empty(DISTRIBVER:M*.99.*) 1851.400SapbMOTD_SOURCE= motd.current 1861.400Sapb.elif !empty(DISTRIBVER:M*BETA*) 1871.400SapbMOTD_SOURCE= motd.beta 1881.400Sapb.elif !empty(DISTRIBVER:M*RC*) 1891.400SapbMOTD_SOURCE= motd.rc 1901.400Sapb.else 1911.400SapbMOTD_SOURCE= motd.default 1921.400Sapb.endif 1931.400SapbCLEANFILES+= motd 1941.400Sapbmotd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS} 1951.400Sapb ${_MKTARGET_CREATE} 1961.400Sapb ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET} 1971.400Sapb 1981.340SapbCLEANFILES+= MAKEDEV 1991.421SmattMAKEDEV_MACHINE=${"${MACHINE_CPU}" == "aarch64":?${MACHINE_CPU}:${MACHINE}} 2001.386SuebayasiMAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 2011.421Smatt ${.CURDIR}/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf 2021.263Slukem ${_MKTARGET_CREATE} 2031.421Smatt MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 2041.264Slukem NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ 2051.359Sapb ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ 2061.359Sapb > ${.TARGET} 2071.257Sjdolecek 2081.401Sapb.include "${NETBSDSRCDIR}/etc/Makefile.params" 2091.425Schristos 2101.272SlukemCLEANFILES+= etc-release 2111.322Sdsletc-release: .EXEC .MAKE 2121.266Slukem ${_MKTARGET_CREATE} 2131.266Slukem @( echo "NetBSD ${DISTRIBVER}/${MACHINE}"; \ 2141.266Slukem echo ; \ 2151.269Slukem cat ${NETBSDSRCDIR}/sys/conf/copyright; \ 2161.266Slukem echo ; \ 2171.416Sapb echo "Build information:"; \ 2181.425Schristos printf "%20s %s\n" "Build date" "${BUILD_DATE}"; \ 2191.425Schristos printf "%20s %s\n" "Built by" "${BUILDER}"; \ 2201.414Sapb if [ -n "${BUILDID}" ]; then \ 2211.416Sapb printf "%20s %s\n" "Build ID" "${BUILDID}" ; \ 2221.416Sapb fi ; \ 2231.416Sapb if [ -n "${BUILDINFO}" ]; then \ 2241.416Sapb echo ; \ 2251.416Sapb info="$$(printf "%b" ${BUILDINFO:Q})" ; \ 2261.416Sapb printf "%s\n" "$${info}" \ 2271.416Sapb | ${TOOL_SED} -e 's/^/ /' ; \ 2281.414Sapb fi ; \ 2291.281Slukem echo ; \ 2301.416Sapb echo "Build settings:"; \ 2311.416Sapb echo ; \ 2321.401Sapb ${PRINT_PARAMS} ; \ 2331.276Slukem ) >${.OBJDIR}/${.TARGET} 2341.266Slukem 2351.275Slukeminstall-etc-release: .PHONY etc-release 2361.272Slukem ${_MKMSG_INSTALL} etc/release 2371.266Slukem ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \ 2381.272Slukem etc-release ${DESTDIR}/etc/release 2391.242Slukem 2401.291Slukem 2411.291SlukemFILESDIR= /etc 2421.291SlukemCONFIGFILES= 2431.291SlukemCONFIGSYMLINKS= 2441.291Slukem 2451.291Slukem.for file in ${BIN1} 2461.291SlukemCONFIGFILES+= ${file} 2471.291SlukemFILESMODE_${file:T}= 644 2481.291Slukem.endfor 2491.291Slukem 2501.291Slukem.for file in ${BIN2} 2511.291SlukemCONFIGFILES+= ${file} 2521.291SlukemFILESMODE_${file:T}= 664 2531.291Slukem.endfor 2541.291Slukem 2551.291Slukem.for file in ${BIN3} 2561.291SlukemCONFIGFILES+= ${file} 2571.291SlukemFILESMODE_${file:T}= 600 2581.291Slukem.endfor 2591.291Slukem 2601.327Stron.if (${MKPOSTFIX} != "no") 2611.291SlukemCONFIGFILES+= aliases 2621.291SlukemFILESDIR_aliases= /etc/mail 2631.291SlukemFILESMODE_aliases= 644 2641.327Stron.endif 2651.291Slukem 2661.291SlukemCONFIGFILES+= MAKEDEV.local 2671.291SlukemFILESDIR_MAKEDEV.local= /dev 2681.291SlukemFILESMODE_MAKEDEV.local=${BINMODE} 2691.291Slukem 2701.291SlukemCONFIGFILES+= crontab 2711.291SlukemFILESDIR_crontab= /var/cron/tabs 2721.291SlukemFILESNAME_crontab= root 2731.291SlukemFILESMODE_crontab= 600 2741.291Slukem 2751.291SlukemCONFIGFILES+= minfree 2761.291SlukemFILESDIR_minfree= /var/crash 2771.291SlukemFILESMODE_minfree= 600 2781.291Slukem 2791.291SlukemCONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \ 2801.291Slukem /usr/sbin/rmt /etc/rmt 2811.291Slukem 2821.291Slukem 2831.242Slukem# install-etc-files -- 2841.242Slukem# Install etc (config) files; not performed by "make build" 2851.242Slukem# 2861.340Sapbinstall-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV 2871.291Slukem ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd 2881.230Sperry ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ 2891.230Sperry master.passwd ${DESTDIR}/etc 2901.254Slukem ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ 2911.230Sperry ${DESTDIR}/etc/master.passwd 2921.255Slukem.if ${MKUNPRIVED} != "no" 2931.222Slukem ( \ 2941.403Schristos mode=0600; \ 2951.403Schristos for metaent in spwd.db passwd pwd.db; do \ 2961.403Schristos echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=wheel tags=etc_pkg"; \ 2971.403Schristos mode=0644; \ 2981.246Slukem done; \ 2991.239Slukem ) | ${METALOG.add} 3001.255Slukem.endif # MKUNPRIVED != no 3011.291Slukem ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys 3021.421Smatt.if exists(${.CURDIR}/etc.${MACHINE}/ttys) 3031.289Schristos ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 3041.298Schristos ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc 3051.421Smatt.else 3061.421Smatt ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 3071.421Smatt ${.CURDIR}/etc.${MACHINE_CPU}/ttys ${DESTDIR}/etc 3081.421Smatt.endif 3091.351Sad.if exists(etc.${MACHINE}/boot.cfg) 3101.351Sad ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg 3111.351Sad ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 3121.351Sad ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/ 3131.351Sad.endif 3141.291Slukem ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV 3151.259Sross ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ 3161.257Sjdolecek MAKEDEV ${DESTDIR}/dev 3171.291Slukem.for owner group mode file in \ 3181.291Slukem ${BINOWN} operator 664 /etc/dumpdates \ 3191.291Slukem ${BINOWN} operator 600 /etc/skeykeys \ 3201.291Slukem root wheel 600 /var/at/at.deny \ 3211.378Sdholland root wheel 644 /var/db/locate.database \ 3221.291Slukem ${BINOWN} ${BINGRP} 600 /var/log/authlog \ 3231.291Slukem root wheel 600 /var/log/cron \ 3241.313Slukem ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \ 3251.313Slukem ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \ 3261.291Slukem ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \ 3271.291Slukem ${BINOWN} ${BINGRP} 600 /var/log/maillog \ 3281.291Slukem ${BINOWN} ${BINGRP} 644 /var/log/messages \ 3291.291Slukem ${BINOWN} ${BINGRP} 600 /var/log/secure \ 3301.313Slukem ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \ 3311.313Slukem ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \ 3321.291Slukem ${BINOWN} ${BINGRP} 600 /var/log/xferlog \ 3331.291Slukem daemon staff 664 /var/msgs/bounds \ 3341.291Slukem ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \ 3351.291Slukem ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \ 3361.291Slukem games games 664 /var/games/atc_score \ 3371.291Slukem games games 664 /var/games/battlestar.log \ 3381.291Slukem games games 664 /var/games/cfscores \ 3391.291Slukem games games 664 /var/games/criblog \ 3401.291Slukem games games 660 /var/games/hackdir/perm \ 3411.291Slukem games games 660 /var/games/hackdir/record \ 3421.291Slukem games games 664 /var/games/larn/llog12.0 \ 3431.291Slukem games games 664 /var/games/larn/lscore12.0 \ 3441.291Slukem games games 664 /var/games/larn/playerids \ 3451.291Slukem games games 664 /var/games/robots_roll \ 3461.291Slukem games games 664 /var/games/rogue.scores \ 3471.291Slukem games games 664 /var/games/saillog \ 3481.291Slukem games games 664 /var/games/snakerawscores \ 3491.291Slukem games games 664 /var/games/snake.log \ 3501.291Slukem games games 664 /var/games/tetris.scores 3511.291Slukem ${_MKMSG_INSTALL} ${DESTDIR}${file} 3521.385Suebayasi if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ 3531.385Suebayasi ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ 3541.440Sgson /dev/null ${DESTDIR}${file}; \ 3551.385Suebayasi else true; fi 3561.291Slukem.endfor 3571.432Schristos.for subdir in . defaults autofs bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh 3581.291Slukem ${MAKEDIRTARGET} ${subdir} configinstall 3591.291Slukem.endfor 3601.357Sjoerg ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall 3611.287Slukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall 3621.303Speter.if (${MKPF} != "no") 3631.294Syamt ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall 3641.303Speter.endif 3651.369Smrg ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall 3661.304Slukem.if (${MKPOSTFIX} != "no") 3671.367Stron ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall 3681.304Slukem.endif 3691.363Sjmmv.if (${MKATF} != "no") 3701.363Sjmmv ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall 3711.363Sjmmv.endif 3721.406Sjmmv.if (${MKKYUA} != "no") 3731.406Sjmmv ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua configinstall 3741.406Sjmmv.endif 3751.247Slukem 3761.247Slukem 3771.247Slukem# install-obsolete-lists -- 3781.247Slukem# Install var/db/obsolete set lists; this is performed by "make build" 3791.247Slukem# 3801.247SlukemOBSOLETE.dir= ${.OBJDIR}/obsolete.dir 3811.452SmayaOBSOLETE.files= base comp etc games gpufw man misc rescue text 3821.405Smatt.if ${MKDEBUG} != "no" 3831.405SmattOBSOLETE.files+= debug 3841.405Smatt.endif 3851.445Sjmcneill.if ${MKDTB} != "no" 3861.445SjmcneillOBSOLETE.files+= dtb 3871.445Sjmcneill.endif 3881.376She.if ${MKKMOD} != "no" 3891.376SheOBSOLETE.files+= modules 3901.376She.endif 3911.383Snjoly.if ${MKATF} != "no" 3921.383SnjolyOBSOLETE.files+= tests 3931.383Snjoly.endif 3941.360Smrg.if ${MKX11} != "no" 3951.311SlukemOBSOLETE.files+= xbase xcomp xetc xfont xserver 3961.449Smartin.if ${MKDEBUG} != "no" 3971.449SmartinOBSOLETE.files+= xdebug 3981.449Smartin.endif 3991.307Stron.endif 4001.247Slukem 4011.387Suebayasi# XXX make "makeobsolete" set wise; then generate files respectively 4021.322Sdslinstall-obsolete-lists: .PHONY .MAKE 4031.246Slukem mkdir -p ${OBSOLETE.dir} 4041.360Smrg.if ${MKX11} != "no" 4051.307Stron (cd ${NETBSDSRCDIR}/distrib/sets && \ 4061.364Ssketch AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir}) 4071.307Stron.else 4081.253Slukem (cd ${NETBSDSRCDIR}/distrib/sets && \ 4091.364Ssketch AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) 4101.307Stron.endif 4111.246Slukem.for file in ${OBSOLETE.files} 4121.291Slukem ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file} 4131.387Suebayasi if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \ 4141.387Suebayasi ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \ 4151.387Suebayasi ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ 4161.387Suebayasi ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \ 4171.387Suebayasi else true; fi 4181.246Slukem.endfor 4191.1Scgd 4201.242Slukem 4211.242Slukem# distrib-dirs -- 4221.242Slukem# Populate $DESTDIR with directories needed by NetBSD 4231.242Slukem# 4241.371Smrgdistrib-dirs: .PHONY check_DESTDIR 4251.371Smrg cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs 4261.255Slukem 4271.437SmartinCOMPRESS_PROGRAM=${"${USE_XZ_SETS:Uno}"!="no":?${TOOL_XZ}:${TOOL_GZIP}} 4281.434SmartinXZ_OPT=-9 4291.437SmartinTAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?tar.xz:tgz} 4301.242Slukem 4311.242Slukem# release, snapshot -- 4321.242Slukem# Build a full distribution including kernels & install media. 4331.242Slukem# 4341.324Sdslrelease snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post 4351.285Slukem ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets 4361.315Sjmc ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \ 4371.434Smartin ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.${TAR_SUFF}@} 4381.286Scl ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz' 4391.161Shubertf 4401.242Slukem 4411.242Slukem# iso-image -- 4421.242Slukem# Standalone target to create a CDROM image after the release 4431.242Slukem# was composed. Should be run after "make release" in src and xsrc. 4441.341Sbouyer# The do-iso-image is to be called from etc.$MACHINE/Makefile.inc 4451.242Slukem# 4461.245Slukem# Note: At least mkisofs 2.0 should be used. 4471.242Slukem# 4481.292SheCDROM_NAME_ADD?= 4491.415SmartinCDROM_IMAGE?=${RELEASEDIR}/images/NetBSD-${DISTRIBVER}-${MACHINE}.iso 4501.319SapbCDROM.dir= ${.OBJDIR}/cdrom.dir 4511.319SapbCDROM.pathlist= ${.OBJDIR}/cdrom.pathlist 4521.242Slukem 4531.341Sbouyeriso-image: 4541.341Sbouyer 4551.341Sbouyer.if ${MKISOFS} != true 4561.341Sbouyerdo-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post 4571.415Smartin ${MAKESUMS} -t ${RELEASEDIR}/images/ '*.iso' 4581.395Sjoerg @echo "iso-image created as: ${CDROM_IMAGE}" 4591.341Sbouyer.else 4601.341Sbouyerdo-iso-image: 4611.341Sbouyer @echo iso-image: mkisofs not found 4621.341Sbouyer.endif 4631.161Shubertf 4641.275Slukemiso-image-setup: .PHONY check_RELEASEDIR 4651.242Slukem rm -f ${CDROM.pathlist} 4661.302Sfredb.for extra in README SOURCE_DATE source 4671.302Sfredb.if exists(${RELEASEDIR}/${extra}) 4681.302Sfredb echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist} 4691.302Sfredb.endif 4701.302Sfredb.endfor 4711.342Sbad echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist} 4721.242Slukem mkdir -p ${CDROM.dir} 4731.415Smartin 4741.415Smartincheck_imagedir: 4751.415Smartin mkdir -p ${RELEASEDIR}/images 4761.242Slukem 4771.248Slukem# iso-image-mi -- 4781.242Slukem# Create the image after the MD operations have completed. 4791.248Slukem# 4801.415Smartiniso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre check_imagedir 4811.242Slukem @if ! ${MKISOFS} --version; then \ 4821.320Sapb echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \ 4831.242Slukem false; \ 4841.161Shubertf fi 4851.242Slukem ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ 4861.395Sjoerg -o ${CDROM_IMAGE} ${CDROM.dir} 4871.242Slukem 4881.248Slukem# iso-image-md-pre -- 4891.242Slukem# Setup ${CDROM.dir} to produce a bootable CD image. 4901.242Slukem# Overridden by etc.$MACHINE/Makefile.inc 4911.242Slukem# 4921.324Sdsliso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup 4931.242Slukem# (empty -- look in the machine-dependent Makefile.inc) 4941.161Shubertf 4951.248Slukem# iso-image-md-post -- 4961.242Slukem# Fixup the CD-image to be bootable. 4971.242Slukem# Overridden by etc.$MACHINE/Makefile.inc 4981.242Slukem# 4991.324Sdsliso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi 5001.242Slukem# (empty -- look in the machine-dependent Makefile.inc) 5011.41Scgd 5021.242Slukem 5031.396Stsutsui# live-image -- 5041.396Stsutsui# Standalone target to create live images after the release was composed. 5051.396Stsutsui# Should be run after "make release" in src and xsrc. 5061.396Stsutsui# LIVEIMG_RELEASEDIR specifies where to install live images and 5071.396Stsutsui# it can be set in MD etc.${MACHINE}/Makefile.inc. 5081.396Stsutsui# 5091.398SrizLIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images 5101.396Stsutsui 5111.396Stsutsuilive-image: .PHONY check_DESTDIR check_RELEASEDIR 5121.396Stsutsui ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \ 5131.396Stsutsui LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR} 5141.396Stsutsui ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz' 5151.396Stsutsui 5161.396Stsutsui# install-image -- 5171.396Stsutsui# Standalone target to create installation images 5181.396Stsutsui# after the release was composed. 5191.396Stsutsui# Should be run after "make release" in src and xsrc. 5201.396Stsutsui# INSTIMG_RELEASEDIR specifies where to install live images and 5211.396Stsutsui# it can be set in MD etc.${MACHINE}/Makefile.inc. 5221.396Stsutsui# 5231.398SrizINSTIMG_RELEASEDIR?= ${RELEASEDIR}/images 5241.396Stsutsui 5251.396Stsutsuiinstall-image: .PHONY check_DESTDIR check_RELEASEDIR 5261.396Stsutsui ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \ 5271.396Stsutsui INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR} 5281.396Stsutsui ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz' 5291.396Stsutsui 5301.242Slukem# snap_pre -- 5311.242Slukem# Create ${RELEASEDIR} and necessary subdirectories. 5321.242Slukem# 5331.324Sdslsnap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution 5341.241Slukem ${INSTALL} -d -m 755 ${RELEASEDIR} 5351.255Slukem.if ${MKUPDATE} == "no" 5361.168Sjmc# Could be a mount point, ignore the errors 5371.286Scl -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR} 5381.240Slukem.endif 5391.286Scl ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} 5401.117Ssimonb.for dir in ${INSTALLATION_DIRS} 5411.286Scl ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} 5421.117Ssimonb.endfor 5431.96Scjs 5441.242Slukem# snap_post -- 5451.242Slukem# Build the install media and notes from distrib 5461.242Slukem# 5471.324Sdslsnap_post: .PHONY .MAKE build_kernelsets build_releasekernels 5481.255Slukem.if ${MKUPDATE} == "no" 5491.233Slukem cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir 5501.233Slukem.endif 5511.233Slukem cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ 5521.233Slukem ${MAKE} release 5531.233Slukem 5541.324Sdsl# build kernels -- 5551.242Slukem# This target builds the kernels specified by each port. 5561.242Slukem# A port may specify the following kernels: 5571.196Sthorpej# 5581.196Sthorpej# KERNEL_SETS The list of kernels that will be 5591.196Sthorpej# packaged into sets, named 5601.436Smartin# kern-${kernel}.tgz (or .tar.xz). 5611.436Smartin# These kernels are also placed in the 5621.436Smartin# binary/kernel area of the release package 5631.436Smartin# as netbsd-${kernel}.gz. 5641.196Sthorpej# 5651.196Sthorpej# EXTRA_KERNELS Additional kernels to place in the 5661.203Schs# binary/kernel area of the release 5671.196Sthorpej# package as netbsd-${kernel}.gz, but 5681.196Sthorpej# which are not placed into sets. This 5691.196Sthorpej# allows a port to provide e.g. a netbootable 5701.196Sthorpej# installation kernel containing a ramdisk. 5711.196Sthorpej# 5721.196Sthorpej# BUILD_KERNELS Additional kernels to build which are 5731.196Sthorpej# not placed into sets nor into the 5741.203Schs# binary/kernel area of the release 5751.196Sthorpej# package. These are typically kernels 5761.196Sthorpej# that are built for inclusion only in 5771.196Sthorpej# installation disk/CD-ROM/tape images. 5781.116Sfair# 5791.242Slukem# A port may also specify KERNEL_SUFFIXES, which is an optional list 5801.242Slukem# of filename suffixes for kernels to include in the kernel sets and 5811.242Slukem# in the binary/kernel area of the release package (e.g. "netbsd" vs. 5821.242Slukem# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels 5831.242Slukem# with these suffixes do not exist in the kernel build directory. 5841.197Sthorpej# 5851.229Slukem# 5861.229Slukem# A list of all the kernels to build, which can be overridden from 5871.229Slukem# external sources (such as make(1)'s environment or command line) 5881.229Slukem# 5891.229SlukemALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} 5901.402Smlelstv.export ALL_KERNELS 5911.242Slukem 5921.359SapbGETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \ 5931.116Sfair END{ if (found == 0) print "netbsd"; }' 5941.242Slukem 5951.324Sdslbuild_kernels: .PHONY 5961.232Slukem# Configure & compile kernels listed in ${ALL_KERNELS} 5971.232Slukem# 5981.201Slukem.if !defined(KERNELS_DONE) # { 5991.424Suebayasi.for configfile in ${ALL_KERNELS:O:u} # { 6001.324Sdslbuild_kernels: kern-${configfile} 6011.322Sdslkern-${configfile}: .PHONY .MAKE 6021.422Suebayasi cd ${KERNCONFDIR} && ${TOOL_CONFIG} ${CONFIGOPTS} -s ${KERNSRCDIR} \ 6031.455Schristos ${MKDEBUGKERNEL == "yes" :? -DDEBUG=-g :} \ 6041.439Smartin -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} 6051.255Slukem.if ${MKUPDATE} == "no" 6061.427Schristos ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} distclean 6071.96Scjs.endif 6081.427Schristos ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} depend && \ 6091.456Schristos ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} && \ 6101.456Schristos ${MAKE} -C ${KERNOBJDIR}/${configfile:C/.*\///} debuginstall 6111.232Slukem.endfor # ALL_KERNELS # } 6121.232Slukem.endif # KERNELS_DONE # } 6131.232Slukem 6141.324Sdslbuild_kernelsets: .PHONY 6151.241Slukem# Create kernel sets from ${KERNEL_SETS} into 6161.286Scl# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets 6171.232Slukem# 6181.424Suebayasi.for configfile in ${KERNEL_SETS:O:u} # { 6191.424Suebayasi.for configsel in ${ALL_KERNELS:O:u} 6201.402Smlelstv.if ${configfile} == ${configsel} 6211.324Sdslbuild_kernelsets: kernset-${configfile} 6221.324Sdslkernset-${configfile}: .PHONY build_kernels snap_pre 6231.430Schristos @kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \ 6241.197Sthorpej kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 6251.256Sdsl kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 6261.434Smartin kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.${TAR_SUFF}; \ 6271.434Smartin 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}"; \ 6281.256Sdsl cd $${kerndir} && { \ 6291.256Sdsl kernels=; newest=; \ 6301.210Slukem for kernel in $${kernlist}; do \ 6311.256Sdsl for s in "" $${kernsuffixes}; do \ 6321.256Sdsl ks="$${kernel}$${s}"; \ 6331.256Sdsl [ -f $${ks} ] || continue; \ 6341.256Sdsl kernels="$${kernels} $${ks}"; \ 6351.442Schristos [ -z "$${newest}" -o $${ks} \ 6361.442Schristos -nt "$${newest}" ] && newest=$${ks}; \ 6371.455Schristos [ ${MKDEBUGKERNEL} = "no" -o \ 6381.458Skre ! -f $${ks}.gdb ] && continue; \ 6391.455Schristos kernels="$${kernels} $${ks}.gdb"; \ 6401.197Sthorpej done; \ 6411.256Sdsl done; \ 6421.256Sdsl [ $${kern_tgz} -nt "$${newest}" ] || { \ 6431.256Sdsl echo "echo $${kernels} | $${pax_cmd}"; \ 6441.444Schristos if [ ${KERNEL_DIR} = "yes" ]; then \ 6451.442Schristos tmpdir=kernel$$; \ 6461.442Schristos trap "rm -fr $${tmpdir}" 0 1 2 3 15; \ 6471.442Schristos mkdir -p $${tmpdir}/netbsd; \ 6481.442Schristos d=./netbsd; \ 6491.442Schristos cd $${tmpdir}; \ 6501.442Schristos else \ 6511.442Schristos d=.; \ 6521.442Schristos fi; \ 6531.256Sdsl ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ 6541.256Sdsl echo ". type=dir optional"; \ 6551.442Schristos if [ ${KERNEL_DIR} = "yes" ]; then \ 6561.442Schristos echo "./netbsd type=dir optional"; \ 6571.442Schristos fi; \ 6581.256Sdsl for kernel in $${kernels}; do \ 6591.442Schristos if [ ${KERNEL_DIR} = "yes" ]; then \ 6601.442Schristos newname=$$(echo $${kernel} | \ 6611.442Schristos ${TOOL_SED} -e s/netbsd/kernel/); \ 6621.442Schristos ln ../$${kernel} ./netbsd/$${newname}; \ 6631.442Schristos else \ 6641.442Schristos newname=$${kernel}; \ 6651.442Schristos fi; \ 6661.442Schristos echo "$${d}/$${newname} type=file"; \ 6671.256Sdsl done ) | eval $${pax_cmd}; \ 6681.442Schristos if [ ${KERNEL_DIR} = "yes" ]; then \ 6691.442Schristos mv $${kern_tgz} ..; \ 6701.442Schristos fi; \ 6711.256Sdsl } \ 6721.256Sdsl } 6731.402Smlelstv.endif 6741.402Smlelstv.endfor 6751.232Slukem.endfor # KERNEL_SETS # } 6761.232Slukem 6771.324Sdslbuild_releasekernels: .PHONY 6781.232Slukem# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into 6791.286Scl# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel 6801.232Slukem# 6811.424Suebayasi.for configfile in ${KERNEL_SETS:O:u} ${EXTRA_KERNELS:O:u} # { 6821.424Suebayasi.for configsel in ${ALL_KERNELS:O:u} 6831.402Smlelstv.if ${configfile} == ${configsel} 6841.324Sdslbuild_releasekernels: releasekern-${configfile} 6851.324Sdslreleasekern-${configfile}: .PHONY build_kernels snap_pre 6861.430Schristos @kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \ 6871.197Sthorpej kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ 6881.256Sdsl kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ 6891.429Schristos dest="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel"; \ 6901.256Sdsl cd $${kerndir} && { \ 6911.256Sdsl for kernel in $${kernlist}; do \ 6921.256Sdsl for s in "" $${kernsuffixes}; do \ 6931.256Sdsl ks="$${kernel}$${s}"; \ 6941.256Sdsl [ ! -f $${ks} ] && continue; \ 6951.429Schristos knl_gz="$${dest}/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \ 6961.256Sdsl [ $${knl_gz} -nt $${ks} ] && continue; \ 6971.352Sgdt rm -f $${knl_gz}; \ 6981.419Sapb echo "${TOOL_GZIP} ${GZIP_FLAGS} -c < $${kerndir}/$${ks} > $${knl_gz}"; \ 6991.419Sapb ${TOOL_GZIP} ${GZIP_FLAGS} -c < $${ks} > $${knl_gz}; \ 7001.197Sthorpej done; \ 7011.256Sdsl done; \ 7021.256Sdsl } 7031.402Smlelstv.endif 7041.402Smlelstv.endfor 7051.232Slukem.endfor # KERNEL_SETS EXTRA_KERNELS # } 7061.232Slukem 7071.456Schristos# install-debugkernels: 7081.456Schristos# Create fake kernel debug files to satisfy the sets requirements 7091.456Schristos# They will be later replaced with the real ones if we are building 7101.456Schristos# kernels. This mess is needed because checkflist runs before the 7111.456Schristos# kernels are built. It should really run before the sets are build. 7121.456Schristosinstall-debugkernels: 7131.456Schristos.if ${MKDEBUG:Uno} == "yes" 7141.457Schristos @for i in $$(${NETBSDSRCDIR}/distrib/sets/makeflist debug | \ 7151.457Schristos ${TOOL_GREP} -E '^./usr/libdata/debug/(nfs)?netbsd-'); do \ 7161.457Schristos echo touch ${DESTDIR}/$$i; \ 7171.457Schristos touch ${DESTDIR}/$$i; \ 7181.457Schristos done 7191.456Schristos. for k in ${ALL_KERNELS} 7201.456Schristosinstall-debugkernels: ${DESTDIR}${DEBUGDIR}/netbsd-${k}.debug 7211.456Schristos 7221.456Schristos${DESTDIR}${DEBUGDIR}/netbsd-${k}.debug: 7231.456Schristos ${_MKTARGET_INSTALL} 7241.456Schristos touch ${.TARGET} 7251.456Schristos. endfor 7261.456Schristos.endif 7271.456Schristos 7281.242Slukem# snap_md_post -- 7291.242Slukem# Machine dependent distribution media operations. 7301.242Slukem# Overridden by etc.$MACHINE/Makefile.inc 7311.242Slukem# 7321.324Sdslsnap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post 7331.242Slukem# (empty -- look in the machine-dependent Makefile.inc) 7341.242Slukem 7351.242Slukem 7361.242Slukemclean: 7371.246Slukem -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} 7381.7Scgd 7391.392SjymSUBDIR= defaults rc.d mtree 7401.362Scube 7411.1Scgd.include <bsd.prog.mk> 7421.362Scube.include <bsd.subdir.mk> 7431.309Stron 7441.309Strontest: 7451.309Stron @echo ${OBSOLETE.files} 746