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