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