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)
9 AM_CPPFLAGS = $(SNTP_INCS)
10 AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
11 AM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
12 AM_CPPFLAGS += $(CPPFLAGS_NTP)
14 AM_LDFLAGS = $(LDFLAGS_NTP)
18 LDADD += $(LIBOPTS_LDADD)
19 LDADD += $(LDADD_LIBEVENT)
20 LDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
21 LDADD += $(PTHREAD_LIBS)
24 run_ag = cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D \
25 autogen -L include -L ag-tpl --writable
27 $(srcdir)/include/debug-opt.def \
28 $(srcdir)/include/autogen-version.def \
29 $(srcdir)/include/copyright.def \
30 $(srcdir)/include/homerc.def \
31 $(srcdir)/include/ntp.lic \
32 $(srcdir)/include/version.def \
37 bin_PROGRAMS = @SNTP_DB@
38 libexec_PROGRAMS = @SNTP_DL@
39 sbin_PROGRAMS = @SNTP_DS@
42 ## DIST_SUBDIRS is typically automatically derived by automake including
43 ## all possible SUBDIRS values, as even items which are not built are
44 ## typically distributed.
46 ## To allow us to avoid configuring the libevent tearoff entirely when
47 ## it is not needed, we define DIST_SUBDIRS manually excluding libevent
48 ## when not building it, and in that case arrange for its distribution
49 ## with EXTRA_DIST copying the entire directory and libevent-dist-hook
50 ## cleaning unwanted VCS remnants.
52 ## When we are building libevent, it is distributed conventionally, by
53 ## recursive make dist in sntp including libevent.
56 SUBDIRS = include scripts unity
57 DIST_SUBDIRS = include scripts unity
61 DIST_SUBDIRS += libevent
69 noinst_LIBRARIES = libsntp.a
73 DIST_SUBDIRS += libopts tests
109 $(srcdir)/COPYRIGHT \
114 @NTP_FORCE_LIBEVENT_DIST@ \
126 $(srcdir)/m4/version.m4 \
130 $(srcdir)/COPYRIGHT \
132 $(srcdir)/sntp-opts.c \
133 $(srcdir)/sntp-opts.h \
135 $(srcdir)/include/version.def \
136 $(srcdir)/m4/version.m4 \
137 $(srcdir)/include/version.texi \
142 check-COPYRIGHT-submake \
147 man_MANS= sntp.$(SNTP_MS)
149 ## HMS: Real Soon Now...
150 ##info_TEXINFOS= sntp.texi
151 ##sntp_TEXINFOS= invoke-sntp.texi
154 $(srcdir)/sntp.html \
158 $(srcdir)/invoke-sntp.menu \
159 $(srcdir)/invoke-sntp.texi \
160 $(srcdir)/sntp.man.in \
161 $(srcdir)/sntp.mdoc.in \
164 install-data-local: install-html
167 @: do-nothing action to prevent default SCCS get
168 @: FRC "force" depends on nothing and is not a file, so is
169 @: always out-of-date causing targets which depend on it to
170 @: similarly always be outdated causing their rules to fire
171 @: each time they or a dependent is built.
173 $(PROGRAMS): version.o
175 ## We probably need something about libevent, too
176 ## That is probably not possible since LDADD_LIBEVENT may be
177 ## non-file "-levent_core".
179 version.c: $(sntp_OBJECTS) ../libntp/libntp.a Makefile $(srcdir)/scm-rev
180 env CSET=`cat $(srcdir)/scm-rev` $(top_builddir)/../scripts/build/mkver sntp
183 env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
185 check-autogen-version.def: FRC
187 && test -r ../include/autogen-version.def \
188 && ( if cmp -s ../include/autogen-version.def autogen-version.def; \
190 else cp ../include/autogen-version.def autogen-version.def; \
191 echo "Installing new sntp/autogen-version.def file"; \
194 $(srcdir)/autogen-version.def:
195 $(MAKE) $(AM_MAKEFLAGS) check-autogen-version.def
197 built-sources-only: $(BUILT_SOURCES)
198 @: do-nothing action to avoid default SCCS get
200 ## HMS: The next bit is still suboptimal. We'll get an error if this is
201 ## a bk repo and srcdir or scm-rev is unwritable.
203 check-scm-rev: $(srcdir)/scm-rev
207 -test -r $(srcdir)/../SCCS/s.ChangeSet && \
208 (bk version) >/dev/null 2>&1 && \
210 x=`bk -R prs -hr+ -nd:I: ChangeSet` && \
211 y=`cat sntp/scm-rev 2>/dev/null` || true && \
212 case "$$x" in ''|$$y) ;; *) echo $$x > sntp/scm-rev ;; esac
214 $(srcdir)/m4/version.m4: $(srcdir)/../packageinfo.sh
215 TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
216 ../scripts/build/genver m4/version.m4
218 $(srcdir)/include/version.def: $(srcdir)/../packageinfo.sh
219 TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
220 ../scripts/build/genver include/version.def
222 $(srcdir)/include/version.texi: $(srcdir)/../packageinfo.sh
223 TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
224 ../scripts/build/genver include/version.texi
226 $(srcdir)/../COPYRIGHT:
227 cd .. && $(MAKE) $(AM_MAKEFLAGS) COPYRIGHT-please
229 check-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT
230 @cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT \
231 || { cp $(srcdir)/../COPYRIGHT $(srcdir) \
232 && echo 'updated sntp/COPYRIGHT installed' ;}
233 @echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@
236 [ ! -r $(srcdir)/../COPYRIGHT ] \
237 || [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ] \
238 || $(MAKE) $(AM_MAKEFLAGS) check-COPYRIGHT-submake
240 $(srcdir)/COPYRIGHT: check-COPYRIGHT
241 @: do-nothing action to prevent any default
243 $(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
244 @: do-nothing action to avoid default SCCS get, .h built with .c
246 $(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(std_def_list)
247 $(run_ag) sntp-opts.def
251 $(srcdir)/sntp.1sntpman: $(srcdir)/sntp-opts.def $(std_def_list)
252 $(run_ag) -DMAN_SECTION=1sntpman -Tagman-cmd.tpl sntp-opts.def
254 $(srcdir)/sntp.man.in: $(srcdir)/sntp.1sntpman $(srcdir)/scripts/mansec2subst.sed
255 sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpman > $(srcdir)/sntp.man.in+
256 mv $(srcdir)/sntp.man.in+ $(srcdir)/sntp.man.in
260 $(srcdir)/sntp.1sntpmdoc: $(srcdir)/sntp-opts.def $(std_def_list)
261 $(run_ag) -DMAN_SECTION=1sntpmdoc -Tagmdoc-cmd.tpl sntp-opts.def
263 $(srcdir)/sntp.mdoc.in: $(srcdir)/sntp.1sntpmdoc $(srcdir)/scripts/mansec2subst.sed
264 sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpmdoc > $(srcdir)/sntp.mdoc.in+
265 mv $(srcdir)/sntp.mdoc.in+ $(srcdir)/sntp.mdoc.in
269 sntp.$(SNTP_MS): $(srcdir)/sntp.$(MANTAGFMT).in $(top_builddir)/config.status
270 $(top_builddir)/config.status --file=sntp.$(SNTP_MS)+:$(srcdir)/sntp.$(MANTAGFMT).in
271 mv sntp.$(SNTP_MS)+ sntp.$(SNTP_MS)
275 $(srcdir)/invoke-sntp.menu: $(srcdir)/invoke-sntp.texi
276 @: do-nothing action to avoid default SCCS get, .menu built with .texi
278 $(srcdir)/invoke-sntp.texi: $(srcdir)/sntp-opts.def $(std_def_list)
279 $(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section sntp-opts.def
280 $(top_srcdir)/../scripts/build/check--help $@
282 $(srcdir)/sntp.html: $(srcdir)/invoke-sntp.menu $(srcdir)/invoke-sntp.texi $(srcdir)/sntp.texi $(srcdir)/include/version.texi
283 cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
285 libtool: $(LIBTOOL_DEPS)
286 ./config.status --recheck
289 if test -n "$(NTP_FORCE_LIBEVENT_DIST)" ; then rm -rf $(distdir)/libevent/autom4te.cache $(distdir)/libevent/config.h.in~ ; find $(distdir)/libevent -type d -name SCCS -print | xargs rm -rf ; fi
291 dist-hook: libevent-dist-hook
292 @: do-nothing action to avoid default SCCS get
294 include $(top_srcdir)/bincheck.mf
295 include $(top_srcdir)/check-libntp.mf
296 include $(top_srcdir)/check-libopts.mf
297 include $(top_srcdir)/depsver.mf
298 include $(top_srcdir)/includes.mf