xref: /freebsd/contrib/ntp/ntpdc/Makefile.am (revision ef36b3f75658d201edb495068db5e1be49593de5)
1NULL=
2
3bin_PROGRAMS=	$(NTPDC_DB)
4libexec_PROGRAMS=	$(NTPDC_DL)
5sbin_PROGRAMS=	$(NTPDC_DS)
6
7EXTRA_PROGRAMS=	ntpdc ntpdc-layout
8EXTRA_DATA=	check-layout
9BUILT_SOURCES=	@MAKE_CHECK_LAYOUT@ ntpdc-opts.c ntpdc-opts.h
10
11AM_CFLAGS = $(CFLAGS_NTP)
12AM_CFLAGS += $(NTP_HARD_CFLAGS)
13
14AM_CPPFLAGS  = $(NTP_INCS)
15AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
16AM_CPPFLAGS += $(CPPFLAGS_NTP)
17AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
18
19AM_LDFLAGS = $(LDFLAGS_NTP)
20AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
21
22# LDADD might need RESLIB and ADJLIB
23ntpdc_LDADD  = version.o $(LIBOPTS_LDADD)
24ntpdc_LDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
25ntpdc_LDADD += $(PTHREAD_LIBS) $(EDITLINE_LIBS)
26ntpdc_LDADD += $(LDADD_NTP)
27# ntpdc-layout doesn't need any additional libraries at all
28ntpdc_layout_LDADD=
29
30DISTCLEANFILES=	.version version.c config.log $(man_MANS)
31CLEANFILES=	check-layout layout.here nl.c ntpdc-layout
32noinst_HEADERS=	ntpdc.h
33ETAGS_ARGS= 	Makefile.am
34EXTRA_DIST=			\
35	invoke-ntpdc.menu	\
36	invoke-ntpdc.texi	\
37	layout.std		\
38	nl_in.c			\
39	nl.pl			\
40	ntpdc-opts.def		\
41	ntpdc.1ntpdcman		\
42	ntpdc.1ntpdcmdoc	\
43	ntpdc.man.in		\
44	ntpdc.mdoc.in		\
45	ntpdc.html		\
46	ntpdc.texi		\
47	$(NULL)
48
49man1_MANS=
50man8_MANS=
51man_MANS=	ntpdc.$(NTPDC_MS)
52
53## HMS: Real Soon Now...
54##info_TEXINFOS=	ntpdc.texi
55##ntpdc_TEXINFOS=	ntpdc-opts.texi
56
57html_DATA=				\
58	$(srcdir)/ntpdc.html		\
59	$(NULL)
60
61noinst_DATA=				\
62	$(srcdir)/invoke-ntpdc.menu	\
63	$(srcdir)/invoke-ntpdc.texi	\
64	$(srcdir)/ntpdc.man.in		\
65	$(srcdir)/ntpdc.mdoc.in		\
66	$(NULL)
67
68install-data-local: install-html
69
70run_ag=		cd $(srcdir) &&	env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D	\
71		autogen -L ../sntp/include -L ../sntp/ag-tpl --writable
72
73std_def_list =							\
74	$(top_srcdir)/sntp/include/debug-opt.def		\
75	$(top_srcdir)/sntp/include/autogen-version.def 		\
76	$(top_srcdir)/sntp/include/copyright.def 		\
77	$(top_srcdir)/sntp/include/homerc.def 			\
78	$(top_srcdir)/sntp/include/ntp.lic			\
79	$(top_srcdir)/sntp/include/version.def			\
80	$(NULL)
81
82$(srcdir)/ntpdc-opts.h: $(srcdir)/ntpdc-opts.c
83	@: do-nothing action to avoid default SCCS get, .h built with .c
84
85$(srcdir)/ntpdc-opts.c: $(srcdir)/ntpdc-opts.def $(std_def_list)
86	$(run_ag) ntpdc-opts.def
87
88###
89
90$(srcdir)/ntpdc.1ntpdcman: $(srcdir)/ntpdc-opts.def $(std_def_list)
91	$(run_ag) -DMAN_SECTION=1ntpdcman -Tagman-cmd.tpl ntpdc-opts.def
92
93$(srcdir)/ntpdc.man.in: $(srcdir)/ntpdc.1ntpdcman $(top_srcdir)/sntp/scripts/mansec2subst.sed
94	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpdc.1ntpdcman > $(srcdir)/ntpdc.man.in+
95	mv $(srcdir)/ntpdc.man.in+ $(srcdir)/ntpdc.man.in
96
97###
98
99$(srcdir)/ntpdc.1ntpdcmdoc: $(srcdir)/ntpdc-opts.def $(std_def_list)
100	$(run_ag) -DMAN_SECTION=1ntpdcmdoc -Tagmdoc-cmd.tpl ntpdc-opts.def
101
102$(srcdir)/ntpdc.mdoc.in: $(srcdir)/ntpdc.1ntpdcmdoc $(top_srcdir)/sntp/scripts/mansec2subst.sed
103	sed -f $(top_srcdir)/sntp/scripts/mansec2subst.sed $(srcdir)/ntpdc.1ntpdcmdoc > $(srcdir)/ntpdc.mdoc.in+
104	mv $(srcdir)/ntpdc.mdoc.in+ $(srcdir)/ntpdc.mdoc.in
105
106###
107
108ntpdc.$(NTPDC_MS): $(srcdir)/ntpdc.$(MANTAGFMT).in $(top_builddir)/config.status
109	$(top_builddir)/config.status --file=ntpdc.$(NTPDC_MS)+:$(srcdir)/ntpdc.$(MANTAGFMT).in
110	mv ntpdc.$(NTPDC_MS)+ ntpdc.$(NTPDC_MS)
111
112###
113
114$(srcdir)/invoke-ntpdc.menu: $(srcdir)/invoke-ntpdc.texi
115	@: do-nothing action to avoid default SCCS get, .menu built with .texi
116
117$(srcdir)/invoke-ntpdc.texi: $(srcdir)/ntpdc-opts.def $(std_def_list)
118	$(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section ntpdc-opts.def
119	$(top_srcdir)/scripts/build/check--help $@
120
121$(srcdir)/ntpdc.html: $(srcdir)/invoke-ntpdc.menu $(srcdir)/invoke-ntpdc.texi $(srcdir)/ntpdc.texi $(top_srcdir)/sntp/include/version.texi
122	cd $(srcdir) && ( makeinfo --force --html --no-split -I ../sntp -o ntpdc.html ntpdc.texi || true )
123
124ntpdc_SOURCES = ntpdc.c ntpdc_ops.c ntpdc-opts.c ntpdc-opts.h
125
126ntpdc-layout.o: nl.c
127
128layout.here: ntpdc-layout
129	./ntpdc-layout > $@
130
131check-layout: ntpdc-layout $(srcdir)/layout.std layout.here
132	cmp $(srcdir)/layout.std layout.here && echo stamp > $@
133
134$(PROGRAMS): version.o
135
136$(top_srcdir)/sntp/scm-rev:
137	cd ../sntp && $(MAKE) $(AM_MAKEFLAGS) check-scm-rev
138
139version.c: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/sntp/scm-rev
140	env CSET=`cat $(top_srcdir)/sntp/scm-rev` $(top_builddir)/scripts/build/mkver ntpdc
141
142version.o: version.c
143	env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
144
145# I ran nl_in.c (attached, to be installed into ntpdc) through
146# $(CC) -E nl_in.c | nl.pl > nl.c
147nl.c: nl_in.c nl.pl Makefile.am ../config.h ../include/ntp_request.h ntpdc.h
148	$(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c
149
150include $(top_srcdir)/bincheck.mf
151include $(top_srcdir)/check-libopts.mf
152include $(top_srcdir)/sntp/check-libntp.mf
153include $(top_srcdir)/depsver.mf
154include $(top_srcdir)/includes.mf
155