Makefile revision 1.465
1# $OpenBSD: Makefile,v 1.465 2018/07/24 18:15:30 jasper Exp $ 2 3.include <bsd.own.mk> 4 5TZDIR= /usr/share/zoneinfo 6LOCALTIME= Canada/Mountain 7MTREEDIR= /etc/mtree 8 9NOOBJ= 10 11KERNELS = GENERIC bsd 12 13.if exists(etc.${MACHINE}/Makefile.inc) 14.include "etc.${MACHINE}/Makefile.inc" 15.endif 16 17.for CONF K in ${KERNELS} 18. if !target($K) 19$K: 20 cd ../sys/arch/${MACHINE}/compile/${CONF} && \ 21 { [[ -n "${KEEPKERNELS}" ]] || ${MAKE} cleandir; } && \ 22 ${MAKE} config && ${MAKE} clean && exec ${MAKE}; 23. endif 24ALL_KERNELS += $K 25.endfor 26 27kernels: ${ALL_KERNELS} 28.for CONF K in ${KERNELS} 29 cp ../sys/arch/${MACHINE}/compile/${CONF}/obj/bsd ${RELEASEDIR}/$K 30 chmod a+r ${RELEASEDIR}/$K 31.endfor 32 cd ${.CURDIR}/../sys/arch/${MACHINE}/compile/ && \ 33 tar -chzf ${DESTDIR}/usr/share/relink/kernel.tgz -s ',/obj/,/,' \ 34 GENERIC*/obj/*.o GENERIC*/obj/Makefile \ 35 GENERIC*/obj/ld.script GENERIC*/obj/makegap.sh 36 chown root:wheel ${DESTDIR}/usr/share/relink/kernel.tgz 37 chmod 644 ${DESTDIR}/usr/share/relink/kernel.tgz 38 39# -rw-r--r-- 40BINOWN= root 41BINGRP= wheel 42MUTABLE=acme-client.conf changelist daily etc.${MACHINE}/disktab \ 43 etc.${MACHINE}/login.conf ftpusers gettytab group ksh.kshrc locate.rc \ 44 mailer.conf moduli monthly netstart newsyslog.conf ntpd.conf \ 45 pf.os protocols rc rc.conf rpc services shells syslog.conf weekly 46 47# -rw-r--r-- 48EXAMPLES=chio.conf dhclient.conf dhcpd.conf exports \ 49 httpd.conf ifstated.conf inetd.conf man.conf mixerctl.conf \ 50 mrouted.conf ntpd.conf printcap rad.conf rbootd.conf \ 51 remote sensorsd.conf wsconsctl.conf 52 53# -rw------- 54EXAMPLES_600=bgpd.conf doas.conf dvmrpd.conf eigrpd.conf hostapd.conf \ 55 iked.conf ipsec.conf ldapd.conf ldpd.conf ospf6d.conf ospfd.conf \ 56 pf.conf radiusd.conf rc.local rc.securelevel rc.shutdown relayd.conf \ 57 ripd.conf sasyncd.conf snmpd.conf vm.conf ypldap.conf 58 59# -r-xr-xr-x 60RCDAEMONS=amd apmd bgpd bootparamd cron dhcpd dhcrelay dhcrelay6 dvmrpd \ 61 eigrpd ftpd ftpproxy ftpproxy6 hostapd hotplugd httpd identd ifstated \ 62 iked inetd isakmpd iscsid ldapd ldattach ldomd ldpd lockd \ 63 lpd mopd mountd mrouted nfsd npppd nsd ntpd ospf6d ospfd \ 64 pflogd portmap rad radiusd rarpd rbootd rebound relayd ripd route6d \ 65 sasyncd sensorsd slowcgi slaacd smtpd sndiod snmpd spamd \ 66 spamlogd sshd statd switchd syslogd tftpd tftpproxy unbound \ 67 vmd watchdogd wsmoused xenodm ypbind ypldap ypserv 68 69MISETS= base${OSrev}.tgz comp${OSrev}.tgz man${OSrev}.tgz game${OSrev}.tgz 70 71all clean cleandir depend etc install: 72 73install-mtree: 74 ${INSTALL} -c -o root -g wheel -m 600 mtree/special \ 75 ${DESTDIR}${MTREEDIR} 76 ${INSTALL} -c -o root -g wheel -m 444 mtree/4.4BSD.dist \ 77 ${DESTDIR}${MTREEDIR} 78 ${INSTALL} -c -o root -g wheel -m 444 mtree/BSD.x11.dist \ 79 ${DESTDIR}${MTREEDIR} 80 81.ifndef DESTDIR 82distribution-etc-root-var distribution distrib-dirs release: 83 @echo setenv DESTDIR before doing that! 84 @false 85.else 86distribution-etc-root-var: distrib-dirs 87 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${MUTABLE} ${DESTDIR}/etc 88 sh ttys.pty | cat etc.${MACHINE}/ttys - > ${DESTDIR}/etc/ttys && \ 89 chown ${BINOWN}:${BINGRP} ${DESTDIR}/etc/ttys && \ 90 chmod 644 ${DESTDIR}/etc/ttys 91 cat examples/sysctl.conf etc.${MACHINE}/sysctl.conf > \ 92 ${DESTDIR}/etc/examples/sysctl.conf && \ 93 chown ${BINOWN}:${BINGRP} ${DESTDIR}/etc/examples/sysctl.conf && \ 94 chmod 644 ${DESTDIR}/etc/examples/sysctl.conf 95 cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \ 96 chown ${BINOWN}:${BINGRP} ${DESTDIR}/etc/fbtab && \ 97 chmod 644 ${DESTDIR}/etc/fbtab 98 ${INSTALL} -c -o ${BINOWN} -g operator -m 664 motd ${DESTDIR}/etc 99 ${INSTALL} -c -o root -g crontab -m 600 crontab ${DESTDIR}/var/cron/tabs/root 100 ${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc 101 pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd 102 chown root:wheel ${DESTDIR}/etc/passwd ${DESTDIR}/etc/pwd.db 103 chown root:_shadow ${DESTDIR}/etc/spwd.db 104 ${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc 105 ${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/var/nsd/etc 106 ${INSTALL} -c -o root -g wheel -m 644 unbound.conf ${DESTDIR}/var/unbound/etc 107 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \ 108 etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev 109 cd root; \ 110 ${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \ 111 ${DESTDIR}/root/.cshrc; \ 112 ${INSTALL} -c -o root -g wheel -m 644 dot.login \ 113 ${DESTDIR}/root/.login; \ 114 ${INSTALL} -c -o root -g wheel -m 644 dot.profile \ 115 ${DESTDIR}/root/.profile; \ 116 ${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \ 117 ${DESTDIR}/root/.Xdefaults; \ 118 ${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \ 119 ${DESTDIR}/root/.cvsrc; \ 120 ${INSTALL} -c -o root -g wheel -m 600 /dev/null \ 121 ${DESTDIR}/root/.ssh/authorized_keys; \ 122 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \ 123 ${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \ 124 ${DESTDIR}/.cshrc; \ 125 ${INSTALL} -c -o root -g wheel -m 644 dot.profile \ 126 ${DESTDIR}/.profile 127 cd skel; \ 128 ${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \ 129 ${DESTDIR}/etc/skel/.cshrc; \ 130 ${INSTALL} -c -o root -g wheel -m 644 dot.login \ 131 ${DESTDIR}/etc/skel/.login; \ 132 ${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \ 133 ${DESTDIR}/etc/skel/.mailrc; \ 134 ${INSTALL} -c -o root -g wheel -m 644 dot.profile \ 135 ${DESTDIR}/etc/skel/.profile; \ 136 ${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \ 137 ${DESTDIR}/etc/skel/.Xdefaults; \ 138 ${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \ 139 ${DESTDIR}/etc/skel/.cvsrc; \ 140 ${INSTALL} -c -o root -g wheel -m 600 /dev/null \ 141 ${DESTDIR}/etc/skel/.ssh/authorized_keys 142 cd amd; \ 143 ${INSTALL} -c -o root -g wheel -m 644 master.sample \ 144 ${DESTDIR}/etc/amd 145 cd ppp; \ 146 ${INSTALL} -c -o root -g wheel -m 600 chap-secrets \ 147 ${DESTDIR}/etc/ppp; \ 148 ${INSTALL} -c -o root -g wheel -m 600 options \ 149 ${DESTDIR}/etc/ppp; \ 150 ${INSTALL} -c -o root -g wheel -m 600 options.sample \ 151 ${DESTDIR}/etc/ppp; \ 152 ${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \ 153 ${DESTDIR}/etc/ppp; \ 154 ${INSTALL} -c -o root -g wheel -m 600 pap-secrets \ 155 ${DESTDIR}/etc/ppp 156 cd examples; \ 157 ${INSTALL} -c -o root -g wheel -m 644 ${EXAMPLES} \ 158 ${DESTDIR}/etc/examples; \ 159 ${INSTALL} -c -o root -g wheel -m 600 ${EXAMPLES_600} \ 160 ${DESTDIR}/etc/examples; \ 161 chgrp operator ${DESTDIR}/etc/examples/chio.conf 162 cd signify; \ 163 ${INSTALL} -c -o root -g wheel -m 644 *.pub \ 164 ${DESTDIR}/etc/signify 165 ln -fs ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime 166 chown -h root:wheel ${DESTDIR}/etc/localtime 167 ln -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt 168 chown -h root:wheel ${DESTDIR}/etc/rmt 169 ${INSTALL} -c -o root -g wheel -m 644 minfree \ 170 ${DESTDIR}/var/crash 171 ${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \ 172 ${DESTDIR}/etc/dumpdates 173 ${INSTALL} -c -o root -g crontab -m 660 /dev/null \ 174 ${DESTDIR}/var/cron/at.deny 175 ${INSTALL} -c -o root -g crontab -m 660 /dev/null \ 176 ${DESTDIR}/var/cron/cron.deny 177 ${INSTALL} -c -o root -g wheel -m 600 /dev/null \ 178 ${DESTDIR}/var/cron/log 179 ${INSTALL} -c -o root -g wheel -m 444 /dev/null \ 180 ${DESTDIR}/var/db/locate.database 181 ${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \ 182 ${DESTDIR}/var/log/authlog 183 ${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \ 184 ${DESTDIR}/var/log/daemon 185 ${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \ 186 ${DESTDIR}/var/log/failedlogin 187 ${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \ 188 ${DESTDIR}/var/log/ftpd 189 ${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \ 190 ${DESTDIR}/var/log/lastlog 191 ${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \ 192 ${DESTDIR}/var/log/lpd-errs 193 ${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \ 194 ${DESTDIR}/var/log/maillog 195 ${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \ 196 ${DESTDIR}/var/log/messages 197 ${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \ 198 ${DESTDIR}/var/log/secure 199 ${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \ 200 ${DESTDIR}/var/log/wtmp 201 ${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \ 202 ${DESTDIR}/var/log/xferlog 203 cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution 204 cd ../usr.bin/ssh && exec ${MAKE} distribution 205 cd ../lib/libcrypto && exec ${MAKE} distribution 206 cd ../usr.bin/bgplg && exec ${MAKE} distribution 207 cd ../usr.bin/mail && exec ${MAKE} distribution 208 cd ../usr.sbin/ikectl && exec ${MAKE} distribution 209 cd ../usr.sbin/ldapd && exec ${MAKE} distribution 210 cd ../usr.sbin/npppd && exec ${MAKE} distribution 211 cd mail && exec ${MAKE} distribution 212 ${INSTALL} -c -o root -g wheel -m 600 root/root.mail \ 213 ${DESTDIR}/var/mail/root 214 cd rc.d; \ 215 ${INSTALL} -c -o root -g wheel -m 644 rc.subr \ 216 ${DESTDIR}/etc/rc.d && \ 217 ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \ 218 ${DESTDIR}/etc/rc.d 219 cd ${DESTDIR}/var; ln -fs ../tmp 220 chown -h root:wheel ${DESTDIR}/var/tmp 221 touch ${DESTDIR}/var/sysmerge/etcsum 222 chown root:wheel ${DESTDIR}/var/sysmerge/etcsum 223 chmod 644 ${DESTDIR}/var/sysmerge/etcsum 224 cd ${DESTDIR}/ && \ 225 sort ${.CURDIR}/../distrib/sets/lists/etc/{mi,md.${MACHINE}} | \ 226 xargs sha256 -h ${DESTDIR}/var/sysmerge/etcsum || true 227 cd ${DESTDIR}/ && \ 228 sort ${.CURDIR}/../distrib/sets/lists/etc/{mi,md.${MACHINE}} | \ 229 pax -w -d | gzip -9 > ${DESTDIR}/var/sysmerge/etc.tgz 230 chown root:wheel ${DESTDIR}/var/sysmerge/etc.tgz 231 chmod 644 ${DESTDIR}/var/sysmerge/etc.tgz 232 233distribution: 234 exec ${MAKE} distribution-etc-root-var 235 cd .. && exec ${MAKE} install 236 237distrib-dirs: 238 if [ ! -d ${DESTDIR}/. ]; then \ 239 ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \ 240 fi 241 mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U 242 cd ${DESTDIR}/; ln -fhs usr/src/sys sys 243 chown -h root:wheel ${DESTDIR}/sys 244 245.ifndef RELEASEDIR 246release: 247 @echo setenv RELEASEDIR before building a release. 248 @false 249.else 250release: 251 umask ${WOBJUMASK}; exec ${MAKE} do-release 252 253do-release: 254 @if [[ `id -u` -ne 0 ]]; then \ 255 echo $@ must be called by root >&2; \ 256 false; \ 257 fi 258 @destmp=`df -P ${DESTDIR} | awk 'END { print $$6 }'`; \ 259 if ! mount | grep -q " $${destmp} .*noperm"; then \ 260 echo ${DESTDIR} must be on a noperm filesystem >&2; \ 261 false; \ 262 fi; \ 263 if [[ `stat -f '%Su %Lp' $${destmp}` != '${BUILDUSER} 700' ]]; then \ 264 echo $${destmp} must have owner BUILDUSER and mode 700 >&2; \ 265 false; \ 266 fi 267 ${MAKE} release-sets 268 ${MAKE} distrib 269 su ${BUILDUSER} -c 'exec ${MAKE} sha' 270 -cd ${RELEASEDIR} && chmod g-w,a+rX * 271 272release-sets: 273 su ${BUILDUSER} -c 'exec ${MAKE} distribution' 274 su ${BUILDUSER} -c 'exec ${MAKE} kernels' 275 cp -p ${DESTDIR}/usr/share/relink/kernel.tgz /usr/share/relink/kernel.tgz 276 ${MAKE} bootblocks 277 cd ${RELEASEDIR} && rm -f SHA256 278 cd ../distrib/sets && exec su ${BUILDUSER} -c 'exec sh maketars ${OSrev}' 279 280sha: 281 -cd ${RELEASEDIR}; \ 282 date -u "+Build date: %s - %+" > BUILDINFO; \ 283 cksum -a sha256 BUILDINFO INSTALL.`arch -ks` \ 284 ${ALL_KERNELS} ${MDEXT} ${MISETS} | sort > SHA256 285 286.endif 287 288.endif # DESTDIR check 289 290distrib: 291 umask 022; cd ../distrib && \ 292 ${MAKE} && exec ${MAKE} install 293 294.PHONY: distribution-etc-root-var distribution distrib-dirs \ 295 release allarchs kernels release-sets m4 install-mtree \ 296 bootblocks do-release ${ALL_KERNELS} 297 298SUBDIR+= etc.alpha etc.amd64 etc.arm64 etc.armv7 299SUBDIR+= etc.hppa etc.i386 etc.landisk etc.loongson etc.luna88k 300SUBDIR+= etc.macppc etc.octeon 301SUBDIR+= etc.sgi etc.socppc etc.sparc64 302 303.include <bsd.subdir.mk> 304.include <bsd.prog.mk> 305