]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/sntp/Makefile.am
Upgrade NTP to 4.2.8p4.
[FreeBSD/releng/10.2.git] / contrib / ntp / sntp / Makefile.am
1 ## Makefile.am for JMK's SNTP, by Harlan Stenn
2
3 ACLOCAL_AMFLAGS = -I m4 -I libevent/m4 -I libopts/m4
4
5 NULL =
6
7 AM_CFLAGS = $(CFLAGS_NTP)
8
9 AM_CPPFLAGS  = $(SNTP_INCS)
10 AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
11 AM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
12 AM_CPPFLAGS += $(CPPFLAGS_NTP)
13
14 AM_LDFLAGS = $(LDFLAGS_NTP)
15
16 LDADD  = version.o
17 LDADD += libsntp.a
18 LDADD += $(LIBOPTS_LDADD)
19 LDADD += $(LDADD_LIBEVENT)
20 LDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
21 LDADD += $(PTHREAD_LIBS)
22 LDADD += $(LDADD_NTP)
23
24 run_ag =        cd $(srcdir) && env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D  \
25                 autogen -L include -L ag-tpl --writable
26 std_def_list =                                          \
27         $(srcdir)/include/debug-opt.def                 \
28         $(srcdir)/include/autogen-version.def           \
29         $(srcdir)/include/copyright.def                 \
30         $(srcdir)/include/homerc.def                    \
31         $(srcdir)/include/ntp.lic                       \
32         $(srcdir)/include/version.def                   \
33         $(NULL)
34
35 EXTRA_PROGRAMS = sntp
36
37 bin_PROGRAMS =          @SNTP_DB@
38 libexec_PROGRAMS =      @SNTP_DL@
39 sbin_PROGRAMS =         @SNTP_DS@
40
41 SUBDIRS = include scripts unity
42 DIST_FAIL =
43
44 if BUILD_LIBEVENT
45 SUBDIRS += libevent
46 else
47 DIST_FAIL += "--enable-local-libevent"
48 endif
49
50 if NEED_LIBOPTS
51 SUBDIRS += libopts
52 endif
53
54 if BUILD_SNTP
55 noinst_LIBRARIES = libsntp.a
56 SUBDIRS += tests
57 endif
58
59 libsntp_a_SOURCES =             \
60         crypto.c                \
61         kod_management.c        \
62         log.c                   \
63         main.c                  \
64         networking.c            \
65         sntp-opts.c             \
66         utilities.c             \
67         $(NULL)
68
69 sntp_SOURCES =          \
70         sntp.c          \
71         $(NULL)
72
73 noinst_HEADERS =                \
74         crypto.h                \
75         data_formats.h          \
76         kod_management.h        \
77         log.h                   \
78         main.h                  \
79         networking.h            \
80         sntp-opts.h             \
81         utilities.h             \
82         $(NULL)
83
84 DISTCLEANFILES =                        \
85         .version                        \
86         version.c                       \
87         config.log                      \
88         $(man_MANS)                     \
89         $(NULL)
90
91 EXTRA_DIST =                            \
92         $(srcdir)/COPYRIGHT             \
93         ag-tpl                          \
94         deps-ver                        \
95         invoke-sntp.menu                \
96         invoke-sntp.texi                \
97         @NTP_FORCE_LIBEVENT_DIST@       \
98         libpkgver                       \
99         loc                             \
100         sntp-opts.def                   \
101         sntp.1sntpman                   \
102         sntp.1sntpmdoc                  \
103         sntp.man.in                     \
104         sntp.mdoc.in                    \
105         sntp.html                       \
106         sntp.texi                       \
107         unity/auto                      \
108         $(srcdir)/scm-rev               \
109         $(srcdir)/m4/version.m4         \
110         $(NULL)
111
112 BUILT_SOURCES =                         \
113         $(srcdir)/COPYRIGHT             \
114         libtool                         \
115         $(srcdir)/sntp-opts.c           \
116         $(srcdir)/sntp-opts.h           \
117         check-scm-rev                   \
118         $(srcdir)/include/version.def   \
119         $(srcdir)/m4/version.m4         \
120         $(srcdir)/include/version.texi  \
121         $(NULL)
122
123 CLEANFILES =                            \
124         built-sources-only              \
125         check-COPYRIGHT-submake         \
126         $(NULL)
127
128 man1_MANS=
129 man8_MANS=
130 man_MANS=       sntp.$(SNTP_MS)
131
132 ## HMS: Real Soon Now...
133 ##info_TEXINFOS=        sntp.texi
134 ##sntp_TEXINFOS=        invoke-sntp.texi
135
136 html_DATA=                              \
137         $(srcdir)/sntp.html             \
138         $(NULL)
139
140 noinst_DATA=                            \
141         $(srcdir)/invoke-sntp.menu      \
142         $(srcdir)/invoke-sntp.texi      \
143         $(srcdir)/sntp.man.in           \
144         $(srcdir)/sntp.mdoc.in          \
145         $(NULL)
146
147 install-data-local: install-html
148
149 FRC:
150         @: do-nothing action to prevent default SCCS get
151         @: FRC "force" depends on nothing and is not a file, so is
152         @: always out-of-date causing targets which depend on it to
153         @: similarly always be outdated causing their rules to fire
154         @: each time they or a dependent is built.
155
156 $(PROGRAMS): version.o
157
158 ## We probably need something about libevent, too
159 ## That is probably not possible since LDADD_LIBEVENT may be
160 ## non-file "-levent_core".
161
162 version.c: $(sntp_OBJECTS) ../libntp/libntp.a Makefile $(srcdir)/scm-rev
163         env CSET=`cat $(srcdir)/scm-rev` $(top_builddir)/../scripts/build/mkver sntp
164
165 version.o: version.c
166         env CCACHE_DISABLE=1 $(COMPILE) -c version.c -o version.o
167
168 check-autogen-version.def: FRC
169         @cd $(srcdir)                                                   \
170         && test -r ../include/autogen-version.def                       \
171         && ( if cmp -s ../include/autogen-version.def autogen-version.def; \
172            then : ;                                                     \
173            else cp ../include/autogen-version.def autogen-version.def;   \
174                 echo "Installing new sntp/autogen-version.def file";    \
175            fi )
176
177 $(srcdir)/autogen-version.def:
178         $(MAKE) $(AM_MAKEFLAGS) check-autogen-version.def
179
180 built-sources-only: $(BUILT_SOURCES)
181         @: do-nothing action to avoid default SCCS get
182
183 ## HMS: The next bit is still suboptimal.  We'll get an error if this is
184 ## a bk repo and srcdir or scm-rev is unwritable.
185
186 check-scm-rev: $(srcdir)/scm-rev
187         @: do-nothing
188
189 $(srcdir)/scm-rev:
190         -test -r $(srcdir)/../SCCS/s.ChangeSet &&               \
191             (bk version) >/dev/null 2>&1 &&                     \
192             cd $(srcdir)/.. &&                                  \
193             x=`bk -R prs -hr+ -nd:I: ChangeSet` &&              \
194             y=`cat sntp/scm-rev 2>/dev/null` || true &&         \
195             case "$$x" in ''|$$y) ;; *) echo $$x > sntp/scm-rev ;; esac
196
197 $(srcdir)/m4/version.m4: $(srcdir)/../packageinfo.sh
198         TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
199         ../scripts/build/genver m4/version.m4
200
201 $(srcdir)/include/version.def: $(srcdir)/../packageinfo.sh
202         TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
203         ../scripts/build/genver include/version.def
204
205 $(srcdir)/include/version.texi: $(srcdir)/../packageinfo.sh
206         TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
207         ../scripts/build/genver include/version.texi
208
209 $(srcdir)/../COPYRIGHT:
210         cd .. && $(MAKE) $(AM_MAKEFLAGS) COPYRIGHT-please
211
212 check-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT
213         @cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT      \
214          || { cp $(srcdir)/../COPYRIGHT $(srcdir)               \
215               && echo 'updated sntp/COPYRIGHT installed' ;}
216         @echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@
217
218 check-COPYRIGHT: FRC
219         [ ! -r $(srcdir)/../COPYRIGHT ]                                 \
220         || [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ]       \
221         || $(MAKE) $(AM_MAKEFLAGS) check-COPYRIGHT-submake
222
223 $(srcdir)/COPYRIGHT: check-COPYRIGHT
224         @: do-nothing action to prevent any default
225
226 $(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
227         @: do-nothing action to avoid default SCCS get, .h built with .c
228
229 $(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(std_def_list)
230         $(run_ag) sntp-opts.def
231
232 ###
233
234 $(srcdir)/sntp.1sntpman: $(srcdir)/sntp-opts.def $(std_def_list)
235         $(run_ag) -DMAN_SECTION=1sntpman -Tagman-cmd.tpl sntp-opts.def
236
237 $(srcdir)/sntp.man.in: $(srcdir)/sntp.1sntpman $(srcdir)/scripts/mansec2subst.sed
238         sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpman > $(srcdir)/sntp.man.in+
239         mv $(srcdir)/sntp.man.in+ $(srcdir)/sntp.man.in
240
241 ###
242
243 $(srcdir)/sntp.1sntpmdoc: $(srcdir)/sntp-opts.def $(std_def_list)
244         $(run_ag) -DMAN_SECTION=1sntpmdoc -Tagmdoc-cmd.tpl sntp-opts.def
245
246 $(srcdir)/sntp.mdoc.in: $(srcdir)/sntp.1sntpmdoc $(srcdir)/scripts/mansec2subst.sed
247         sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpmdoc > $(srcdir)/sntp.mdoc.in+
248         mv $(srcdir)/sntp.mdoc.in+ $(srcdir)/sntp.mdoc.in
249
250 ###
251
252 sntp.$(SNTP_MS): $(srcdir)/sntp.$(MANTAGFMT).in $(top_builddir)/config.status
253         $(top_builddir)/config.status --file=sntp.$(SNTP_MS)+:$(srcdir)/sntp.$(MANTAGFMT).in
254         mv sntp.$(SNTP_MS)+ sntp.$(SNTP_MS)
255
256 ###
257
258 $(srcdir)/invoke-sntp.menu: $(srcdir)/invoke-sntp.texi
259         @: do-nothing action to avoid default SCCS get, .menu built with .texi
260
261 $(srcdir)/invoke-sntp.texi: $(srcdir)/sntp-opts.def $(std_def_list)
262         $(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section sntp-opts.def
263         $(top_srcdir)/../scripts/build/check--help $@
264
265 $(srcdir)/sntp.html: $(srcdir)/invoke-sntp.menu $(srcdir)/invoke-sntp.texi $(srcdir)/sntp.texi $(srcdir)/include/version.texi
266         cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
267
268 libtool: $(LIBTOOL_DEPS)
269         ./config.status --recheck
270
271 # HMS: libevent/ is a target if it's in EXTRA_DIST via NTP_FORCE_LIBEVENT_DIST.
272 # Note that libevent/ is already in DIST_SUBDIRS (implicit in Makefile.am
273 # but explicit in Makefile.in).  This check doesn't help with distclean.
274 libevent: distdir-pre-check
275
276 # HMS: Stops the build for gmake or pmake
277 distdir-pre-check:
278         case "$(DIST_FAIL)" in  \
279          '')  ;;                \
280          *) $(error re-run configure adding $(DIST_FAIL) if you want to make a distribution.);  \
281             echo "re-run configure adding $(DIST_FAIL) if you want to make a distribution.";    \
282             exit 1 ;;           \
283         esac
284
285 include $(top_srcdir)/bincheck.mf
286 include $(top_srcdir)/check-libntp.mf
287 include $(top_srcdir)/check-libopts.mf
288 include $(top_srcdir)/depsver.mf
289 include $(top_srcdir)/includes.mf