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