xref: /netbsd/external/bsd/ntp/dist/ntpdc/Makefile.am (revision 6550d01e)
1NULL=
2AUTOMAKE_OPTIONS=
3
4bindir=		${exec_prefix}/${BINSUBDIR}
5bin_PROGRAMS=	ntpdc
6EXTRA_PROGRAMS=	ntpdc-layout
7EXTRA_DATA=	check-layout
8BUILT_SOURCES=	@MAKE_CHECK_LAYOUT@
9AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
10	-I$(top_srcdir)/lib/isc/nothreads/include \
11	-I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS)
12# LDADD might need RESLIB and ADJLIB
13ntpdc_LDADD=	version.o @LCRYPTO@ @EDITLINE_LIBS@ $(LIBOPTS_LDADD) \
14		../libntp/libntp.a
15# ntpdc-layout doesn't need any additional libraries at all
16ntpdc_layout_LDADD=
17DISTCLEANFILES=	.version version.c
18CLEANFILES=	check-layout layout.here nl.c ntpdc-layout
19noinst_HEADERS=	ntpdc.h
20ETAGS_ARGS= 	Makefile.am
21EXTRA_DIST=	nl_in.c nl.pl layout.std	\
22		ntpdc-opts.def ntpdc.1 ntpdc-opts.texi ntpdc-opts.menu
23BUILT_SOURCES+=	ntpdc-opts.c ntpdc-opts.h ntpdc.1 ntpdc-opts.texi	\
24		ntpdc-opts.menu
25man_MANS=	ntpdc.1
26run_ag=		cd $(srcdir) &&					\
27		env PATH="$(abs_builddir):$(PATH)"		\
28		autogen -L ../include --writable
29std_def_list=	$(top_srcdir)/include/debug-opt.def		\
30		$(top_srcdir)/include/autogen-version.def 	\
31		$(top_srcdir)/include/copyright.def 		\
32		$(top_srcdir)/include/homerc.def 		\
33		$(top_srcdir)/include/version.def
34
35$(srcdir)/ntpdc-opts.h: $(srcdir)/ntpdc-opts.c
36	@: do-nothing action to avoid default SCCS get, .h built with .c
37
38$(srcdir)/ntpdc-opts.c: $(srcdir)/ntpdc-opts.def $(std_def_list)
39	$(run_ag) ntpdc-opts.def
40
41$(srcdir)/ntpdc.1: $(srcdir)/ntpdc-opts.def $(std_def_list)
42	$(run_ag) -Tagman1.tpl -bntpdc ntpdc-opts.def
43
44$(srcdir)/ntpdc-opts.texi $(srcdir)/ntpdc-opts.menu: $(srcdir)/ntpdc-opts.def $(std_def_list)
45	$(MAKE) ntpdc	# aginfo.tpl runs the binary to extract --help usage text
46	$(run_ag) -Taginfo.tpl -DLEVEL=section ntpdc-opts.def
47
48ntpdc_SOURCES = ntpdc.c ntpdc_ops.c ntpdc-opts.c ntpdc-opts.h
49
50ntpdc-layout.o: nl.c
51
52layout.here: ntpdc-layout
53	./ntpdc-layout > $@
54
55check-layout: ntpdc-layout $(srcdir)/layout.std layout.here
56	cmp $(srcdir)/layout.std layout.here && echo stamp > $@
57
58$(PROGRAMS): $(LDADD)
59
60../libntp/libntp.a:
61	cd ../libntp && $(MAKE)
62
63$(top_srcdir)/version :
64	cd $(top_srcdir) && $(MAKE) version
65
66version.o: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
67	env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpdc
68	$(COMPILE) -c version.c
69
70# I ran nl_in.c (attached, to be installed into ntpdc) through
71# $(CC) -E nl_in.c | nl.pl > nl.c
72nl.c: nl_in.c nl.pl Makefile.am ../config.h ../include/ntp_request.h ntpdc.h
73	$(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c
74
75include $(top_srcdir)/bincheck.mf
76include $(top_srcdir)/depsver.mf
77