1 ## Makefile.am for JMK's SNTP, by Harlan Stenn
3 ACLOCAL_AMFLAGS = -I m4 -I libevent/m4 -I libopts/m4
7 AM_CFLAGS = $(CFLAGS_NTP)
8 AM_CFLAGS += $(NTP_HARD_CFLAGS)
10 AM_CPPFLAGS = $(SNTP_INCS)
11 AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
12 AM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
13 AM_CPPFLAGS += $(CPPFLAGS_NTP)
14 AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
16 AM_LDFLAGS = $(LDFLAGS_NTP)
17 AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
21 LDADD += $(LIBOPTS_LDADD)
22 LDADD += $(LDADD_LIBEVENT)
23 LDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
24 LDADD += $(PTHREAD_LIBS)
27 run_ag = cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D \
28 autogen -L include -L ag-tpl --writable
30 $(srcdir)/include/debug-opt.def \
31 $(srcdir)/include/autogen-version.def \
32 $(srcdir)/include/copyright.def \
33 $(srcdir)/include/homerc.def \
34 $(srcdir)/include/ntp.lic \
35 $(srcdir)/include/version.def \
40 bin_PROGRAMS = @SNTP_DB@
41 libexec_PROGRAMS = @SNTP_DL@
42 sbin_PROGRAMS = @SNTP_DS@
44 SUBDIRS = include scripts unity
50 DIST_FAIL += "--enable-local-libevent"
58 noinst_LIBRARIES = libsntp.a
101 @NTP_FORCE_LIBEVENT_DIST@ \
113 $(srcdir)/m4/version.m4 \
117 $(srcdir)/COPYRIGHT \
119 $(srcdir)/sntp-opts.c \
120 $(srcdir)/sntp-opts.h \
122 $(srcdir)/include/version.def \
123 $(srcdir)/m4/version.m4 \
124 $(srcdir)/include/version.texi \
129 check-COPYRIGHT-submake \
134 man_MANS= sntp.$(SNTP_MS)
136 ## HMS: Real Soon Now...
137 ##info_TEXINFOS= sntp.texi
138 ##sntp_TEXINFOS= invoke-sntp.texi
141 $(srcdir)/sntp.html \
145 $(srcdir)/invoke-sntp.menu \
146 $(srcdir)/invoke-sntp.texi \
147 $(srcdir)/sntp.man.in \
148 $(srcdir)/sntp.mdoc.in \
151 install-data-local: install-html
154 @: do-nothing action to prevent default SCCS get
155 @: FRC "force" depends on nothing and is not a file, so is
156 @: always out-of-date causing targets which depend on it to
157 @: similarly always be outdated causing their rules to fire
158 @: each time they or a dependent is built.
160 $(PROGRAMS): version.o
162 ## We probably need something about libevent, too
163 ## That is probably not possible since LDADD_LIBEVENT may be
164 ## non-file "-levent_core".
166 version.c: $(sntp_OBJECTS) ../libntp/libntp.a Makefile $(srcdir)/scm-rev
167 env CSET=`cat $(srcdir)/scm-rev` $(top_builddir)/../scripts/build/mkver sntp
170 env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
172 check-autogen-version.def: FRC
174 && test -r ../include/autogen-version.def \
175 && ( if cmp -s ../include/autogen-version.def autogen-version.def; \
177 else cp ../include/autogen-version.def autogen-version.def; \
178 echo "Installing new sntp/autogen-version.def file"; \
181 $(srcdir)/autogen-version.def:
182 $(MAKE) $(AM_MAKEFLAGS) check-autogen-version.def
184 built-sources-only: $(BUILT_SOURCES)
185 @: do-nothing action to avoid default SCCS get
187 ## HMS: The next bit is still suboptimal. We'll get an error if this is
188 ## a bk repo and srcdir or scm-rev is unwritable.
190 check-scm-rev: $(srcdir)/scm-rev
194 -bk root $(srcdir) >/dev/null 2>&1 && \
196 x=`bk -R prs -hr+ -nd:I: ChangeSet` && \
197 y=`cat sntp/scm-rev 2>/dev/null` || true && \
198 case "$$x" in ''|$$y) ;; *) echo $$x > sntp/scm-rev ;; esac
200 $(srcdir)/m4/version.m4: $(srcdir)/../packageinfo.sh
201 TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
202 ../scripts/build/genver m4/version.m4
204 $(srcdir)/include/version.def: $(srcdir)/../packageinfo.sh
205 TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
206 ../scripts/build/genver include/version.def
208 $(srcdir)/include/version.texi: $(srcdir)/../packageinfo.sh
209 TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
210 ../scripts/build/genver include/version.texi
212 $(srcdir)/../COPYRIGHT:
213 cd .. && $(MAKE) $(AM_MAKEFLAGS) COPYRIGHT-please
215 check-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT
216 @cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT \
217 || { cp $(srcdir)/../COPYRIGHT $(srcdir) \
218 && echo 'updated sntp/COPYRIGHT installed' ;}
219 @echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@
222 [ ! -r $(srcdir)/../COPYRIGHT ] \
223 || [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ] \
224 || $(MAKE) $(AM_MAKEFLAGS) check-COPYRIGHT-submake
226 $(srcdir)/COPYRIGHT: check-COPYRIGHT
227 @: do-nothing action to prevent any default
229 $(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
230 @: do-nothing action to avoid default SCCS get, .h built with .c
232 $(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(std_def_list)
233 $(run_ag) sntp-opts.def
237 $(srcdir)/sntp.1sntpman: $(srcdir)/sntp-opts.def $(std_def_list)
238 $(run_ag) -DMAN_SECTION=1sntpman -Tagman-cmd.tpl sntp-opts.def
240 $(srcdir)/sntp.man.in: $(srcdir)/sntp.1sntpman $(srcdir)/scripts/mansec2subst.sed
241 sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpman > $(srcdir)/sntp.man.in+
242 mv $(srcdir)/sntp.man.in+ $(srcdir)/sntp.man.in
246 $(srcdir)/sntp.1sntpmdoc: $(srcdir)/sntp-opts.def $(std_def_list)
247 $(run_ag) -DMAN_SECTION=1sntpmdoc -Tagmdoc-cmd.tpl sntp-opts.def
249 $(srcdir)/sntp.mdoc.in: $(srcdir)/sntp.1sntpmdoc $(srcdir)/scripts/mansec2subst.sed
250 sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpmdoc > $(srcdir)/sntp.mdoc.in+
251 mv $(srcdir)/sntp.mdoc.in+ $(srcdir)/sntp.mdoc.in
255 sntp.$(SNTP_MS): $(srcdir)/sntp.$(MANTAGFMT).in $(top_builddir)/config.status
256 $(top_builddir)/config.status --file=sntp.$(SNTP_MS)+:$(srcdir)/sntp.$(MANTAGFMT).in
257 mv sntp.$(SNTP_MS)+ sntp.$(SNTP_MS)
261 $(srcdir)/invoke-sntp.menu: $(srcdir)/invoke-sntp.texi
262 @: do-nothing action to avoid default SCCS get, .menu built with .texi
264 $(srcdir)/invoke-sntp.texi: $(srcdir)/sntp-opts.def $(std_def_list)
265 $(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section sntp-opts.def
266 $(top_srcdir)/../scripts/build/check--help $@
268 $(srcdir)/sntp.html: $(srcdir)/invoke-sntp.menu $(srcdir)/invoke-sntp.texi $(srcdir)/sntp.texi $(srcdir)/include/version.texi
269 cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
271 libtool: $(LIBTOOL_DEPS)
272 ./config.status --recheck
274 # HMS: libevent/ is a target if it's in EXTRA_DIST via NTP_FORCE_LIBEVENT_DIST.
275 # Note that libevent/ is already in DIST_SUBDIRS (implicit in Makefile.am
276 # but explicit in Makefile.in). This check doesn't help with distclean.
277 libevent: distdir-pre-check
279 # HMS: Stops the build for gmake or pmake
281 case "$(DIST_FAIL)" in \
283 *) $(error re-run configure adding $(DIST_FAIL) if you want to make a distribution.); \
284 echo "re-run configure adding $(DIST_FAIL) if you want to make a distribution."; \
288 include $(top_srcdir)/bincheck.mf
289 include $(top_srcdir)/check-libntp.mf
290 include $(top_srcdir)/check-libopts.mf
291 include $(top_srcdir)/depsver.mf
292 include $(top_srcdir)/includes.mf