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