1290001Sglebius## Makefile.am for JMK's SNTP, by Harlan Stenn
2132451Sroberto
3290001SglebiusACLOCAL_AMFLAGS = -I m4 -I libevent/m4 -I libopts/m4
4132451Sroberto
5290001SglebiusNULL =
6132451Sroberto
7290001SglebiusAM_CFLAGS = $(CFLAGS_NTP)
8132451Sroberto
9290001SglebiusAM_CPPFLAGS  = $(SNTP_INCS)
10290001SglebiusAM_CPPFLAGS += $(LIBOPTS_CFLAGS)
11290001SglebiusAM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
12290001SglebiusAM_CPPFLAGS += $(CPPFLAGS_NTP)
13182007Sroberto
14290001SglebiusAM_LDFLAGS = $(LDFLAGS_NTP)
15290001Sglebius
16290001SglebiusLDADD  = version.o
17290001SglebiusLDADD += libsntp.a
18290001SglebiusLDADD += $(LIBOPTS_LDADD)
19290001SglebiusLDADD += $(LDADD_LIBEVENT)
20290001SglebiusLDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
21290001SglebiusLDADD += $(PTHREAD_LIBS)
22290001SglebiusLDADD += $(LDADD_NTP)
23290001Sglebius
24290001Sglebiusrun_ag =	cd $(srcdir) &&	env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D	\
25290001Sglebius		autogen -L include -L ag-tpl --writable
26290001Sglebiusstd_def_list =						\
27290001Sglebius	$(srcdir)/include/debug-opt.def			\
28290001Sglebius	$(srcdir)/include/autogen-version.def 		\
29290001Sglebius	$(srcdir)/include/copyright.def 		\
30290001Sglebius	$(srcdir)/include/homerc.def 			\
31290001Sglebius	$(srcdir)/include/ntp.lic 			\
32290001Sglebius	$(srcdir)/include/version.def			\
33290001Sglebius	$(NULL)
34290001Sglebius
35290001SglebiusEXTRA_PROGRAMS = sntp
36290001Sglebius
37290001Sglebiusbin_PROGRAMS =		@SNTP_DB@
38290001Sglebiuslibexec_PROGRAMS =	@SNTP_DL@
39290001Sglebiussbin_PROGRAMS =		@SNTP_DS@
40290001Sglebius
41290001SglebiusSUBDIRS = include scripts unity
42290001SglebiusDIST_FAIL =
43290001Sglebius
44290001Sglebiusif BUILD_LIBEVENT
45290001SglebiusSUBDIRS += libevent
46290001Sglebiuselse
47290001SglebiusDIST_FAIL += "--enable-local-libevent"
48290001Sglebiusendif
49290001Sglebius
50182007Srobertoif NEED_LIBOPTS
51290001SglebiusSUBDIRS += libopts
52182007Srobertoendif
53182007Sroberto
54290001Sglebiusif BUILD_SNTP
55290001Sglebiusnoinst_LIBRARIES = libsntp.a
56290001SglebiusSUBDIRS += tests
57290001Sglebiusendif
58290001Sglebius
59290001Sglebiuslibsntp_a_SOURCES =		\
60290001Sglebius	crypto.c		\
61290001Sglebius	kod_management.c	\
62290001Sglebius	log.c			\
63290001Sglebius	main.c			\
64290001Sglebius	networking.c		\
65290001Sglebius	sntp-opts.c		\
66290001Sglebius	utilities.c		\
67182007Sroberto	$(NULL)
68132451Sroberto
69290001Sglebiussntp_SOURCES =		\
70290001Sglebius	sntp.c		\
71290001Sglebius	$(NULL)
72182007Sroberto
73290001Sglebiusnoinst_HEADERS =		\
74290001Sglebius	crypto.h		\
75290001Sglebius	data_formats.h		\
76290001Sglebius	kod_management.h	\
77290001Sglebius	log.h			\
78290001Sglebius	main.h			\
79290001Sglebius	networking.h		\
80290001Sglebius	sntp-opts.h		\
81290001Sglebius	utilities.h		\
82290001Sglebius	$(NULL)
83182007Sroberto
84290001SglebiusDISTCLEANFILES =			\
85290001Sglebius	.version			\
86290001Sglebius	version.c			\
87290001Sglebius	config.log			\
88290001Sglebius	$(man_MANS)			\
89290001Sglebius	$(NULL)
90182007Sroberto
91290001SglebiusEXTRA_DIST =				\
92290001Sglebius	$(srcdir)/COPYRIGHT		\
93290001Sglebius	ag-tpl				\
94290001Sglebius	deps-ver			\
95290001Sglebius	invoke-sntp.menu		\
96290001Sglebius	invoke-sntp.texi		\
97290001Sglebius	@NTP_FORCE_LIBEVENT_DIST@	\
98290001Sglebius	libpkgver 			\
99290001Sglebius	loc				\
100290001Sglebius	sntp-opts.def			\
101290001Sglebius	sntp.1sntpman			\
102290001Sglebius	sntp.1sntpmdoc			\
103290001Sglebius	sntp.man.in			\
104290001Sglebius	sntp.mdoc.in			\
105290001Sglebius	sntp.html			\
106290001Sglebius	sntp.texi			\
107290001Sglebius	unity/auto			\
108290001Sglebius	$(srcdir)/scm-rev		\
109290001Sglebius	$(srcdir)/m4/version.m4		\
110290001Sglebius	$(NULL)
111290001Sglebius
112290001SglebiusBUILT_SOURCES =				\
113290001Sglebius	$(srcdir)/COPYRIGHT		\
114290001Sglebius	libtool				\
115290001Sglebius	$(srcdir)/sntp-opts.c		\
116290001Sglebius	$(srcdir)/sntp-opts.h		\
117290001Sglebius	check-scm-rev			\
118290001Sglebius	$(srcdir)/include/version.def	\
119290001Sglebius	$(srcdir)/m4/version.m4		\
120290001Sglebius	$(srcdir)/include/version.texi	\
121290001Sglebius	$(NULL)
122290001Sglebius
123290001SglebiusCLEANFILES =				\
124290001Sglebius	built-sources-only		\
125290001Sglebius	check-COPYRIGHT-submake		\
126290001Sglebius	$(NULL)
127290001Sglebius
128290001Sglebiusman1_MANS=
129290001Sglebiusman8_MANS=
130290001Sglebiusman_MANS=	sntp.$(SNTP_MS)
131290001Sglebius
132290001Sglebius## HMS: Real Soon Now...
133290001Sglebius##info_TEXINFOS=	sntp.texi
134290001Sglebius##sntp_TEXINFOS=	invoke-sntp.texi
135290001Sglebius
136290001Sglebiushtml_DATA=				\
137290001Sglebius	$(srcdir)/sntp.html		\
138290001Sglebius	$(NULL)
139290001Sglebius
140290001Sglebiusnoinst_DATA=				\
141290001Sglebius	$(srcdir)/invoke-sntp.menu	\
142290001Sglebius	$(srcdir)/invoke-sntp.texi	\
143290001Sglebius	$(srcdir)/sntp.man.in		\
144290001Sglebius	$(srcdir)/sntp.mdoc.in		\
145290001Sglebius	$(NULL)
146290001Sglebius
147290001Sglebiusinstall-data-local: install-html
148290001Sglebius
149182007SrobertoFRC:
150290001Sglebius	@: do-nothing action to prevent default SCCS get
151290001Sglebius	@: FRC "force" depends on nothing and is not a file, so is
152290001Sglebius	@: always out-of-date causing targets which depend on it to
153290001Sglebius	@: similarly always be outdated causing their rules to fire
154290001Sglebius	@: each time they or a dependent is built.
155290001Sglebius
156290001Sglebius$(PROGRAMS): version.o
157290001Sglebius
158290001Sglebius## We probably need something about libevent, too
159290001Sglebius## That is probably not possible since LDADD_LIBEVENT may be
160290001Sglebius## non-file "-levent_core".
161290001Sglebius
162290001Sglebiusversion.c: $(sntp_OBJECTS) ../libntp/libntp.a Makefile $(srcdir)/scm-rev
163290001Sglebius	env CSET=`cat $(srcdir)/scm-rev` $(top_builddir)/../scripts/build/mkver sntp
164290001Sglebius
165290001Sglebiusversion.o: version.c
166290001Sglebius	env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
167290001Sglebius
168182007Srobertocheck-autogen-version.def: FRC
169182007Sroberto	@cd $(srcdir)							\
170182007Sroberto	&& test -r ../include/autogen-version.def			\
171182007Sroberto	&& ( if cmp -s ../include/autogen-version.def autogen-version.def; \
172182007Sroberto	   then : ;							\
173182007Sroberto	   else cp ../include/autogen-version.def autogen-version.def;	 \
174182007Sroberto		echo "Installing new sntp/autogen-version.def file";	\
175182007Sroberto	   fi )
176182007Sroberto
177290001Sglebius$(srcdir)/autogen-version.def:
178290001Sglebius	$(MAKE) $(AM_MAKEFLAGS) check-autogen-version.def
179182007Sroberto
180290001Sglebiusbuilt-sources-only: $(BUILT_SOURCES)
181290001Sglebius	@: do-nothing action to avoid default SCCS get
182290001Sglebius
183290001Sglebius## HMS: The next bit is still suboptimal.  We'll get an error if this is
184290001Sglebius## a bk repo and srcdir or scm-rev is unwritable.
185290001Sglebius
186290001Sglebiuscheck-scm-rev: $(srcdir)/scm-rev
187290001Sglebius	@: do-nothing
188290001Sglebius
189290001Sglebius$(srcdir)/scm-rev:
190290001Sglebius	-test -r $(srcdir)/../SCCS/s.ChangeSet &&		\
191290001Sglebius	    (bk version) >/dev/null 2>&1 &&			\
192290001Sglebius	    cd $(srcdir)/.. &&					\
193290001Sglebius	    x=`bk -R prs -hr+ -nd:I: ChangeSet` &&		\
194290001Sglebius	    y=`cat sntp/scm-rev 2>/dev/null` || true &&		\
195290001Sglebius	    case "$$x" in ''|$$y) ;; *) echo $$x > sntp/scm-rev ;; esac
196290001Sglebius
197290001Sglebius$(srcdir)/m4/version.m4: $(srcdir)/../packageinfo.sh
198290001Sglebius	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
199290001Sglebius	../scripts/build/genver m4/version.m4
200290001Sglebius
201290001Sglebius$(srcdir)/include/version.def: $(srcdir)/../packageinfo.sh
202290001Sglebius	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
203290001Sglebius	../scripts/build/genver include/version.def
204290001Sglebius
205290001Sglebius$(srcdir)/include/version.texi: $(srcdir)/../packageinfo.sh
206290001Sglebius	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
207290001Sglebius	../scripts/build/genver include/version.texi
208290001Sglebius
209290001Sglebius$(srcdir)/../COPYRIGHT:
210290001Sglebius	cd .. && $(MAKE) $(AM_MAKEFLAGS) COPYRIGHT-please
211290001Sglebius
212290001Sglebiuscheck-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT
213290001Sglebius	@cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT	\
214290001Sglebius	 || { cp $(srcdir)/../COPYRIGHT $(srcdir)		\
215290001Sglebius	      && echo 'updated sntp/COPYRIGHT installed' ;}
216290001Sglebius	@echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@
217290001Sglebius
218290001Sglebiuscheck-COPYRIGHT: FRC
219290001Sglebius	[ ! -r $(srcdir)/../COPYRIGHT ]					\
220290001Sglebius	|| [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ]	\
221290001Sglebius	|| $(MAKE) $(AM_MAKEFLAGS) check-COPYRIGHT-submake
222290001Sglebius
223290001Sglebius$(srcdir)/COPYRIGHT: check-COPYRIGHT
224290001Sglebius	@: do-nothing action to prevent any default
225290001Sglebius
226182007Sroberto$(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
227290001Sglebius	@: do-nothing action to avoid default SCCS get, .h built with .c
228290001Sglebius
229290001Sglebius$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(std_def_list)
230182007Sroberto	$(run_ag) sntp-opts.def
231182007Sroberto
232290001Sglebius###
233182007Sroberto
234290001Sglebius$(srcdir)/sntp.1sntpman: $(srcdir)/sntp-opts.def $(std_def_list)
235290001Sglebius	$(run_ag) -DMAN_SECTION=1sntpman -Tagman-cmd.tpl sntp-opts.def
236182007Sroberto
237290001Sglebius$(srcdir)/sntp.man.in: $(srcdir)/sntp.1sntpman $(srcdir)/scripts/mansec2subst.sed
238290001Sglebius	sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpman > $(srcdir)/sntp.man.in+
239290001Sglebius	mv $(srcdir)/sntp.man.in+ $(srcdir)/sntp.man.in
240290001Sglebius
241290001Sglebius###
242290001Sglebius
243290001Sglebius$(srcdir)/sntp.1sntpmdoc: $(srcdir)/sntp-opts.def $(std_def_list)
244290001Sglebius	$(run_ag) -DMAN_SECTION=1sntpmdoc -Tagmdoc-cmd.tpl sntp-opts.def
245290001Sglebius
246290001Sglebius$(srcdir)/sntp.mdoc.in: $(srcdir)/sntp.1sntpmdoc $(srcdir)/scripts/mansec2subst.sed
247290001Sglebius	sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpmdoc > $(srcdir)/sntp.mdoc.in+
248290001Sglebius	mv $(srcdir)/sntp.mdoc.in+ $(srcdir)/sntp.mdoc.in
249290001Sglebius
250290001Sglebius###
251290001Sglebius
252290001Sglebiussntp.$(SNTP_MS): $(srcdir)/sntp.$(MANTAGFMT).in $(top_builddir)/config.status
253290001Sglebius	$(top_builddir)/config.status --file=sntp.$(SNTP_MS)+:$(srcdir)/sntp.$(MANTAGFMT).in
254290001Sglebius	mv sntp.$(SNTP_MS)+ sntp.$(SNTP_MS)
255290001Sglebius
256290001Sglebius###
257290001Sglebius
258290001Sglebius$(srcdir)/invoke-sntp.menu: $(srcdir)/invoke-sntp.texi
259290001Sglebius	@: do-nothing action to avoid default SCCS get, .menu built with .texi
260290001Sglebius
261290001Sglebius$(srcdir)/invoke-sntp.texi: $(srcdir)/sntp-opts.def $(std_def_list)
262290001Sglebius	$(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section sntp-opts.def
263290001Sglebius	$(top_srcdir)/../scripts/build/check--help $@
264290001Sglebius
265290001Sglebius$(srcdir)/sntp.html: $(srcdir)/invoke-sntp.menu $(srcdir)/invoke-sntp.texi $(srcdir)/sntp.texi $(srcdir)/include/version.texi
266290001Sglebius	cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
267290001Sglebius
268290001Sglebiuslibtool: $(LIBTOOL_DEPS)
269290001Sglebius	./config.status --recheck
270290001Sglebius
271290001Sglebius# HMS: libevent/ is a target if it's in EXTRA_DIST via NTP_FORCE_LIBEVENT_DIST.
272290001Sglebius# Note that libevent/ is already in DIST_SUBDIRS (implicit in Makefile.am
273290001Sglebius# but explicit in Makefile.in).  This check doesn't help with distclean.
274290001Sglebiuslibevent: distdir-pre-check
275290001Sglebius
276290001Sglebius# HMS: Stops the build for gmake or pmake
277290001Sglebiusdistdir-pre-check:
278290001Sglebius	case "$(DIST_FAIL)" in	\
279290001Sglebius	 '')  ;;		\
280290001Sglebius	 *) $(error re-run configure adding $(DIST_FAIL) if you want to make a distribution.);	\
281290001Sglebius	    echo "re-run configure adding $(DIST_FAIL) if you want to make a distribution.";	\
282290001Sglebius	    exit 1 ;;		\
283290001Sglebius	esac
284290001Sglebius
285290001Sglebiusinclude $(top_srcdir)/bincheck.mf
286290001Sglebiusinclude $(top_srcdir)/check-libntp.mf
287290001Sglebiusinclude $(top_srcdir)/check-libopts.mf
288290001Sglebiusinclude $(top_srcdir)/depsver.mf
289290001Sglebiusinclude $(top_srcdir)/includes.mf
290