xref: /freebsd/contrib/ntp/sntp/Makefile.am (revision e0c4386e)
1## Makefile.am for JMK's SNTP, by Harlan Stenn
2
3ACLOCAL_AMFLAGS = -I m4 -I libevent/m4 -I libopts/m4
4
5NULL =
6
7AM_CFLAGS  = $(CFLAGS_NTP)
8AM_CFLAGS += $(NTP_HARD_CFLAGS)
9
10AM_CPPFLAGS  = $(SNTP_INCS)
11AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
12AM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
13AM_CPPFLAGS += $(CPPFLAGS_NTP)
14AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
15
16AM_LDFLAGS  = $(LDFLAGS_NTP)
17AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
18
19LDADD  = libsntp.a
20LDADD += $(LIBOPTS_LDADD)
21LDADD += $(LDADD_LIBEVENT)
22LDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
23LDADD += $(PTHREAD_LIBS)
24LDADD += $(LDADD_NTP)
25
26run_ag =	cd $(srcdir) &&	env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D	\
27		autogen -L include -L ag-tpl --writable
28std_def_list =						\
29	$(srcdir)/include/debug-opt.def			\
30	$(srcdir)/include/autogen-version.def 		\
31	$(srcdir)/include/copyright.def 		\
32	$(srcdir)/include/homerc.def 			\
33	$(srcdir)/include/ntp.lic 			\
34	$(srcdir)/include/version.def			\
35	$(NULL)
36
37EXTRA_PROGRAMS = sntp
38
39bin_PROGRAMS =		@SNTP_DB@
40libexec_PROGRAMS =	@SNTP_DL@
41sbin_PROGRAMS =		@SNTP_DS@
42
43SUBDIRS = include scripts unity
44DIST_FAIL =
45
46if BUILD_LIBEVENT
47SUBDIRS += libevent
48else
49DIST_FAIL += "--enable-local-libevent"
50endif
51
52if NEED_LIBOPTS
53SUBDIRS += libopts
54endif
55
56if BUILD_SNTP
57noinst_LIBRARIES = libsntp.a
58SUBDIRS += tests
59endif
60
61libsntp_a_SOURCES =		\
62	crypto.c		\
63	kod_management.c	\
64	log.c			\
65	main.c			\
66	networking.c		\
67	sntp-opts.c		\
68	utilities.c		\
69	$(NULL)
70
71sntp_SOURCES =			\
72	sntp.c			\
73	$(NULL)
74
75nodist_sntp_SOURCES =		\
76	version.c		\
77	$(NULL)
78
79noinst_HEADERS =		\
80	crypto.h		\
81	data_formats.h		\
82	kod_management.h	\
83	log.h			\
84	main.h			\
85	networking.h		\
86	sntp-opts.h		\
87	utilities.h		\
88	$(NULL)
89
90DISTCLEANFILES =			\
91	config.log			\
92	$(man_MANS)			\
93	$(NULL)
94
95EXTRA_DIST =				\
96	$(srcdir)/COPYRIGHT		\
97	ag-tpl				\
98	deps-ver			\
99	harden				\
100	invoke-sntp.menu		\
101	invoke-sntp.texi		\
102	@NTP_FORCE_LIBEVENT_DIST@	\
103	libpkgver 			\
104	loc				\
105	sntp-opts.def			\
106	sntp.1sntpman			\
107	sntp.1sntpmdoc			\
108	sntp.man.in			\
109	sntp.mdoc.in			\
110	sntp.html			\
111	sntp.texi			\
112	unity/auto			\
113	$(srcdir)/scm-rev		\
114	$(srcdir)/m4/version.m4		\
115	$(NULL)
116
117BUILT_SOURCES =				\
118	$(srcdir)/COPYRIGHT		\
119	libtool				\
120	$(srcdir)/sntp-opts.c		\
121	$(srcdir)/sntp-opts.h		\
122	$(srcdir)/include/version.def	\
123	$(srcdir)/m4/version.m4		\
124	$(srcdir)/include/version.texi	\
125	$(NULL)
126
127CLEANFILES =				\
128	check-COPYRIGHT-submake		\
129	.version			\
130	version.c			\
131	$(NULL)
132
133man1_MANS=
134man8_MANS=
135man_MANS=	sntp.$(SNTP_MS)
136
137## HMS: Real Soon Now...
138##info_TEXINFOS=	sntp.texi
139##sntp_TEXINFOS=	invoke-sntp.texi
140
141html_DATA=				\
142	$(srcdir)/sntp.html		\
143	$(NULL)
144
145noinst_DATA=				\
146	$(srcdir)/invoke-sntp.menu	\
147	$(srcdir)/invoke-sntp.texi	\
148	$(srcdir)/sntp.man.in		\
149	$(srcdir)/sntp.mdoc.in		\
150	$(NULL)
151
152install-data-local: install-html
153
154FRC:
155	@: FRC "force" depends on nothing and is not a file, so is always
156	@: out-of-date causing targets which depend on it to also be
157	@: outdated so their rules to fire each time they are built.
158
159## We probably need something about libevent, too
160## That is probably not possible since LDADD_LIBEVENT may be
161## non-file "-levent_core".
162
163version.c: Makefile $(srcdir)/scm-rev
164	$(AM_V_GEN)env CSET=`cat $(srcdir)/scm-rev` $(top_builddir)/../scripts/build/mkver sntp
165
166check-autogen-version.def: FRC
167	@cd $(srcdir)							\
168	&& test -r ../include/autogen-version.def			\
169	&& ( if cmp -s ../include/autogen-version.def autogen-version.def; \
170	   then : ;							\
171	   else cp ../include/autogen-version.def autogen-version.def;	 \
172		echo "Installing new sntp/autogen-version.def file";	\
173	   fi )
174
175$(srcdir)/autogen-version.def:
176	$(MAKE) $(AM_MAKEFLAGS) check-autogen-version.def
177
178built-sources-only: $(BUILT_SOURCES)
179	@: do-nothing action to avoid default SCCS get
180
181## HMS: The next bit is still suboptimal.  We'll get an error if this is
182## a bk repo and srcdir or scm-rev is unwritable.
183
184check-scm-rev: $(srcdir)/scm-rev
185	@: do-nothing
186
187$(srcdir)/scm-rev: FRC
188	$(AM_V_at)-bk root $(srcdir) >/dev/null 2>&1 &&			\
189	    cd $(srcdir)/.. &&						\
190	    x=`bk -R prs -hr+ -nd:I: ChangeSet` &&			\
191	    y=`cat sntp/scm-rev 2>/dev/null` || true &&			\
192	    case "$$x" in ''|$$y) ;; *) echo $$x > sntp/scm-rev ;; esac
193
194$(srcdir)/m4/version.m4: $(srcdir)/../packageinfo.sh
195	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
196	../scripts/build/genver m4/version.m4
197
198$(srcdir)/include/version.def: $(srcdir)/../packageinfo.sh
199	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
200	../scripts/build/genver include/version.def
201
202$(srcdir)/include/version.texi: $(srcdir)/../packageinfo.sh
203	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
204	../scripts/build/genver include/version.texi
205
206$(srcdir)/../COPYRIGHT:
207	cd .. && $(MAKE) $(AM_MAKEFLAGS) COPYRIGHT-please
208
209check-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT
210	@cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT	\
211	 || { cp $(srcdir)/../COPYRIGHT $(srcdir)		\
212	      && echo 'updated sntp/COPYRIGHT installed' ;}
213	@echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@
214
215check-COPYRIGHT: FRC
216	[ ! -r $(srcdir)/../COPYRIGHT ]					\
217	|| [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ]	\
218	|| $(MAKE) $(AM_MAKEFLAGS) check-COPYRIGHT-submake
219
220$(srcdir)/COPYRIGHT: check-COPYRIGHT
221	@: do-nothing action to prevent any default
222
223$(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
224	@: do-nothing action to avoid default SCCS get, .h built with .c
225
226$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(std_def_list)
227	$(AM_V_GEN)$(run_ag) sntp-opts.def
228
229###
230
231$(srcdir)/sntp.1sntpman: $(srcdir)/sntp-opts.def $(std_def_list)
232	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=1sntpman -Tagman-cmd.tpl sntp-opts.def
233
234$(srcdir)/sntp.man.in: $(srcdir)/sntp.1sntpman $(srcdir)/scripts/mansec2subst.sed
235	sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpman > $(srcdir)/sntp.man.in+
236	mv $(srcdir)/sntp.man.in+ $(srcdir)/sntp.man.in
237
238###
239
240$(srcdir)/sntp.1sntpmdoc: $(srcdir)/sntp-opts.def $(std_def_list)
241	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=1sntpmdoc -Tagmdoc-cmd.tpl sntp-opts.def
242
243$(srcdir)/sntp.mdoc.in: $(srcdir)/sntp.1sntpmdoc $(srcdir)/scripts/mansec2subst.sed
244	sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpmdoc > $(srcdir)/sntp.mdoc.in+
245	mv $(srcdir)/sntp.mdoc.in+ $(srcdir)/sntp.mdoc.in
246
247###
248
249sntp.$(SNTP_MS): $(srcdir)/sntp.$(MANTAGFMT).in $(top_builddir)/config.status
250	$(top_builddir)/config.status --file=sntp.$(SNTP_MS)+:$(srcdir)/sntp.$(MANTAGFMT).in
251	mv sntp.$(SNTP_MS)+ sntp.$(SNTP_MS)
252
253###
254
255$(srcdir)/invoke-sntp.menu: $(srcdir)/invoke-sntp.texi
256	@: do-nothing action to avoid default SCCS get, .menu built with .texi
257
258$(srcdir)/invoke-sntp.texi: $(srcdir)/sntp-opts.def $(std_def_list)
259	$(AM_V_GEN)$(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section sntp-opts.def
260	$(top_srcdir)/../scripts/build/check--help $@
261
262$(srcdir)/sntp.html: $(srcdir)/invoke-sntp.texi $(srcdir)/sntp.texi $(srcdir)/include/version.texi
263	cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
264
265libtool: $(LIBTOOL_DEPS)
266	./config.status --recheck
267
268# HMS: libevent/ is a target if it's in EXTRA_DIST via NTP_FORCE_LIBEVENT_DIST.
269# Note that libevent/ is already in DIST_SUBDIRS (implicit in Makefile.am
270# but explicit in Makefile.in).  This check doesn't help with distclean.
271libevent: distdir-pre-check
272
273# HMS: Stops the build for gmake or pmake
274distdir-pre-check:
275	case "$(DIST_FAIL)" in	\
276	 '')  ;;		\
277	 *) $(error re-run configure adding $(DIST_FAIL) if you want to make a distribution.);	\
278	    echo "re-run configure adding $(DIST_FAIL) if you want to make a distribution.";	\
279	    exit 1 ;;		\
280	esac
281
282include $(top_srcdir)/bincheck.mf
283include $(top_srcdir)/check-libntp.mf
284include $(top_srcdir)/check-libopts.mf
285include $(top_srcdir)/depsver.mf
286include $(top_srcdir)/includes.mf
287