xref: /freebsd/contrib/ntp/ntpd/Makefile.am (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1NULL=
2
3bin_PROGRAMS=	$(NTPD_DB) $(NTPDSIM_DB)
4libexec_PROGRAMS=	$(NTPD_DL) $(NTPDSIM_DL)
5sbin_PROGRAMS=	$(NTPD_DS) $(NTPDSIM_DS)
6
7noinst_LIBRARIES=	libntpd.a
8
9AM_CFLAGS = $(CFLAGS_NTP)
10AM_CFLAGS += $(NTP_HARD_CFLAGS)
11
12AM_CPPFLAGS  = $(NTP_INCS)
13AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
14AM_CPPFLAGS += $(CPPFLAGS_NTP)
15AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
16
17AM_LDFLAGS = $(LDFLAGS_NTP)
18AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
19
20# LDADD might need RESLIB and ADJLIB.
21LDADD = libntpd.a $(LIBPARSE)
22AM_YFLAGS = -d -t -r all
23
24if SAVECONFIG_ENABLED
25if NTP_CROSSCOMPILE
26CHECK_SAVECONFIG=
27else
28CHECK_SAVECONFIG= check-saveconfig check-pslsaveconfig
29endif
30else !SAVECONFIG_ENABLED
31CHECK_SAVECONFIG=
32endif
33
34#
35# VPHACK and VPHACK_AFTER are enabled on non-GNU makes (such as
36# BSD make) to work around issues specific to compiling
37# ntp_parser.y into ntp_parser.h and ntp_parser.c in a VPATH
38# configuration where we would like (for a change) the output
39# files ntp_parser.[ch] to be placed in the source directory,
40# as opposed to the build directory.  This allows a single
41# host of a flock configured with Bison to update ntp_parser.[ch]
42# used by the rest.
43#
44
45if VPATH_HACK
46VPHACK=	vphack
47VPHACK_AFTER= vphack_after
48else
49VPHACK=
50VPHACK_AFTER=
51endif
52
53vphack:
54	$(AM_V_at)test -e ntp_parser.c || ln -s $(srcdir)/ntp_parser.c .
55	$(AM_V_at)test -e ntp_parser.h || ln -s $(srcdir)/ntp_parser.h .
56
57#
58# ylwrap script which invokes Bison replaces ntp_parser.h
59# symlink with the updated file, when ntp_parser.h changes.
60# vphack_after detects this and copies the updated file to srcdir
61# and re-creates the ntp_parser.h symlink in its place.
62#
63
64vphack_after:
65	$(AM_V_at)test -L ntp_parser.h || ( \
66		mv ntp_parser.h $(srcdir)/ntp_parser.h && \
67		ln -s $(srcdir)/ntp_parser.h . \
68		)
69
70# BUILT_SOURCES which should also be in EXTRA_DIST
71B_S_DIST=			\
72	$(srcdir)/ntpd-opts.c	\
73	$(srcdir)/ntpd-opts.h	\
74	$(NULL)
75
76BUILT_SOURCES=		\
77	$(VPHACK)	\
78	$(LIBPARSE)	\
79	ntp_parser.c	\
80	ntp_parser.h	\
81	$(VPHACK_AFTER)	\
82	$(B_S_DIST)	\
83	$(NULL)
84
85man1_MANS=
86man5_MANS=	ntp.conf.5 ntp.keys.5
87man8_MANS=
88man_MANS=	ntpd.$(NTPD_MS)
89
90LDADD_NTPD_COMMON  = $(LDADD_LIBNTP) $(LIBOPTS_LDADD) $(PTHREAD_LIBS)
91LDADD_NTPD_COMMON += $(LIBM) $(LDADD_NTP) $(LSCF)
92ntpd_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_NTPD_COMMON) $(LDADD_LIBUTIL)
93ntpdsim_LDADD = $(LDADD) ../libntp/libntpsim.a $(LDADD_NTPD_COMMON)
94ntpdsim_CPPFLAGS = $(AM_CPPFLAGS) -DSIM
95check_y2k_LDADD = $(LDADD) ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(LDADD_LIBNTP) $(PTHREAD_LIBS)
96## we don't want $(LDADD) in keyword_gen_LDADD
97keyword_gen_LDADD = ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM) $(PTHREAD_LIBS)
98
99DISTCLEANFILES =		\
100	keyword-gen		\
101	config.log		\
102	$(man5_MANS)		\
103	$(man_MANS)		\
104	$(NULL)
105
106CLEANFILES =			\
107	check-psl0		\
108	check-psl1		\
109	check-psl2		\
110	check-pslsaveconfig	\
111	check-saveconfig	\
112	compsave.conf		\
113	compsave.conf+		\
114	k-g-u-submake		\
115	psl0save.conf		\
116	psl0save.conf+		\
117	psl1save.conf		\
118	psl1save.conf+		\
119	psl2save.conf		\
120	psl2save.conf+		\
121	.version		\
122	version.c		\
123	ntpd-version.c		\
124	sim-version.c		\
125	$(EXTRA_PROGRAMS)	\
126	$(NULL)
127
128EXTRA_DIST =			\
129	complete.conf.in	\
130	invoke-ntp.conf.menu	\
131	invoke-ntp.conf.texi	\
132	invoke-ntp.keys.menu	\
133	invoke-ntp.keys.texi	\
134	invoke-ntpd.menu	\
135	invoke-ntpd.texi	\
136	keyword-gen-utd		\
137	ntp.conf.5man		\
138	ntp.conf.5mdoc		\
139	ntp.conf.def		\
140	ntp.conf.man.in		\
141	ntp.conf.mdoc.in	\
142	ntp.conf.html		\
143	ntp.conf.texi		\
144	ntp.keys.5man		\
145	ntp.keys.5mdoc		\
146	ntp.keys.def		\
147	ntp.keys.man.in		\
148	ntp.keys.mdoc.in	\
149	ntp.keys.html		\
150	ntp.keys.texi		\
151	ntpd-opts.def		\
152	ntpd.1ntpdman		\
153	ntpd.1ntpdmdoc		\
154	ntpd.man.in		\
155	ntpd.mdoc.in		\
156	ntpd.html		\
157	ntpd.texi		\
158	ntpdbase-opts.def	\
159	psl0.conf		\
160	psl1.conf		\
161	psl2.conf		\
162	refclock_msfees.c	\
163	$(B_S_DIST)		\
164	$(NULL)
165
166###							Y2Kfixes
167check_PROGRAMS = @MAKE_CHECK_Y2K@
168EXTRA_PROGRAMS = check_y2k keyword-gen ntpd ntpdsim
169
170html_DATA=				\
171	$(srcdir)/ntp.conf.html		\
172	$(srcdir)/ntp.keys.html		\
173	$(srcdir)/ntpd.html		\
174	$(NULL)
175
176noinst_DATA =				\
177	$(srcdir)/invoke-ntp.conf.menu	\
178	$(srcdir)/invoke-ntp.conf.texi	\
179	$(srcdir)/invoke-ntp.keys.menu	\
180	$(srcdir)/invoke-ntp.keys.texi	\
181	$(srcdir)/invoke-ntpd.menu	\
182	$(srcdir)/invoke-ntpd.texi	\
183	$(srcdir)/ntp.conf.man.in	\
184	$(srcdir)/ntp.conf.mdoc.in	\
185	$(srcdir)/ntp.keys.man.in	\
186	$(srcdir)/ntp.keys.mdoc.in	\
187	$(srcdir)/ntpd.man.in		\
188	$(srcdir)/ntpd.mdoc.in		\
189	$(NULL)
190
191noinst_HEADERS =			\
192	declcond.h			\
193	ntp_clockdev.h			\
194	ntp_leapsec.h			\
195	$(NULL)
196
197install-data-local: install-html
198
199run_ag=		cd $(srcdir) &&	env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D	\
200		autogen -L ../sntp/include -L ../sntp/ag-tpl --writable
201
202std_def_list =							\
203	$(top_srcdir)/sntp/include/debug-opt.def		\
204	$(top_srcdir)/sntp/include/autogen-version.def		\
205	$(top_srcdir)/sntp/include/copyright.def		\
206	$(top_srcdir)/sntp/include/homerc.def			\
207	$(top_srcdir)/sntp/include/ntp.lic			\
208	$(top_srcdir)/sntp/include/version.def			\
209	$(NULL)
210
211check-local: $(MAKE_CHECK_Y2K) $(CHECK_SAVECONFIG)
212	test -z "$(MAKE_CHECK_Y2K)" || ./$(MAKE_CHECK_Y2K)
213
214# ntpd_ntpdsim_SRCS use #ifdef SIM and are included in both
215
216ntpd_ntpdsim_SRCS =		\
217	ntp_config.c		\
218	ntp_keyword.h		\
219	ntp_io.c		\
220	ntp_parser.y		\
221	ntp_scanner.c		\
222	ntp_scanner.h		\
223	ntpd.c			\
224	ntpd-opts.c		\
225	ntpd-opts.h		\
226	$(NULL)
227
228ntpd_SOURCES =			\
229	$(ntpd_ntpdsim_SRCS)	\
230	$(NULL)
231
232nodist_ntpd_SOURCES =		\
233	ntpd-version.c		\
234	$(NULL)
235
236ntpdsim_SOURCES =		\
237	$(ntpd_ntpdsim_SRCS)	\
238	ntp_prio_q.c		\
239	ntpsim.c		\
240	$(NULL)
241
242nodist_ntpdsim_SOURCES =	\
243	sim-version.c		\
244	$(NULL)
245
246# libntpd_a_SOURCES do not use #ifdef SIM
247
248libntpd_a_SOURCES =		\
249	cmd_args.c		\
250	jupiter.h		\
251	ntp_clockdev.c		\
252	ntp_control.c		\
253	ntp_crypto.c		\
254	ntp_filegen.c		\
255	ntp_leapsec.c		\
256	ntp_loopfilter.c	\
257	ntp_monitor.c		\
258	ntp_peer.c		\
259	ntp_proto.c		\
260	ntp_ppsdev.c		\
261	ntp_refclock.c		\
262	ntp_request.c		\
263	ntp_restrict.c		\
264	ntp_signd.c		\
265	ntp_timer.c		\
266	ntp_util.c		\
267	ppsapi_timepps.h	\
268	rc_cmdlength.c		\
269	refclock_acts.c		\
270	refclock_arbiter.c	\
271	refclock_arc.c		\
272	refclock_as2201.c	\
273	refclock_atom.c		\
274	refclock_bancomm.c	\
275	refclock_chronolog.c	\
276	refclock_chu.c		\
277	refclock_conf.c		\
278	refclock_datum.c	\
279	refclock_dumbclock.c	\
280	refclock_fg.c		\
281	refclock_gpsdjson.c	\
282	refclock_gpsvme.c	\
283	refclock_heath.c	\
284	refclock_hopfser.c	\
285	refclock_hopfpci.c	\
286	refclock_hpgps.c	\
287	refclock_irig.c		\
288	refclock_jjy.c		\
289	refclock_jupiter.c	\
290	refclock_leitch.c	\
291	refclock_local.c	\
292	refclock_mx4200.c	\
293	refclock_neoclock4x.c	\
294	refclock_nmea.c		\
295	refclock_oncore.c	\
296	refclock_palisade.c	\
297	refclock_palisade.h	\
298	refclock_parse.c	\
299	refclock_pcf.c		\
300	refclock_pst.c		\
301	refclock_ripencc.c	\
302	refclock_shm.c		\
303	refclock_tpro.c		\
304	refclock_true.c		\
305	refclock_tt560.c	\
306	refclock_ulink.c	\
307	refclock_wwv.c		\
308	refclock_wwvb.c		\
309	refclock_zyfer.c	\
310	refclock_tsyncpci.c	\
311	$(NULL)
312
313k-g-u-submake: keyword-gen
314	$(AM_V_at)./keyword-gen $(srcdir)/ntp_parser.h > k-g.out
315	$(AM_V_at)grep -v diff_ignore_line < k-g.out > cmp1
316	$(AM_V_at)grep -v diff_ignore_line < $(srcdir)/ntp_keyword.h > cmp2
317	$(AM_V_at)cmp cmp1 cmp2 > /dev/null || \
318		{ mv -f k-g.out $(srcdir)/ntp_keyword.h && \
319		  echo 'Generated changed ntp_keyword.h.' ;}
320	$(AM_V_at)[ ! -f k-g.out ] || \
321		{ rm k-g.out && echo 'ntp_keyword.h is up to date.' ;}
322	@rm cmp1 cmp2
323	@echo 'keyword-gen and ntp_keyword.h are up to date.' > $@
324
325$(srcdir)/keyword-gen-utd: $(srcdir)/keyword-gen.c $(srcdir)/ntp_parser.h
326	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) k-g-u-submake	# avoid explicit dependency
327	$(AM_V_at)grep diff_ignore_line $(srcdir)/ntp_keyword.h > k-g-u
328	$(AM_V_at)mv -f k-g-u $@
329
330$(srcdir)/ntp_keyword.h: $(srcdir)/keyword-gen-utd
331	@: do-nothing action to avoid default SCCS get
332	@: .h updated if needed by k-g-u-submake rule
333
334$(srcdir)/ntpd-opts.h: $(srcdir)/ntpd-opts.c
335	@: do-nothing action to avoid default SCCS get, .h built with .c
336
337$(srcdir)/ntpd-opts.c: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def $(std_def_list)
338	$(AM_V_GEN)$(run_ag) ntpd-opts.def
339
340###
341
342$(srcdir)/ntpd.1ntpdman: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def $(std_def_list)
343	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=1ntpdman -Tagman-cmd.tpl ntpd-opts.def
344
345$(srcdir)/ntpd.man.in: $(srcdir)/ntpd.1ntpdman $(top_srcdir)/sntp/scripts/mansec2subst.sed
346	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpd.1ntpdman > $(srcdir)/ntpd.man.in+
347	mv $(srcdir)/ntpd.man.in+ $(srcdir)/ntpd.man.in
348
349###
350
351$(srcdir)/ntpd.1ntpdmdoc: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def $(std_def_list)
352	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=1ntpdmdoc -Tagmdoc-cmd.tpl ntpd-opts.def
353
354$(srcdir)/ntpd.mdoc.in: $(srcdir)/ntpd.1ntpdmdoc $(top_srcdir)/sntp/scripts/mansec2subst.sed
355	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpd.1ntpdmdoc > $(srcdir)/ntpd.mdoc.in+
356	mv $(srcdir)/ntpd.mdoc.in+ $(srcdir)/ntpd.mdoc.in
357
358###
359
360ntpd.$(NTPD_MS): $(srcdir)/ntpd.$(MANTAGFMT).in $(top_builddir)/config.status
361	$(top_builddir)/config.status --file=ntpd.$(NTPD_MS)+:$(srcdir)/ntpd.$(MANTAGFMT).in
362	mv ntpd.$(NTPD_MS)+ ntpd.$(NTPD_MS)
363
364###
365
366$(srcdir)/invoke-ntp.conf.menu: $(srcdir)/invoke-ntp.conf.texi
367	@: do-nothing action to avoid default SCCS get, .menu built with .texi
368
369$(srcdir)/invoke-ntp.conf.texi: $(srcdir)/ntp.conf.def $(std_def_list)
370	$(AM_V_GEN)$(run_ag) -Tagtexi-file.tpl -DLEVEL=section ntp.conf.def
371
372$(srcdir)/invoke-ntp.keys.menu: $(srcdir)/invoke-ntp.keys.texi
373	@: do-nothing action to avoid default SCCS get, .menu built with .texi
374
375$(srcdir)/invoke-ntp.keys.texi: $(srcdir)/ntp.keys.def $(std_def_list)
376	$(AM_V_GEN)$(run_ag) -Tagtexi-file.tpl -DLEVEL=section ntp.keys.def
377
378$(srcdir)/ntp.conf.html: $(srcdir)/ntp.conf.texi $(srcdir)/invoke-ntp.conf.texi $(top_srcdir)/sntp/include/version.texi
379	cd $(srcdir) && ( makeinfo --force --html --no-split -o ntp.conf.html ntp.conf.texi || true )
380
381$(srcdir)/ntp.keys.html: $(srcdir)/ntp.keys.texi $(srcdir)/invoke-ntp.keys.texi $(top_srcdir)/sntp/include/version.texi
382	cd $(srcdir) && ( makeinfo --force --html --no-split -o ntp.keys.html ntp.keys.texi || true )
383
384$(srcdir)/ntpd.html: $(srcdir)/ntpd.texi $(srcdir)/invoke-ntpd.texi $(top_srcdir)/sntp/include/version.texi
385	cd $(srcdir) && ( makeinfo --force --html --no-split -o ntpd.html ntpd.texi || true )
386
387###
388
389$(srcdir)/ntp.conf.5man: $(srcdir)/ntp.conf.def $(std_def_list)
390	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=5man -Tagman-cmd.tpl ntp.conf.def
391
392$(srcdir)/ntp.conf.man.in: $(srcdir)/ntp.conf.5man $(top_srcdir)/sntp/scripts/mansec2subst.sed
393	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntp.conf.5man > $(srcdir)/ntp.conf.man.in+
394	mv $(srcdir)/ntp.conf.man.in+ $(srcdir)/ntp.conf.man.in
395
396###
397
398$(srcdir)/ntp.conf.5mdoc: $(srcdir)/ntp.conf.def $(std_def_list)
399	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=5mdoc -Tagmdoc-cmd.tpl ntp.conf.def
400
401$(srcdir)/ntp.conf.mdoc.in: $(srcdir)/ntp.conf.5mdoc $(top_srcdir)/sntp/scripts/mansec2subst.sed
402	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntp.conf.5mdoc > $(srcdir)/ntp.conf.mdoc.in+
403	mv $(srcdir)/ntp.conf.mdoc.in+ $(srcdir)/ntp.conf.mdoc.in
404
405###
406
407ntp.conf.5: $(srcdir)/ntp.conf.$(MANTAGFMT).in $(top_builddir)/config.status
408	$(top_builddir)/config.status --file=ntp.conf.5+:$(srcdir)/ntp.conf.$(MANTAGFMT).in
409	mv ntp.conf.5+ ntp.conf.5
410
411###
412
413$(srcdir)/ntp.keys.5man: $(srcdir)/ntp.keys.def $(std_def_list)
414	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=5man -Tagman-file.tpl ntp.keys.def
415
416$(srcdir)/ntp.keys.man.in: $(srcdir)/ntp.keys.5man $(top_srcdir)/sntp/scripts/mansec2subst.sed
417	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntp.keys.5man > $(srcdir)/ntp.keys.man.in+
418	mv $(srcdir)/ntp.keys.man.in+ $(srcdir)/ntp.keys.man.in
419
420###
421
422$(srcdir)/ntp.keys.5mdoc: $(srcdir)/ntp.keys.def $(std_def_list)
423	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=5mdoc -Tagmdoc-file.tpl ntp.keys.def
424
425$(srcdir)/ntp.keys.mdoc.in: $(srcdir)/ntp.keys.5mdoc $(top_srcdir)/sntp/scripts/mansec2subst.sed
426	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntp.keys.5mdoc > $(srcdir)/ntp.keys.mdoc.in+
427	mv $(srcdir)/ntp.keys.mdoc.in+ $(srcdir)/ntp.keys.mdoc.in
428
429###
430
431ntp.keys.5: $(srcdir)/ntp.keys.$(MANTAGFMT).in $(top_builddir)/config.status
432	$(top_builddir)/config.status --file=ntp.keys.5+:$(srcdir)/ntp.keys.$(MANTAGFMT).in
433	mv ntp.keys.5+ ntp.keys.5
434
435###
436
437$(srcdir)/invoke-ntpd.menu: $(srcdir)/invoke-ntpd.texi
438	@: do-nothing action to avoid default SCCS get, .menu built with .texi
439
440$(srcdir)/invoke-ntpd.texi: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def $(std_def_list)
441	$(AM_V_GEN)$(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section ntpd-opts.def
442	$(top_srcdir)/scripts/build/check--help $@
443
444check-saveconfig: complete.conf compsave.conf
445	-diff -u complete.conf compsave.conf
446	cmp complete.conf compsave.conf && echo stamp > $@
447
448compsave.conf: ntpd complete.conf
449	./ntpd --configfile complete.conf --saveconfigquit $@+
450	grep -v '^#' $@+ > $@
451
452check-pslsaveconfig: check-psl0 check-psl1 check-psl2
453	echo stamp > $@
454
455check-psl0: psl0.conf psl0save.conf
456	-diff -u $(srcdir)/psl0.conf psl0save.conf
457	cmp $(srcdir)/psl0.conf psl0save.conf && echo stamp > $@
458
459psl0save.conf: psl0.conf ntpd
460	./ntpd --configfile $(srcdir)/psl0.conf --saveconfigquit $@+
461	grep -v '^#' $@+ > $@
462
463check-psl1: psl1.conf psl1save.conf
464	-diff -u $(srcdir)/psl1.conf psl1save.conf
465	cmp $(srcdir)/psl1.conf psl1save.conf && echo stamp > $@
466
467psl1save.conf: psl1.conf ntpd
468	./ntpd --configfile $(srcdir)/psl1.conf --saveconfigquit $@+
469	grep -v '^#' $@+ > $@
470
471check-psl2: psl2.conf psl2save.conf
472	-diff -u $(srcdir)/psl2.conf psl2save.conf
473	cmp $(srcdir)/psl2.conf psl2save.conf && echo stamp > $@
474
475psl2save.conf: psl2.conf ntpd
476	./ntpd --configfile $(srcdir)/psl2.conf --saveconfigquit $@+
477	grep -v '^#' $@+ > $@
478
479../libntp/libntpsim.a:
480	cd ../libntp && $(MAKE) $(AM_MAKEFLAGS) libntpsim.a
481
482../libparse/libparse.a:
483	cd ../libparse && $(MAKE) $(AM_MAKEFLAGS) check-libparse
484
485ntpd-version.c: Makefile $(top_srcdir)/sntp/scm-rev
486	$(AM_V_GEN)env CSET=`cat $(top_srcdir)/sntp/scm-rev` $(top_builddir)/scripts/build/mkver ntpd
487	$(AM_V_at)mv -f version.c $@
488
489sim-version.c: Makefile $(top_srcdir)/sntp/scm-rev
490	$(AM_V_GEN)env CSET=`cat $(top_srcdir)/sntp/scm-rev` $(top_builddir)/scripts/build/mkver ntpdsim
491	$(AM_V_at)@mv -f version.c $@
492
493$(srcdir)/Makefile.am:
494	@: do-nothing
495
496include $(top_srcdir)/bincheck.mf
497include $(top_srcdir)/check-libopts.mf
498include $(top_srcdir)/check-libntp.mf
499include $(top_srcdir)/check-scm-rev.mf
500include $(top_srcdir)/depsver.mf
501include $(top_srcdir)/includes.mf
502