1# Makefile.am for JMK's SNTP, by Harlan Stenn
2
3NULL=
4
5AUTOMAKE_OPTIONS = foreign 1.10
6ACLOCAL_AMFLAGS= -I ../m4 -I libopts/m4
7
8AM_CPPFLAGS= $(LIBOPTS_CFLAGS) -I$(top_srcdir)/../include \
9	-I$(top_srcdir)/../lib/isc/include \
10	-I$(top_srcdir)/../lib/isc/nothreads/include \
11	-I$(top_srcdir)/../lib/isc/unix/include
12
13LDADD=	$(LIBOPTS_LDADD) -lm ../libntp/libntp.a
14
15run_ag=	cd $(srcdir) &&				\
16	env PATH="$(abs_builddir):$(PATH)"	\
17	autogen -L ../include --writable
18
19bindir=	${exec_prefix}/${BINSUBDIR}
20bin_PROGRAMS=	sntp
21CLEANFILES=	libopts-subdir
22
23SUBDIRS=
24if NEED_LIBOPTS
25SUBDIRS+= libopts
26endif
27SUBDIRS+= .
28
29sntp_SOURCES =		\
30	crypto.c	\
31	crypto.h	\
32	data_formats.h	\
33	header.h	\
34	kod_management.c \
35	kod_management.h \
36	log.c		\
37	log.h		\
38	main.c		\
39	networking.c	\
40	networking.h	\
41	sntp-opts.c	\
42	sntp-opts.h	\
43	utilities.c	\
44	utilities.h	\
45	$(NULL)
46
47# it's in EXTRA_DIST
48#dist_man_MANS=	sntp.1
49
50EXTRA_DIST=				\
51		autogen-version.def	\
52		bincheck.mf		\
53		COPYRIGHT		\
54		deps-ver		\
55		depsver.mf		\
56		sntp-opts.def		\
57		sntp-opts.menu		\
58		sntp-opts.texi		\
59		sntp.1			\
60		sntp.html		\
61		sntp.texi		\
62		version.def		\
63		version.m4		\
64		version.texi		\
65		$(NULL)
66
67OLD_EXTRA_DIST=		\
68		autogen-version.def version.def version.m4 version.texi
69
70BUILT_SOURCES=						\
71		check-autogen-version.def		\
72		check-version.def check-version.m4	\
73		check-version.texi			\
74		libtool					\
75		sntp-opts.c				\
76		sntp-opts.h				\
77		sntp-opts.menu				\
78		sntp-opts.texi				\
79		sntp.1					\
80		sntp.html				\
81		$(NULL)
82
83man_MANS=	sntp.1
84
85FRC:
86check-autogen-version.def: FRC
87	@cd $(srcdir)							\
88	&& test -r ../include/autogen-version.def			\
89	&& ( if cmp -s ../include/autogen-version.def autogen-version.def; \
90	   then : ;							\
91	   else cp ../include/autogen-version.def autogen-version.def;	 \
92		echo "Installing new sntp/autogen-version.def file";	\
93	   fi )
94
95check-version.def: FRC
96	@cd $(srcdir)					\
97	&& test -r ../include/version.def		\
98	&& ( if cmp -s ../include/version.def version.def;	\
99	   then : ;						\
100	   else cp ../include/version.def version.def;		\
101		echo "Installing new sntp/version.def file";	\
102	   fi )
103
104check-version.m4: FRC
105	@cd $(srcdir)					\
106	&& test -r ../version.m4			\
107	&& ( if cmp -s ../version.m4 version.m4;	\
108	   then : ;					\
109	   else cp ../version.m4 version.m4;		\
110		echo "Installing new sntp/version.m4 file";	\
111	   fi )
112
113check-version.texi: FRC
114	@cd $(srcdir)					\
115	&& test -r ../include/version.texi			\
116	&& ( if cmp -s ../include/version.texi version.texi;	\
117	   then : ;					\
118	   else cp ../include/version.texi version.texi;	\
119		echo "Installing new sntp/version.texi file";	\
120	   fi )
121
122$(srcdir)/../COPYRIGHT:
123	cd .. && $(MAKE) COPYRIGHT
124
125$(srcdir)/COPYRIGHT: $(srcdir)/../COPYRIGHT
126	cat $(srcdir)/../COPYRIGHT > $@
127
128$(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
129	@: do-nothing action to avoid default SCCS get, .h built with .c
130	
131$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(srcdir)/../include/version.def
132	$(run_ag) sntp-opts.def
133
134$(srcdir)/sntp.1: $(srcdir)/sntp-opts.def $(srcdir)/../include/version.def
135	$(run_ag) -Tagman1.tpl -bsntp sntp-opts.def
136
137$(srcdir)/sntp-opts.texi $(srcdir)/sntp-opts.menu: $(srcdir)/sntp-opts.def $(srcdir)/../include/version.def
138	$(MAKE) libopts-subdir sntp	# aginfo.tpl runs binary to extract --help usage text
139	$(run_ag) -Taginfo.tpl -DLEVEL=section sntp-opts.def
140
141libopts-subdir: $(LIBOPTS_LDADD)
142	touch $@	# LIBOPTS_LDADD is ./libopts/libopts.la if NEED_LIBOPTS
143
144libopts/libopts.la:
145	( cd libopts && $(MAKE) libopts.la )
146
147$(srcdir)/sntp.html: $(srcdir)/sntp-opts.menu $(srcdir)/sntp-opts.texi $(srcdir)/sntp.texi $(srcdir)/version.texi
148	cd $(srcdir) && makeinfo --force --html --no-split -o sntp.html sntp.texi
149
150../libntp/libntp.a:
151	cd ../libntp && $(MAKE)
152
153libtool: $(LIBTOOL_DEPS)
154	./config.status --recheck
155
156include $(top_srcdir)/bincheck.mf
157include $(top_srcdir)/depsver.mf
158