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