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.

219 lines
5.8 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 += ntp.c
  34. ntpd_SOURCES += ntp.h
  35. ntpd_SOURCES += ntp_dns.c
  36. ntpd_SOURCES += ntp_msg.c
  37. ntpd_SOURCES += ntpd.c
  38. ntpd_SOURCES += ntpd.h
  39. ntpd_SOURCES += parse.y
  40. if HAVE_SENSORS
  41. ntpd_SOURCES += sensors.c
  42. else
  43. ntpd_SOURCES += compat/fake-sensors.c
  44. endif
  45. ntpd_SOURCES += server.c
  46. ntpd_SOURCES += util.c
  47. install-exec-hook:
  48. @ln -f "$(DESTDIR)$(sbindir)/ntpd" "$(DESTDIR)$(sbindir)/ntpctl"
  49. @if [ ! -d "$(DESTDIR)$(sysconfdir)" ]; then \
  50. $(INSTALL) -m 755 -d "$(DESTDIR)$(sysconfdir)"; \
  51. fi
  52. @if [ ! -d "$(DESTDIR)$(localstatedir)/run" ]; then \
  53. $(INSTALL) -m 755 -d "$(DESTDIR)$(localstatedir)/run"; \
  54. fi
  55. @if [ ! -d "$(DESTDIR)$(localstatedir)/db" ]; then \
  56. $(INSTALL) -m 755 -d "$(DESTDIR)$(localstatedir)/db"; \
  57. fi
  58. @if [ ! -f "$(DESTDIR)$(sysconfdir)/ntpd.conf" ]; then \
  59. $(INSTALL) -m 644 "$(srcdir)/ntpd.conf" "$(DESTDIR)$(sysconfdir)/ntpd.conf"; \
  60. else \
  61. echo "$(DESTDIR)$(sysconfdir)/ntpd.conf already exists, install will not overwrite"; \
  62. fi
  63. @if [ ! -d "$(PRIVSEP_PATH)" ]; then \
  64. echo; \
  65. echo " Please created a privilege separation directory for ntpd." ; \
  66. echo " # mkdir -p \"$(PRIVSEP_PATH)\"" ; \
  67. echo " # chown 0 \"$(PRIVSEP_PATH)\"" ; \
  68. echo " # chgrp 0 \"$(PRIVSEP_PATH)\"" ; \
  69. echo " # chmod 0755 "$(PRIVSEP_PATH)\""" ; \
  70. fi
  71. @if egrep "^$(PRIVSEP_USER):" /etc/group >/dev/null; then \
  72. : ; \
  73. else \
  74. echo; \
  75. echo " Please create a dedicated group for ntpd." ; \
  76. echo " This is system-dependant, possibly:" ; \
  77. echo " # groupadd $(PRIVSEP_USER)" ; \
  78. fi
  79. @if egrep "^$(PRIVSEP_USER):" /etc/passwd >/dev/null; then \
  80. : ; \
  81. else \
  82. echo; \
  83. echo " Please create a dedicated user for ntpd and ensure it can" ; \
  84. echo " not be used to log in. This is system-dependant, possibly:" ; \
  85. echo " # useradd -g $(PRIVSEP_USER) -s /sbin/nologin -d $(PRIVSEP_PATH) -c 'OpenNTP daemon' $(PRIVSEP_USER)" ; \
  86. fi
  87. echo
  88. uninstall-local:
  89. @if cmp -s "$(DESTDIR)$(sysconfdir)/ntpd.conf" "$(srcdir)/ntpd.conf"; then \
  90. rm -f "$(DESTDIR)$(sysconfdir)/ntpd.conf"; \
  91. fi
  92. @rm -f "$(DESTDIR)$(sbindir)/ntpctl"
  93. # compatibility functions that need to be built without optimizations
  94. libcompatnoopt_la_CFLAGS = -O0
  95. libcompatnoopt_la_SOURCES =
  96. if !HAVE_EXPLICIT_BZERO
  97. libcompatnoopt_la_SOURCES += compat/explicit_bzero.c
  98. endif
  99. # other compatibility functions
  100. libcompat_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS)
  101. libcompat_la_SOURCES =
  102. libcompat_la_LIBADD = $(PLATFORM_LDADD)
  103. if !HAVE_ADJFREQ
  104. if HOST_FREEBSD
  105. libcompat_la_SOURCES += compat/adjfreq_freebsd.c
  106. endif
  107. if HOST_LINUX
  108. libcompat_la_SOURCES += compat/adjfreq_linux.c
  109. endif
  110. if HOST_DARWIN
  111. libcompat_la_SOURCES += compat/adjfreq_osx.c
  112. endif
  113. if HOST_SOLARIS
  114. libcompat_la_SOURCES += compat/adjfreq_solaris.c
  115. endif
  116. endif
  117. if !HAVE_ASPRINTF
  118. libcompat_la_SOURCES += compat/bsd-asprintf.c
  119. endif
  120. if !HAVE_CLOCK_GETRES
  121. libcompat_la_SOURCES += compat/clock_getres.c
  122. endif
  123. if !HAVE_CLOCK_GETTIME
  124. if HOST_DARWIN
  125. libcompat_la_SOURCES += compat/clock_gettime_osx.c
  126. endif
  127. endif
  128. if !HAVE_IMSG
  129. libcompat_la_SOURCES += compat/imsg.c
  130. libcompat_la_SOURCES += compat/imsg-buffer.c
  131. endif
  132. if !HAVE_MD5
  133. libcompat_la_SOURCES += compat/md5.c
  134. endif
  135. if !HAVE_REALLOCARRAY
  136. libcompat_la_SOURCES += compat/reallocarray.c
  137. endif
  138. if !HAVE_SETPROCTITLE
  139. libcompat_la_SOURCES += compat/setproctitle.c
  140. endif
  141. if !HAVE_STRLCAT
  142. libcompat_la_SOURCES += compat/strlcat.c
  143. endif
  144. if !HAVE_STRLCPY
  145. libcompat_la_SOURCES += compat/strlcpy.c
  146. endif
  147. if !HAVE_STRTONUM
  148. libcompat_la_SOURCES += compat/strtonum.c
  149. endif
  150. if !HAVE_SETRESGID
  151. libcompat_la_SOURCES += compat/bsd-setresgid.c
  152. endif
  153. if !HAVE_SETRESUID
  154. libcompat_la_SOURCES += compat/bsd-setresuid.c
  155. endif
  156. if !HAVE_ARC4RANDOM
  157. libcompat_la_SOURCES += compat/arc4random.c
  158. if !HAVE_GETENTROPY
  159. if HOST_FREEBSD
  160. libcompat_la_SOURCES += compat/getentropy_freebsd.c
  161. endif
  162. if HOST_LINUX
  163. libcompat_la_SOURCES += compat/getentropy_linux.c
  164. if !HAVE_SHA512
  165. libcompat_la_SOURCES += compat/sha2.c
  166. endif
  167. endif
  168. if HOST_DARWIN
  169. libcompat_la_SOURCES += compat/getentropy_osx.c
  170. if !HAVE_SHA512
  171. libcompat_la_SOURCES += compat/sha2.c
  172. endif
  173. endif
  174. if HOST_SOLARIS
  175. libcompat_la_SOURCES += compat/getentropy_solaris.c
  176. if !HAVE_SHA512
  177. libcompat_la_SOURCES += compat/sha2.c
  178. endif
  179. endif
  180. endif
  181. endif
  182. if !HAVE_ARC4RANDOM_UNIFORM
  183. libcompat_la_SOURCES += compat/arc4random_uniform.c
  184. endif
  185. noinst_HEADERS = compat/arc4random.h
  186. noinst_HEADERS += compat/arc4random_freebsd.h
  187. noinst_HEADERS += compat/arc4random_linux.h
  188. noinst_HEADERS += compat/arc4random_osx.h
  189. noinst_HEADERS += compat/arc4random_solaris.h
  190. noinst_HEADERS += compat/arc4random_win.h
  191. noinst_HEADERS += compat/chacha_private.h