1285612Sdelphij## Makefile.am for JMK's SNTP, by Harlan Stenn
2132451Sroberto
3285612SdelphijACLOCAL_AMFLAGS = -I m4 -I libevent/m4 -I libopts/m4
4132451Sroberto
5285612SdelphijNULL =
6132451Sroberto
7316722SdelphijAM_CFLAGS  = $(CFLAGS_NTP)
8316722SdelphijAM_CFLAGS += $(NTP_HARD_CFLAGS)
9132451Sroberto
10285612SdelphijAM_CPPFLAGS  = $(SNTP_INCS)
11285612SdelphijAM_CPPFLAGS += $(LIBOPTS_CFLAGS)
12285612SdelphijAM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
13285612SdelphijAM_CPPFLAGS += $(CPPFLAGS_NTP)
14316722SdelphijAM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
15182007Sroberto
16316722SdelphijAM_LDFLAGS  = $(LDFLAGS_NTP)
17316722SdelphijAM_LDFLAGS += $(NTP_HARD_LDFLAGS)
18285612Sdelphij
19285612SdelphijLDADD  = version.o
20285612SdelphijLDADD += libsntp.a
21285612SdelphijLDADD += $(LIBOPTS_LDADD)
22285612SdelphijLDADD += $(LDADD_LIBEVENT)
23285612SdelphijLDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
24285612SdelphijLDADD += $(PTHREAD_LIBS)
25285612SdelphijLDADD += $(LDADD_NTP)
26285612Sdelphij
27285612Sdelphijrun_ag =	cd $(srcdir) &&	env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D	\
28285612Sdelphij		autogen -L include -L ag-tpl --writable
29285612Sdelphijstd_def_list =						\
30285612Sdelphij	$(srcdir)/include/debug-opt.def			\
31285612Sdelphij	$(srcdir)/include/autogen-version.def 		\
32285612Sdelphij	$(srcdir)/include/copyright.def 		\
33285612Sdelphij	$(srcdir)/include/homerc.def 			\
34285612Sdelphij	$(srcdir)/include/ntp.lic 			\
35285612Sdelphij	$(srcdir)/include/version.def			\
36285612Sdelphij	$(NULL)
37285612Sdelphij
38285612SdelphijEXTRA_PROGRAMS = sntp
39285612Sdelphij
40285612Sdelphijbin_PROGRAMS =		@SNTP_DB@
41285612Sdelphijlibexec_PROGRAMS =	@SNTP_DL@
42285612Sdelphijsbin_PROGRAMS =		@SNTP_DS@
43285612Sdelphij
44285612SdelphijSUBDIRS = include scripts unity
45289997SglebiusDIST_FAIL =
46285612Sdelphij
47285612Sdelphijif BUILD_LIBEVENT
48285612SdelphijSUBDIRS += libevent
49289997Sglebiuselse
50289997SglebiusDIST_FAIL += "--enable-local-libevent"
51285612Sdelphijendif
52285612Sdelphij
53182007Srobertoif NEED_LIBOPTS
54285612SdelphijSUBDIRS += libopts
55182007Srobertoendif
56182007Sroberto
57285612Sdelphijif BUILD_SNTP
58285612Sdelphijnoinst_LIBRARIES = libsntp.a
59285612SdelphijSUBDIRS += tests
60285612Sdelphijendif
61285612Sdelphij
62285612Sdelphijlibsntp_a_SOURCES =		\
63285612Sdelphij	crypto.c		\
64285612Sdelphij	kod_management.c	\
65285612Sdelphij	log.c			\
66285612Sdelphij	main.c			\
67285612Sdelphij	networking.c		\
68285612Sdelphij	sntp-opts.c		\
69285612Sdelphij	utilities.c		\
70182007Sroberto	$(NULL)
71132451Sroberto
72285612Sdelphijsntp_SOURCES =		\
73285612Sdelphij	sntp.c		\
74285612Sdelphij	$(NULL)
75182007Sroberto
76285612Sdelphijnoinst_HEADERS =		\
77285612Sdelphij	crypto.h		\
78285612Sdelphij	data_formats.h		\
79285612Sdelphij	kod_management.h	\
80285612Sdelphij	log.h			\
81285612Sdelphij	main.h			\
82285612Sdelphij	networking.h		\
83285612Sdelphij	sntp-opts.h		\
84285612Sdelphij	utilities.h		\
85285612Sdelphij	$(NULL)
86182007Sroberto
87285612SdelphijDISTCLEANFILES =			\
88285612Sdelphij	.version			\
89285612Sdelphij	version.c			\
90285612Sdelphij	config.log			\
91285612Sdelphij	$(man_MANS)			\
92285612Sdelphij	$(NULL)
93182007Sroberto
94285612SdelphijEXTRA_DIST =				\
95285612Sdelphij	$(srcdir)/COPYRIGHT		\
96285612Sdelphij	ag-tpl				\
97285612Sdelphij	deps-ver			\
98316722Sdelphij	harden				\
99285612Sdelphij	invoke-sntp.menu		\
100285612Sdelphij	invoke-sntp.texi		\
101285612Sdelphij	@NTP_FORCE_LIBEVENT_DIST@	\
102285612Sdelphij	libpkgver 			\
103285612Sdelphij	loc				\
104285612Sdelphij	sntp-opts.def			\
105285612Sdelphij	sntp.1sntpman			\
106285612Sdelphij	sntp.1sntpmdoc			\
107285612Sdelphij	sntp.man.in			\
108285612Sdelphij	sntp.mdoc.in			\
109285612Sdelphij	sntp.html			\
110285612Sdelphij	sntp.texi			\
111285612Sdelphij	unity/auto			\
112285612Sdelphij	$(srcdir)/scm-rev		\
113285612Sdelphij	$(srcdir)/m4/version.m4		\
114285612Sdelphij	$(NULL)
115285612Sdelphij
116285612SdelphijBUILT_SOURCES =				\
117285612Sdelphij	$(srcdir)/COPYRIGHT		\
118285612Sdelphij	libtool				\
119285612Sdelphij	$(srcdir)/sntp-opts.c		\
120285612Sdelphij	$(srcdir)/sntp-opts.h		\
121285612Sdelphij	check-scm-rev			\
122285612Sdelphij	$(srcdir)/include/version.def	\
123285612Sdelphij	$(srcdir)/m4/version.m4		\
124285612Sdelphij	$(srcdir)/include/version.texi	\
125285612Sdelphij	$(NULL)
126285612Sdelphij
127285612SdelphijCLEANFILES =				\
128285612Sdelphij	built-sources-only		\
129285612Sdelphij	check-COPYRIGHT-submake		\
130285612Sdelphij	$(NULL)
131285612Sdelphij
132285612Sdelphijman1_MANS=
133285612Sdelphijman8_MANS=
134285612Sdelphijman_MANS=	sntp.$(SNTP_MS)
135285612Sdelphij
136285612Sdelphij## HMS: Real Soon Now...
137285612Sdelphij##info_TEXINFOS=	sntp.texi
138285612Sdelphij##sntp_TEXINFOS=	invoke-sntp.texi
139285612Sdelphij
140285612Sdelphijhtml_DATA=				\
141285612Sdelphij	$(srcdir)/sntp.html		\
142285612Sdelphij	$(NULL)
143285612Sdelphij
144285612Sdelphijnoinst_DATA=				\
145285612Sdelphij	$(srcdir)/invoke-sntp.menu	\
146285612Sdelphij	$(srcdir)/invoke-sntp.texi	\
147285612Sdelphij	$(srcdir)/sntp.man.in		\
148285612Sdelphij	$(srcdir)/sntp.mdoc.in		\
149285612Sdelphij	$(NULL)
150285612Sdelphij
151285612Sdelphijinstall-data-local: install-html
152285612Sdelphij
153182007SrobertoFRC:
154285612Sdelphij	@: do-nothing action to prevent default SCCS get
155285612Sdelphij	@: FRC "force" depends on nothing and is not a file, so is
156285612Sdelphij	@: always out-of-date causing targets which depend on it to
157285612Sdelphij	@: similarly always be outdated causing their rules to fire
158285612Sdelphij	@: each time they or a dependent is built.
159285612Sdelphij
160285612Sdelphij$(PROGRAMS): version.o
161285612Sdelphij
162285612Sdelphij## We probably need something about libevent, too
163285612Sdelphij## That is probably not possible since LDADD_LIBEVENT may be
164285612Sdelphij## non-file "-levent_core".
165285612Sdelphij
166285612Sdelphijversion.c: $(sntp_OBJECTS) ../libntp/libntp.a Makefile $(srcdir)/scm-rev
167285612Sdelphij	env CSET=`cat $(srcdir)/scm-rev` $(top_builddir)/../scripts/build/mkver sntp
168285612Sdelphij
169285612Sdelphijversion.o: version.c
170285612Sdelphij	env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
171285612Sdelphij
172182007Srobertocheck-autogen-version.def: FRC
173182007Sroberto	@cd $(srcdir)							\
174182007Sroberto	&& test -r ../include/autogen-version.def			\
175182007Sroberto	&& ( if cmp -s ../include/autogen-version.def autogen-version.def; \
176182007Sroberto	   then : ;							\
177182007Sroberto	   else cp ../include/autogen-version.def autogen-version.def;	 \
178182007Sroberto		echo "Installing new sntp/autogen-version.def file";	\
179182007Sroberto	   fi )
180182007Sroberto
181285612Sdelphij$(srcdir)/autogen-version.def:
182285612Sdelphij	$(MAKE) $(AM_MAKEFLAGS) check-autogen-version.def
183182007Sroberto
184285612Sdelphijbuilt-sources-only: $(BUILT_SOURCES)
185285612Sdelphij	@: do-nothing action to avoid default SCCS get
186285612Sdelphij
187285612Sdelphij## HMS: The next bit is still suboptimal.  We'll get an error if this is
188285612Sdelphij## a bk repo and srcdir or scm-rev is unwritable.
189285612Sdelphij
190285612Sdelphijcheck-scm-rev: $(srcdir)/scm-rev
191285612Sdelphij	@: do-nothing
192285612Sdelphij
193285612Sdelphij$(srcdir)/scm-rev:
194316722Sdelphij	-bk root $(srcdir) >/dev/null 2>&1 &&			\
195285612Sdelphij	    cd $(srcdir)/.. &&					\
196285612Sdelphij	    x=`bk -R prs -hr+ -nd:I: ChangeSet` &&		\
197285612Sdelphij	    y=`cat sntp/scm-rev 2>/dev/null` || true &&		\
198285612Sdelphij	    case "$$x" in ''|$$y) ;; *) echo $$x > sntp/scm-rev ;; esac
199285612Sdelphij
200285612Sdelphij$(srcdir)/m4/version.m4: $(srcdir)/../packageinfo.sh
201285612Sdelphij	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
202285612Sdelphij	../scripts/build/genver m4/version.m4
203285612Sdelphij
204285612Sdelphij$(srcdir)/include/version.def: $(srcdir)/../packageinfo.sh
205285612Sdelphij	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
206285612Sdelphij	../scripts/build/genver include/version.def
207285612Sdelphij
208285612Sdelphij$(srcdir)/include/version.texi: $(srcdir)/../packageinfo.sh
209285612Sdelphij	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
210285612Sdelphij	../scripts/build/genver include/version.texi
211285612Sdelphij
212285612Sdelphij$(srcdir)/../COPYRIGHT:
213285612Sdelphij	cd .. && $(MAKE) $(AM_MAKEFLAGS) COPYRIGHT-please
214285612Sdelphij
215285612Sdelphijcheck-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT
216285612Sdelphij	@cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT	\
217285612Sdelphij	 || { cp $(srcdir)/../COPYRIGHT $(srcdir)		\
218285612Sdelphij	      && echo 'updated sntp/COPYRIGHT installed' ;}
219285612Sdelphij	@echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@
220285612Sdelphij
221285612Sdelphijcheck-COPYRIGHT: FRC
222285612Sdelphij	[ ! -r $(srcdir)/../COPYRIGHT ]					\
223285612Sdelphij	|| [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ]	\
224285612Sdelphij	|| $(MAKE) $(AM_MAKEFLAGS) check-COPYRIGHT-submake
225285612Sdelphij
226285612Sdelphij$(srcdir)/COPYRIGHT: check-COPYRIGHT
227285612Sdelphij	@: do-nothing action to prevent any default
228285612Sdelphij
229182007Sroberto$(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
230285612Sdelphij	@: do-nothing action to avoid default SCCS get, .h built with .c
231285612Sdelphij
232285612Sdelphij$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(std_def_list)
233182007Sroberto	$(run_ag) sntp-opts.def
234182007Sroberto
235285612Sdelphij###
236182007Sroberto
237285612Sdelphij$(srcdir)/sntp.1sntpman: $(srcdir)/sntp-opts.def $(std_def_list)
238285612Sdelphij	$(run_ag) -DMAN_SECTION=1sntpman -Tagman-cmd.tpl sntp-opts.def
239182007Sroberto
240285612Sdelphij$(srcdir)/sntp.man.in: $(srcdir)/sntp.1sntpman $(srcdir)/scripts/mansec2subst.sed
241285612Sdelphij	sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpman > $(srcdir)/sntp.man.in+
242285612Sdelphij	mv $(srcdir)/sntp.man.in+ $(srcdir)/sntp.man.in
243285612Sdelphij
244285612Sdelphij###
245285612Sdelphij
246285612Sdelphij$(srcdir)/sntp.1sntpmdoc: $(srcdir)/sntp-opts.def $(std_def_list)
247285612Sdelphij	$(run_ag) -DMAN_SECTION=1sntpmdoc -Tagmdoc-cmd.tpl sntp-opts.def
248285612Sdelphij
249285612Sdelphij$(srcdir)/sntp.mdoc.in: $(srcdir)/sntp.1sntpmdoc $(srcdir)/scripts/mansec2subst.sed
250285612Sdelphij	sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpmdoc > $(srcdir)/sntp.mdoc.in+
251285612Sdelphij	mv $(srcdir)/sntp.mdoc.in+ $(srcdir)/sntp.mdoc.in
252285612Sdelphij
253285612Sdelphij###
254285612Sdelphij
255285612Sdelphijsntp.$(SNTP_MS): $(srcdir)/sntp.$(MANTAGFMT).in $(top_builddir)/config.status
256285612Sdelphij	$(top_builddir)/config.status --file=sntp.$(SNTP_MS)+:$(srcdir)/sntp.$(MANTAGFMT).in
257285612Sdelphij	mv sntp.$(SNTP_MS)+ sntp.$(SNTP_MS)
258285612Sdelphij
259285612Sdelphij###
260285612Sdelphij
261285612Sdelphij$(srcdir)/invoke-sntp.menu: $(srcdir)/invoke-sntp.texi
262285612Sdelphij	@: do-nothing action to avoid default SCCS get, .menu built with .texi
263285612Sdelphij
264285612Sdelphij$(srcdir)/invoke-sntp.texi: $(srcdir)/sntp-opts.def $(std_def_list)
265285612Sdelphij	$(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section sntp-opts.def
266285612Sdelphij	$(top_srcdir)/../scripts/build/check--help $@
267285612Sdelphij
268285612Sdelphij$(srcdir)/sntp.html: $(srcdir)/invoke-sntp.menu $(srcdir)/invoke-sntp.texi $(srcdir)/sntp.texi $(srcdir)/include/version.texi
269285612Sdelphij	cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
270285612Sdelphij
271285612Sdelphijlibtool: $(LIBTOOL_DEPS)
272285612Sdelphij	./config.status --recheck
273285612Sdelphij
274289997Sglebius# HMS: libevent/ is a target if it's in EXTRA_DIST via NTP_FORCE_LIBEVENT_DIST.
275289997Sglebius# Note that libevent/ is already in DIST_SUBDIRS (implicit in Makefile.am
276289997Sglebius# but explicit in Makefile.in).  This check doesn't help with distclean.
277289997Sglebiuslibevent: distdir-pre-check
278285612Sdelphij
279289997Sglebius# HMS: Stops the build for gmake or pmake
280289997Sglebiusdistdir-pre-check:
281289997Sglebius	case "$(DIST_FAIL)" in	\
282289997Sglebius	 '')  ;;		\
283289997Sglebius	 *) $(error re-run configure adding $(DIST_FAIL) if you want to make a distribution.);	\
284289997Sglebius	    echo "re-run configure adding $(DIST_FAIL) if you want to make a distribution.";	\
285289997Sglebius	    exit 1 ;;		\
286289997Sglebius	esac
287285612Sdelphij
288285612Sdelphijinclude $(top_srcdir)/bincheck.mf
289285612Sdelphijinclude $(top_srcdir)/check-libntp.mf
290285612Sdelphijinclude $(top_srcdir)/check-libopts.mf
291285612Sdelphijinclude $(top_srcdir)/depsver.mf
292285612Sdelphijinclude $(top_srcdir)/includes.mf
293