xref: /freebsd/contrib/ntp/sntp/Makefile.am (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
12b15cb3dSCy Schubert## Makefile.am for JMK's SNTP, by Harlan Stenn
29c2daa00SOllivier Robert
32b15cb3dSCy SchubertACLOCAL_AMFLAGS = -I m4 -I libevent/m4 -I libopts/m4
49c2daa00SOllivier Robert
5ea906c41SOllivier RobertNULL =
69c2daa00SOllivier Robert
72b15cb3dSCy SchubertAM_CFLAGS  = $(CFLAGS_NTP)
8f0574f5cSXin LIAM_CFLAGS += $(NTP_HARD_CFLAGS)
9ea906c41SOllivier Robert
102b15cb3dSCy SchubertAM_CPPFLAGS  = $(SNTP_INCS)
112b15cb3dSCy SchubertAM_CPPFLAGS += $(LIBOPTS_CFLAGS)
122b15cb3dSCy SchubertAM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
132b15cb3dSCy SchubertAM_CPPFLAGS += $(CPPFLAGS_NTP)
14f0574f5cSXin LIAM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
152b15cb3dSCy Schubert
162b15cb3dSCy SchubertAM_LDFLAGS  = $(LDFLAGS_NTP)
17f0574f5cSXin LIAM_LDFLAGS += $(NTP_HARD_LDFLAGS)
182b15cb3dSCy Schubert
19a466cc55SCy SchubertLDADD  = libsntp.a
202b15cb3dSCy SchubertLDADD += $(LIBOPTS_LDADD)
212b15cb3dSCy SchubertLDADD += $(LDADD_LIBEVENT)
222b15cb3dSCy SchubertLDADD += ../libntp/libntp.a $(LDADD_LIBNTP) $(LIBM)
232b15cb3dSCy SchubertLDADD += $(PTHREAD_LIBS)
242b15cb3dSCy SchubertLDADD += $(LDADD_NTP)
252b15cb3dSCy Schubert
262b15cb3dSCy Schubertrun_ag =	cd $(srcdir) &&	env PATH="$(abs_builddir):$(PATH)" AUTOGEN_DNE_DATE=-D	\
272b15cb3dSCy Schubert		autogen -L include -L ag-tpl --writable
282b15cb3dSCy Schubertstd_def_list =						\
292b15cb3dSCy Schubert	$(srcdir)/include/debug-opt.def			\
302b15cb3dSCy Schubert	$(srcdir)/include/autogen-version.def 		\
312b15cb3dSCy Schubert	$(srcdir)/include/copyright.def 		\
322b15cb3dSCy Schubert	$(srcdir)/include/homerc.def 			\
332b15cb3dSCy Schubert	$(srcdir)/include/ntp.lic 			\
342b15cb3dSCy Schubert	$(srcdir)/include/version.def			\
352b15cb3dSCy Schubert	$(NULL)
362b15cb3dSCy Schubert
372b15cb3dSCy SchubertEXTRA_PROGRAMS = sntp
382b15cb3dSCy Schubert
392b15cb3dSCy Schubertbin_PROGRAMS =		@SNTP_DB@
402b15cb3dSCy Schubertlibexec_PROGRAMS =	@SNTP_DL@
412b15cb3dSCy Schubertsbin_PROGRAMS =		@SNTP_DS@
422b15cb3dSCy Schubert
43276da39aSCy SchubertSUBDIRS = include scripts unity
449034852cSGleb SmirnoffDIST_FAIL =
452b15cb3dSCy Schubert
462b15cb3dSCy Schubertif BUILD_LIBEVENT
472b15cb3dSCy SchubertSUBDIRS += libevent
489034852cSGleb Smirnoffelse
499034852cSGleb SmirnoffDIST_FAIL += "--enable-local-libevent"
502b15cb3dSCy Schubertendif
512b15cb3dSCy Schubert
52ea906c41SOllivier Robertif NEED_LIBOPTS
53ea906c41SOllivier RobertSUBDIRS += libopts
54ea906c41SOllivier Robertendif
55ea906c41SOllivier Robert
562b15cb3dSCy Schubertif BUILD_SNTP
572b15cb3dSCy Schubertnoinst_LIBRARIES = libsntp.a
582b15cb3dSCy SchubertSUBDIRS += tests
592b15cb3dSCy Schubertendif
602b15cb3dSCy Schubert
612b15cb3dSCy Schubertlibsntp_a_SOURCES =		\
622b15cb3dSCy Schubert	crypto.c		\
632b15cb3dSCy Schubert	kod_management.c	\
642b15cb3dSCy Schubert	log.c			\
659c2daa00SOllivier Robert	main.c			\
662b15cb3dSCy Schubert	networking.c		\
67ea906c41SOllivier Robert	sntp-opts.c		\
682b15cb3dSCy Schubert	utilities.c		\
69ea906c41SOllivier Robert	$(NULL)
709c2daa00SOllivier Robert
712b15cb3dSCy Schubertsntp_SOURCES =			\
722b15cb3dSCy Schubert	sntp.c			\
732b15cb3dSCy Schubert	$(NULL)
74ea906c41SOllivier Robert
75a466cc55SCy Schubertnodist_sntp_SOURCES =		\
76a466cc55SCy Schubert	version.c		\
77a466cc55SCy Schubert	$(NULL)
78a466cc55SCy Schubert
792b15cb3dSCy Schubertnoinst_HEADERS =		\
802b15cb3dSCy Schubert	crypto.h		\
812b15cb3dSCy Schubert	data_formats.h		\
822b15cb3dSCy Schubert	kod_management.h	\
832b15cb3dSCy Schubert	log.h			\
842b15cb3dSCy Schubert	main.h			\
852b15cb3dSCy Schubert	networking.h		\
862b15cb3dSCy Schubert	sntp-opts.h		\
872b15cb3dSCy Schubert	utilities.h		\
882b15cb3dSCy Schubert	$(NULL)
89ea906c41SOllivier Robert
902b15cb3dSCy SchubertDISTCLEANFILES =			\
912b15cb3dSCy Schubert	config.log			\
922b15cb3dSCy Schubert	$(man_MANS)			\
932b15cb3dSCy Schubert	$(NULL)
942b15cb3dSCy Schubert
952b15cb3dSCy SchubertEXTRA_DIST =				\
962b15cb3dSCy Schubert	$(srcdir)/COPYRIGHT		\
972b15cb3dSCy Schubert	ag-tpl				\
982b15cb3dSCy Schubert	deps-ver			\
99f0574f5cSXin LI	harden				\
1002b15cb3dSCy Schubert	invoke-sntp.menu		\
1012b15cb3dSCy Schubert	invoke-sntp.texi		\
1022b15cb3dSCy Schubert	@NTP_FORCE_LIBEVENT_DIST@	\
103276da39aSCy Schubert	libpkgver 			\
1042b15cb3dSCy Schubert	loc				\
1052b15cb3dSCy Schubert	sntp-opts.def			\
1062b15cb3dSCy Schubert	sntp.1sntpman			\
1072b15cb3dSCy Schubert	sntp.1sntpmdoc			\
1082b15cb3dSCy Schubert	sntp.man.in			\
1092b15cb3dSCy Schubert	sntp.mdoc.in			\
1102b15cb3dSCy Schubert	sntp.html			\
1112b15cb3dSCy Schubert	sntp.texi			\
112276da39aSCy Schubert	unity/auto			\
1132b15cb3dSCy Schubert	$(srcdir)/scm-rev		\
1142b15cb3dSCy Schubert	$(srcdir)/m4/version.m4		\
1152b15cb3dSCy Schubert	$(NULL)
1162b15cb3dSCy Schubert
1172b15cb3dSCy SchubertBUILT_SOURCES =				\
1182b15cb3dSCy Schubert	$(srcdir)/COPYRIGHT		\
1192b15cb3dSCy Schubert	libtool				\
1202b15cb3dSCy Schubert	$(srcdir)/sntp-opts.c		\
1212b15cb3dSCy Schubert	$(srcdir)/sntp-opts.h		\
1222b15cb3dSCy Schubert	$(srcdir)/include/version.def	\
1232b15cb3dSCy Schubert	$(srcdir)/m4/version.m4		\
1242b15cb3dSCy Schubert	$(srcdir)/include/version.texi	\
1252b15cb3dSCy Schubert	$(NULL)
1262b15cb3dSCy Schubert
1272b15cb3dSCy SchubertCLEANFILES =				\
1282b15cb3dSCy Schubert	check-COPYRIGHT-submake		\
129a466cc55SCy Schubert	.version			\
130a466cc55SCy Schubert	version.c			\
1312b15cb3dSCy Schubert	$(NULL)
1322b15cb3dSCy Schubert
1332b15cb3dSCy Schubertman1_MANS=
1342b15cb3dSCy Schubertman8_MANS=
1352b15cb3dSCy Schubertman_MANS=	sntp.$(SNTP_MS)
1362b15cb3dSCy Schubert
1372b15cb3dSCy Schubert## HMS: Real Soon Now...
1382b15cb3dSCy Schubert##info_TEXINFOS=	sntp.texi
1392b15cb3dSCy Schubert##sntp_TEXINFOS=	invoke-sntp.texi
1402b15cb3dSCy Schubert
1412b15cb3dSCy Schuberthtml_DATA=				\
1422b15cb3dSCy Schubert	$(srcdir)/sntp.html		\
1432b15cb3dSCy Schubert	$(NULL)
1442b15cb3dSCy Schubert
1452b15cb3dSCy Schubertnoinst_DATA=				\
1462b15cb3dSCy Schubert	$(srcdir)/invoke-sntp.menu	\
1472b15cb3dSCy Schubert	$(srcdir)/invoke-sntp.texi	\
1482b15cb3dSCy Schubert	$(srcdir)/sntp.man.in		\
1492b15cb3dSCy Schubert	$(srcdir)/sntp.mdoc.in		\
1502b15cb3dSCy Schubert	$(NULL)
1512b15cb3dSCy Schubert
1522b15cb3dSCy Schubertinstall-data-local: install-html
153ea906c41SOllivier Robert
154ea906c41SOllivier RobertFRC:
155a466cc55SCy Schubert	@: FRC "force" depends on nothing and is not a file, so is always
156a466cc55SCy Schubert	@: out-of-date causing targets which depend on it to also be
157a466cc55SCy Schubert	@: outdated so their rules to fire each time they are built.
1582b15cb3dSCy Schubert
1592b15cb3dSCy Schubert## We probably need something about libevent, too
1602b15cb3dSCy Schubert## That is probably not possible since LDADD_LIBEVENT may be
1612b15cb3dSCy Schubert## non-file "-levent_core".
1622b15cb3dSCy Schubert
163a466cc55SCy Schubertversion.c: Makefile $(srcdir)/scm-rev
164a466cc55SCy Schubert	$(AM_V_GEN)env CSET=`cat $(srcdir)/scm-rev` $(top_builddir)/../scripts/build/mkver sntp
1652b15cb3dSCy Schubert
166ea906c41SOllivier Robertcheck-autogen-version.def: FRC
167ea906c41SOllivier Robert	@cd $(srcdir)							\
168ea906c41SOllivier Robert	&& test -r ../include/autogen-version.def			\
169ea906c41SOllivier Robert	&& ( if cmp -s ../include/autogen-version.def autogen-version.def; \
170ea906c41SOllivier Robert	   then : ;							\
171ea906c41SOllivier Robert	   else cp ../include/autogen-version.def autogen-version.def;	 \
172ea906c41SOllivier Robert		echo "Installing new sntp/autogen-version.def file";	\
173ea906c41SOllivier Robert	   fi )
174ea906c41SOllivier Robert
1752b15cb3dSCy Schubert$(srcdir)/autogen-version.def:
1762b15cb3dSCy Schubert	$(MAKE) $(AM_MAKEFLAGS) check-autogen-version.def
1772b15cb3dSCy Schubert
1782b15cb3dSCy Schubertbuilt-sources-only: $(BUILT_SOURCES)
1792b15cb3dSCy Schubert	@: do-nothing action to avoid default SCCS get
1802b15cb3dSCy Schubert
1812b15cb3dSCy Schubert## HMS: The next bit is still suboptimal.  We'll get an error if this is
1822b15cb3dSCy Schubert## a bk repo and srcdir or scm-rev is unwritable.
1832b15cb3dSCy Schubert
1842b15cb3dSCy Schubertcheck-scm-rev: $(srcdir)/scm-rev
1852b15cb3dSCy Schubert	@: do-nothing
1862b15cb3dSCy Schubert
187a466cc55SCy Schubert$(srcdir)/scm-rev: FRC
188a466cc55SCy Schubert	$(AM_V_at)-bk root $(srcdir) >/dev/null 2>&1 &&			\
1892b15cb3dSCy Schubert	    cd $(srcdir)/.. &&						\
1902b15cb3dSCy Schubert	    x=`bk -R prs -hr+ -nd:I: ChangeSet` &&			\
1912b15cb3dSCy Schubert	    y=`cat sntp/scm-rev 2>/dev/null` || true &&			\
1922b15cb3dSCy Schubert	    case "$$x" in ''|$$y) ;; *) echo $$x > sntp/scm-rev ;; esac
1932b15cb3dSCy Schubert
1942b15cb3dSCy Schubert$(srcdir)/m4/version.m4: $(srcdir)/../packageinfo.sh
1952b15cb3dSCy Schubert	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
1962b15cb3dSCy Schubert	../scripts/build/genver m4/version.m4
1972b15cb3dSCy Schubert
1982b15cb3dSCy Schubert$(srcdir)/include/version.def: $(srcdir)/../packageinfo.sh
1992b15cb3dSCy Schubert	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
2002b15cb3dSCy Schubert	../scripts/build/genver include/version.def
2012b15cb3dSCy Schubert
2022b15cb3dSCy Schubert$(srcdir)/include/version.texi: $(srcdir)/../packageinfo.sh
2032b15cb3dSCy Schubert	TEMPDIR=`pwd` && export TEMPDIR && cd $(srcdir) && \
2042b15cb3dSCy Schubert	../scripts/build/genver include/version.texi
2052b15cb3dSCy Schubert
2062b15cb3dSCy Schubert$(srcdir)/../COPYRIGHT:
2072b15cb3dSCy Schubert	cd .. && $(MAKE) $(AM_MAKEFLAGS) COPYRIGHT-please
2082b15cb3dSCy Schubert
2092b15cb3dSCy Schubertcheck-COPYRIGHT-submake: $(srcdir)/../COPYRIGHT
2102b15cb3dSCy Schubert	@cmp -s $(srcdir)/../COPYRIGHT $(srcdir)/COPYRIGHT	\
2112b15cb3dSCy Schubert	 || { cp $(srcdir)/../COPYRIGHT $(srcdir)		\
2122b15cb3dSCy Schubert	      && echo 'updated sntp/COPYRIGHT installed' ;}
2132b15cb3dSCy Schubert	@echo 'submake avoided if this file is newer than parent COPYRIGHT' > $@
2142b15cb3dSCy Schubert
2152b15cb3dSCy Schubertcheck-COPYRIGHT: FRC
2162b15cb3dSCy Schubert	[ ! -r $(srcdir)/../COPYRIGHT ]					\
2172b15cb3dSCy Schubert	|| [ check-COPYRIGHT-submake -nt $(srcdir)/../COPYRIGHT ]	\
2182b15cb3dSCy Schubert	|| $(MAKE) $(AM_MAKEFLAGS) check-COPYRIGHT-submake
2192b15cb3dSCy Schubert
2202b15cb3dSCy Schubert$(srcdir)/COPYRIGHT: check-COPYRIGHT
2212b15cb3dSCy Schubert	@: do-nothing action to prevent any default
222ea906c41SOllivier Robert
223ea906c41SOllivier Robert$(srcdir)/sntp-opts.h: $(srcdir)/sntp-opts.c
2242b15cb3dSCy Schubert	@: do-nothing action to avoid default SCCS get, .h built with .c
2252b15cb3dSCy Schubert
2262b15cb3dSCy Schubert$(srcdir)/sntp-opts.c: $(srcdir)/sntp-opts.def $(std_def_list)
227a466cc55SCy Schubert	$(AM_V_GEN)$(run_ag) sntp-opts.def
228ea906c41SOllivier Robert
2292b15cb3dSCy Schubert###
230ea906c41SOllivier Robert
2312b15cb3dSCy Schubert$(srcdir)/sntp.1sntpman: $(srcdir)/sntp-opts.def $(std_def_list)
232a466cc55SCy Schubert	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=1sntpman -Tagman-cmd.tpl sntp-opts.def
233ea906c41SOllivier Robert
2342b15cb3dSCy Schubert$(srcdir)/sntp.man.in: $(srcdir)/sntp.1sntpman $(srcdir)/scripts/mansec2subst.sed
2352b15cb3dSCy Schubert	sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpman > $(srcdir)/sntp.man.in+
2362b15cb3dSCy Schubert	mv $(srcdir)/sntp.man.in+ $(srcdir)/sntp.man.in
2372b15cb3dSCy Schubert
2382b15cb3dSCy Schubert###
2392b15cb3dSCy Schubert
2402b15cb3dSCy Schubert$(srcdir)/sntp.1sntpmdoc: $(srcdir)/sntp-opts.def $(std_def_list)
241a466cc55SCy Schubert	$(AM_V_GEN)$(run_ag) -DMAN_SECTION=1sntpmdoc -Tagmdoc-cmd.tpl sntp-opts.def
2422b15cb3dSCy Schubert
2432b15cb3dSCy Schubert$(srcdir)/sntp.mdoc.in: $(srcdir)/sntp.1sntpmdoc $(srcdir)/scripts/mansec2subst.sed
2442b15cb3dSCy Schubert	sed -f $(srcdir)/scripts/mansec2subst.sed $(srcdir)/sntp.1sntpmdoc > $(srcdir)/sntp.mdoc.in+
2452b15cb3dSCy Schubert	mv $(srcdir)/sntp.mdoc.in+ $(srcdir)/sntp.mdoc.in
2462b15cb3dSCy Schubert
2472b15cb3dSCy Schubert###
2482b15cb3dSCy Schubert
2492b15cb3dSCy Schubertsntp.$(SNTP_MS): $(srcdir)/sntp.$(MANTAGFMT).in $(top_builddir)/config.status
2502b15cb3dSCy Schubert	$(top_builddir)/config.status --file=sntp.$(SNTP_MS)+:$(srcdir)/sntp.$(MANTAGFMT).in
2512b15cb3dSCy Schubert	mv sntp.$(SNTP_MS)+ sntp.$(SNTP_MS)
2522b15cb3dSCy Schubert
2532b15cb3dSCy Schubert###
2542b15cb3dSCy Schubert
2552b15cb3dSCy Schubert$(srcdir)/invoke-sntp.menu: $(srcdir)/invoke-sntp.texi
2562b15cb3dSCy Schubert	@: do-nothing action to avoid default SCCS get, .menu built with .texi
2572b15cb3dSCy Schubert
2582b15cb3dSCy Schubert$(srcdir)/invoke-sntp.texi: $(srcdir)/sntp-opts.def $(std_def_list)
259a466cc55SCy Schubert	$(AM_V_GEN)$(run_ag) -Tagtexi-cmd.tpl -DLEVEL=section sntp-opts.def
2602b15cb3dSCy Schubert	$(top_srcdir)/../scripts/build/check--help $@
2612b15cb3dSCy Schubert
262a466cc55SCy Schubert$(srcdir)/sntp.html: $(srcdir)/invoke-sntp.texi $(srcdir)/sntp.texi $(srcdir)/include/version.texi
2632b15cb3dSCy Schubert	cd $(srcdir) && ( makeinfo --force --html --no-split -o sntp.html sntp.texi || true )
2642b15cb3dSCy Schubert
2652b15cb3dSCy Schubertlibtool: $(LIBTOOL_DEPS)
2662b15cb3dSCy Schubert	./config.status --recheck
2672b15cb3dSCy Schubert
2689034852cSGleb Smirnoff# HMS: libevent/ is a target if it's in EXTRA_DIST via NTP_FORCE_LIBEVENT_DIST.
2699034852cSGleb Smirnoff# Note that libevent/ is already in DIST_SUBDIRS (implicit in Makefile.am
2709034852cSGleb Smirnoff# but explicit in Makefile.in).  This check doesn't help with distclean.
2719034852cSGleb Smirnofflibevent: distdir-pre-check
2722b15cb3dSCy Schubert
2739034852cSGleb Smirnoff# HMS: Stops the build for gmake or pmake
2749034852cSGleb Smirnoffdistdir-pre-check:
2759034852cSGleb Smirnoff	case "$(DIST_FAIL)" in	\
2769034852cSGleb Smirnoff	 '')  ;;		\
277*f5f40dd6SCy Schubert	 *) echo "re-run configure adding $(DIST_FAIL) if you want to make a distribution.";	\
2789034852cSGleb Smirnoff	    exit 1 ;;		\
2799034852cSGleb Smirnoff	esac
2802b15cb3dSCy Schubert
2812b15cb3dSCy Schubertinclude $(top_srcdir)/bincheck.mf
2822b15cb3dSCy Schubertinclude $(top_srcdir)/check-libntp.mf
2832b15cb3dSCy Schubertinclude $(top_srcdir)/check-libopts.mf
2842b15cb3dSCy Schubertinclude $(top_srcdir)/depsver.mf
2852b15cb3dSCy Schubertinclude $(top_srcdir)/includes.mf
286