Portable build framework for OpenNTPD
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.

225 lines
6.1 KiB

  1. #
  2. # Copyright (c) 2014 Brent Cook
  3. # Parts based on Makefile.in from Portable OpenNTPD:
  4. # Copyright (c) 2004-2008 Darren Tucker.
  5. #
  6. # Permission to use, copy, modify, and distribute this software for any
  7. # purpose with or without fee is hereby granted, provided that the above
  8. # copyright notice and this permission notice appear in all copies.
  9. #
  10. # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. AM_CPPFLAGS = -I$(top_srcdir)/include
  18. SUBDIRS = include
  19. ACLOCAL_AMFLAGS = -Im4
  20. EXTRA_DIST = VERSION ntpd.conf
  21. CLEANFILES = parse.c
  22. sbin_PROGRAMS = ntpd
  23. noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la
  24. dist_man_MANS = ntpctl.8 ntpd.8 ntpd.conf.5
  25. ntpd_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
  26. ntpd_CFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
  27. ntpd_CFLAGS += -DLOCALSTATEDIR=\"$(localstatedir)\"
  28. ntpd_LDADD = $(PLATFORM_LDADD) $(PROG_LDADD) libcompat.la libcompatnoopt.la
  29. ntpd_SOURCES = client.c
  30. ntpd_SOURCES += config.c
  31. ntpd_SOURCES += control.c
  32. ntpd_SOURCES += log.c
  33. ntpd_SOURCES += log.h
  34. ntpd_SOURCES += ntp.c
  35. ntpd_SOURCES += ntp.h
  36. ntpd_SOURCES += ntp_dns.c
  37. ntpd_SOURCES += ntp_msg.c
  38. ntpd_SOURCES += ntpd.c
  39. ntpd_SOURCES += ntpd.h
  40. ntpd_SOURCES += parse.y
  41. if HAVE_SENSORS
  42. ntpd_SOURCES += sensors.c
  43. else
  44. ntpd_SOURCES += compat/fake-sensors.c
  45. endif
  46. ntpd_SOURCES += server.c
  47. ntpd_SOURCES += util.c
  48. install-exec-hook:
  49. @ln -f "$(DESTDIR)$(sbindir)/ntpd" "$(DESTDIR)$(sbindir)/ntpctl"
  50. @if [ ! -d "$(DESTDIR)$(sysconfdir)" ]; then \
  51. $(INSTALL) -m 755 -d "$(DESTDIR)$(sysconfdir)"; \
  52. fi
  53. @if [ ! -d "$(DESTDIR)$(localstatedir)/run" ]; then \
  54. $(INSTALL) -m 755 -d "$(DESTDIR)$(localstatedir)/run"; \
  55. fi
  56. @if [ ! -d "$(DESTDIR)$(localstatedir)/db" ]; then \
  57. $(INSTALL) -m 755 -d "$(DESTDIR)$(localstatedir)/db"; \
  58. fi
  59. @if [ ! -f "$(DESTDIR)$(sysconfdir)/ntpd.conf" ]; then \
  60. $(INSTALL) -m 644 "$(srcdir)/ntpd.conf" "$(DESTDIR)$(sysconfdir)/ntpd.conf"; \
  61. else \
  62. echo "$(DESTDIR)$(sysconfdir)/ntpd.conf already exists, install will not overwrite"; \
  63. fi
  64. @if [ ! -d "$(PRIVSEP_PATH)" ]; then \
  65. echo; \
  66. echo " Please created a privilege separation directory for ntpd." ; \
  67. echo " On Linux / BSD systems, this will probably work:"; \
  68. echo " # mkdir -p \"$(PRIVSEP_PATH)\"" ; \
  69. echo " # chown 0 \"$(PRIVSEP_PATH)\"" ; \
  70. echo " # chgrp 0 \"$(PRIVSEP_PATH)\"" ; \
  71. echo " # chmod 0755 "$(PRIVSEP_PATH)\""" ; \
  72. echo " For OS X, see INSTALL for alternate instructions" ; \
  73. fi
  74. @if egrep "^$(PRIVSEP_USER):" /etc/group >/dev/null; then \
  75. : ; \
  76. else \
  77. echo; \
  78. echo " Please create a dedicated group for ntpd." ; \
  79. echo " On Linux / BSD systems, this will probably work:"; \
  80. echo " # groupadd $(PRIVSEP_USER)" ; \
  81. echo " For OS X, see INSTALL for alternate instructions" ; \
  82. fi
  83. @if egrep "^$(PRIVSEP_USER):" /etc/passwd >/dev/null; then \
  84. : ; \
  85. else \
  86. echo; \
  87. echo " Please create a dedicated user for ntpd and ensure it can" ; \
  88. echo " not be used to log in." ; \
  89. echo " On Linux / BSD systems, this will probably work:" ; \
  90. echo " # useradd -g $(PRIVSEP_USER) -s /sbin/nologin -d $(PRIVSEP_PATH) -c 'OpenNTP daemon' $(PRIVSEP_USER)" ; \
  91. echo " For OS X, see INSTALL for alternate instructions" ; \
  92. fi
  93. echo
  94. uninstall-local:
  95. @if cmp -s "$(DESTDIR)$(sysconfdir)/ntpd.conf" "$(srcdir)/ntpd.conf"; then \
  96. rm -f "$(DESTDIR)$(sysconfdir)/ntpd.conf"; \
  97. fi
  98. @rm -f "$(DESTDIR)$(sbindir)/ntpctl"
  99. # compatibility functions that need to be built without optimizations
  100. libcompatnoopt_la_CFLAGS = -O0
  101. libcompatnoopt_la_SOURCES =
  102. if !HAVE_EXPLICIT_BZERO
  103. libcompatnoopt_la_SOURCES += compat/explicit_bzero.c
  104. endif
  105. # other compatibility functions
  106. libcompat_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
  107. libcompat_la_SOURCES =
  108. libcompat_la_LIBADD = $(PLATFORM_LDADD)
  109. if !HAVE_ADJFREQ
  110. if HOST_FREEBSD
  111. libcompat_la_SOURCES += compat/adjfreq_freebsd.c
  112. endif
  113. if HOST_LINUX
  114. libcompat_la_SOURCES += compat/adjfreq_linux.c
  115. endif
  116. if HOST_DARWIN
  117. libcompat_la_SOURCES += compat/adjfreq_osx.c
  118. endif
  119. if HOST_SOLARIS
  120. libcompat_la_SOURCES += compat/adjfreq_solaris.c
  121. endif
  122. endif
  123. if !HAVE_ASPRINTF
  124. libcompat_la_SOURCES += compat/bsd-asprintf.c
  125. endif
  126. if !HAVE_CLOCK_GETRES
  127. libcompat_la_SOURCES += compat/clock_getres.c
  128. endif
  129. if !HAVE_CLOCK_GETTIME
  130. if HOST_DARWIN
  131. libcompat_la_SOURCES += compat/clock_gettime_osx.c
  132. endif
  133. endif
  134. if !HAVE_IMSG
  135. libcompat_la_SOURCES += compat/imsg.c
  136. libcompat_la_SOURCES += compat/imsg-buffer.c
  137. endif
  138. if !HAVE_MD5
  139. libcompat_la_SOURCES += compat/md5.c
  140. endif
  141. if !HAVE_REALLOCARRAY
  142. libcompat_la_SOURCES += compat/reallocarray.c
  143. endif
  144. if !HAVE_SETPROCTITLE
  145. libcompat_la_SOURCES += compat/setproctitle.c
  146. endif
  147. if !HAVE_STRLCAT
  148. libcompat_la_SOURCES += compat/strlcat.c
  149. endif
  150. if !HAVE_STRLCPY
  151. libcompat_la_SOURCES += compat/strlcpy.c
  152. endif
  153. if !HAVE_STRTONUM
  154. libcompat_la_SOURCES += compat/strtonum.c
  155. endif
  156. if !HAVE_SETRESGID
  157. libcompat_la_SOURCES += compat/bsd-setresgid.c
  158. endif
  159. if !HAVE_SETRESUID
  160. libcompat_la_SOURCES += compat/bsd-setresuid.c
  161. endif
  162. if !HAVE_ARC4RANDOM
  163. libcompat_la_SOURCES += compat/arc4random.c
  164. if !HAVE_GETENTROPY
  165. if HOST_FREEBSD
  166. libcompat_la_SOURCES += compat/getentropy_freebsd.c
  167. endif
  168. if HOST_LINUX
  169. libcompat_la_SOURCES += compat/getentropy_linux.c
  170. if !HAVE_SHA512
  171. libcompat_la_SOURCES += compat/sha2.c
  172. endif
  173. endif
  174. if HOST_DARWIN
  175. libcompat_la_SOURCES += compat/getentropy_osx.c
  176. if !HAVE_SHA512
  177. libcompat_la_SOURCES += compat/sha2.c
  178. endif
  179. endif
  180. if HOST_SOLARIS
  181. libcompat_la_SOURCES += compat/getentropy_solaris.c
  182. if !HAVE_SHA512
  183. libcompat_la_SOURCES += compat/sha2.c
  184. endif
  185. endif
  186. endif
  187. endif
  188. if !HAVE_ARC4RANDOM_UNIFORM
  189. libcompat_la_SOURCES += compat/arc4random_uniform.c
  190. endif
  191. noinst_HEADERS = compat/arc4random.h
  192. noinst_HEADERS += compat/arc4random_freebsd.h
  193. noinst_HEADERS += compat/arc4random_linux.h
  194. noinst_HEADERS += compat/arc4random_osx.h
  195. noinst_HEADERS += compat/arc4random_solaris.h
  196. noinst_HEADERS += compat/arc4random_win.h
  197. noinst_HEADERS += compat/chacha_private.h