xref: /freebsd/contrib/ntp/ntpdc/Makefile.am (revision 1670a1c2a47d10ecccd001970b859caf93cd3b6e)
1AUTOMAKE_OPTIONS=	../util/ansi2knr
2
3bindir=		${exec_prefix}/${BINSUBDIR}
4bin_PROGRAMS=	ntpdc
5EXTRA_PROGRAMS=	ntpdc-layout
6EXTRA_DATA=	check-layout
7BUILT_SOURCES=	@MAKE_CHECK_LAYOUT@
8AM_CPPFLAGS=	-I$(top_srcdir)/include $(LIBOPTS_CFLAGS)
9# LDADD might need RESLIB and ADJLIB
10ntpdc_LDADD=	version.o @READLINE_LIBS@ $(LIBOPTS_LDADD) ../libntp/libntp.a
11# ntpdc-layout doesn't need any additional libraries at all
12ntpdc_layout_LDADD=
13DISTCLEANFILES=	.version version.c
14CLEANFILES=	check-layout layout.here nl.c ntpdc-layout
15noinst_HEADERS=	ntpdc.h
16ETAGS_ARGS= 	Makefile.am
17EXTRA_DIST=	nl_in.c nl.pl layout.std	\
18		ntpdc-opts.def ntpdc.1 ntpdc-opts.texi ntpdc-opts.menu
19BUILT_SOURCES+=	ntpdc-opts.c ntpdc-opts.h ntpdc.1 ntpdc-opts.texi	\
20		ntpdc-opts.menu
21man_MANS=	ntpdc.1
22run_ag=         cd $(srcdir) && autogen -L ../include --writable
23std_def_list=	$(top_srcdir)/include/debug-opt.def		\
24		$(top_srcdir)/include/autogen-version.def 	\
25		$(top_srcdir)/include/copyright.def 		\
26		$(top_srcdir)/include/homerc.def 		\
27		$(top_srcdir)/include/version.def
28
29$(srcdir)/ntpdc-opts.h: $(srcdir)/ntpdc-opts.c
30$(srcdir)/ntpdc-opts.c: $(srcdir)/ntpdc-opts.def $(std_def_list)
31	$(run_ag) ntpdc-opts.def
32
33$(srcdir)/ntpdc.1: $(srcdir)/ntpdc-opts.def $(std_def_list)
34	$(run_ag) -Tagman1.tpl -bntpdc ntpdc-opts.def
35
36$(srcdir)/ntpdc-opts.texi $(srcdir)/ntpdc-opts.menu: $(srcdir)/ntpdc-opts.def $(std_def_list)
37	$(run_ag) -Taginfo.tpl -DLEVEL=section ntpdc-opts.def
38
39ntpdc_SOURCES = ntpdc.c ntpdc_ops.c ntpdc-opts.c ntpdc-opts.h
40
41ntpdc-layout.o: nl.c
42
43layout.here: ntpdc-layout
44	./ntpdc-layout > $@
45
46check-layout: ntpdc-layout layout.std layout.here
47	cmp $(srcdir)/layout.std layout.here && echo stamp > $@
48
49$(PROGRAMS): $(LDADD)
50
51../libntp/libntp.a:
52	cd ../libntp && $(MAKE)
53
54$(top_srcdir)/version :
55	cd $(top_srcdir) && $(MAKE) version
56
57version.o: $(ntpdc_OBJECTS) ../libntp/libntp.a Makefile $(top_srcdir)/version
58	env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpdc
59	$(COMPILE) -c version.c
60
61# I ran nl_in.c (attached, to be installed into ntpdc) through
62# $(CC) -E nl_in.c | nl.pl > nl.c
63nl.c: nl_in.c nl.pl Makefile.am
64	$(CC) -E $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srcdir)/nl_in.c | ./nl.pl > nl.c
65
66include ../bincheck.mf
67