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