Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

310 lines
11 KiB

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