xref: /freebsd/contrib/ntp/ntpq/Makefile.am (revision 41059135ce931c0f1014a999ffabc6bc470ce856)
1NULL=
2
3EXTRA_PROGRAMS=	ntpq
4bin_PROGRAMS=	$(NTPQ_DB)
5libexec_PROGRAMS=	$(NTPQ_DL)
6sbin_PROGRAMS=	$(NTPQ_DS)
7
8AM_CFLAGS = $(CFLAGS_NTP)
9AM_CFLAGS += $(NTP_HARD_CFLAGS)
10
11AM_CPPFLAGS  = $(NTP_INCS)
12AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
13AM_CPPFLAGS += $(CPPFLAGS_NTP)
14AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
15
16AM_LDFLAGS  = $(LDFLAGS_NTP)
17AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
18
19# LDADD might need RESLIB and ADJLIB
20ntpq_LDADD  = version.o $(LIBOPTS_LDADD)
21ntpq_LDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
22ntpq_LDADD += $(PTHREAD_LIBS) $(EDITLINE_LIBS)
23ntpq_LDADD += $(LDADD_NTP)
24noinst_HEADERS=	ntpq.h
25noinst_LIBRARIES=	libntpq.a
26libntpq_a_CFLAGS=	-DNO_MAIN_ALLOWED -DBUILD_AS_LIB
27CLEANFILES=
28DISTCLEANFILES=	.version version.c config.log $(man_MANS)
29ETAGS_ARGS=	Makefile.am
30EXTRA_DIST=			\
31	invoke-ntpq.menu	\
32	invoke-ntpq.texi	\
33	ntpq-opts.def		\
34	ntpq.1ntpqman		\
35	ntpq.1ntpqmdoc		\
36	ntpq.man.in		\
37	ntpq.mdoc.in		\
38	ntpq.html		\
39	ntpq.texi		\
40	$(NULL)
41
42BUILT_SOURCES=	ntpq-opts.c ntpq-opts.h
43
44html_DATA=				\
45	$(srcdir)/ntpq.html		\
46	$(NULL)
47
48noinst_DATA=				\
49	$(srcdir)/invoke-ntpq.menu	\
50	$(srcdir)/invoke-ntpq.texi	\
51	$(srcdir)/ntpq.man.in		\
52	$(srcdir)/ntpq.mdoc.in		\
53	$(NULL)
54
55install-data-local: install-html
56
57man1_MANS=
58man8_MANS=
59man_MANS=	ntpq.$(NTPQ_MS)
60
61run_ag=		cd $(srcdir) &&	env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D	\
62		autogen -L ../sntp/include -L ../sntp/ag-tpl --writable
63std_def_list =							\
64	$(top_srcdir)/sntp/include/debug-opt.def		\
65	$(top_srcdir)/sntp/include/autogen-version.def 		\
66	$(top_srcdir)/sntp/include/copyright.def 		\
67	$(top_srcdir)/sntp/include/homerc.def 			\
68	$(top_srcdir)/sntp/include/ntp.lic			\
69	$(top_srcdir)/sntp/include/version.def			\
70	$(NULL)
71ntpq_SOURCES=	ntpq.c ntpq-subs.c ntpq-opts.c ntpq-opts.h
72
73libntpq_a_SOURCES =	libntpq.c libntpq.h libntpq_subs.c
74
75$(srcdir)/ntpq-opts.h: $(srcdir)/ntpq-opts.c
76	@: do-nothing action to avoid default SCCS get, .h built with .c
77
78$(srcdir)/ntpq-opts.c: $(srcdir)/ntpq-opts.def $(std_def_list)
79	$(run_ag) ntpq-opts.def
80
81###
82
83$(srcdir)/ntpq.1ntpqman: $(srcdir)/ntpq-opts.def $(std_def_list)
84	$(run_ag) -DMAN_SECTION=1ntpqman -Tagman-cmd.tpl ntpq-opts.def
85
86$(srcdir)/ntpq.man.in: $(srcdir)/ntpq.1ntpqman $(top_srcdir)/sntp/scripts/mansec2subst.sed
87	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpq.1ntpqman > $(srcdir)/ntpq.man.in+
88	mv $(srcdir)/ntpq.man.in+ $(srcdir)/ntpq.man.in
89
90###
91
92$(srcdir)/ntpq.1ntpqmdoc: $(srcdir)/ntpq-opts.def $(std_def_list)
93	$(run_ag) -DMAN_SECTION=1ntpqmdoc -Tagmdoc-cmd.tpl ntpq-opts.def
94
95$(srcdir)/ntpq.mdoc.in: $(srcdir)/ntpq.1ntpqmdoc $(top_srcdir)/sntp/scripts/mansec2subst.sed
96	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpq.1ntpqmdoc > $(srcdir)/ntpq.mdoc.in+
97	mv $(srcdir)/ntpq.mdoc.in+ $(srcdir)/ntpq.mdoc.in
98
99###
100
101ntpq.$(NTPQ_MS): $(srcdir)/ntpq.$(MANTAGFMT).in $(top_builddir)/config.status
102	$(top_builddir)/config.status --file=ntpq.$(NTPQ_MS)+:$(srcdir)/ntpq.$(MANTAGFMT).in
103	mv ntpq.$(NTPQ_MS)+ ntpq.$(NTPQ_MS)
104
105###
106
107$(srcdir)/invoke-ntpq.menu: $(srcdir)/invoke-ntpq.texi
108	@: do-nothing action to avoid default SCCS get, .menu built with .texi
109
110$(srcdir)/invoke-ntpq.texi: $(srcdir)/ntpq-opts.def $(std_def_list)
111	$(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section ntpq-opts.def
112	$(top_srcdir)/scripts/build/check--help $@
113
114$(srcdir)/ntpq.html: $(srcdir)/ntpq.texi $(top_srcdir)/sntp/include/version.texi
115	cd $(srcdir) && ( makeinfo --force --html --no-split -o ntpq.html ntpq.texi || true )
116
117###
118
119$(PROGRAMS): version.o
120
121$(top_srcdir)/sntp/scm-rev:
122	cd ../sntp && $(MAKE) $(AM_MAKEFLAGS) check-scm-rev
123
124version.c: $(ntpq_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/scm-rev
125	env CSET=`cat $(top_srcdir)/sntp/scm-rev` $(top_builddir)/scripts/build/mkver ntpq
126
127version.o: version.c
128	env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
129
130include $(top_srcdir)/bincheck.mf
131include $(top_srcdir)/check-libopts.mf
132include $(top_srcdir)/sntp/check-libntp.mf
133include $(top_srcdir)/depsver.mf
134include $(top_srcdir)/includes.mf
135