Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / ntp / dist / ntpd / Makefile.am
blob37d4c30e9a1a9b0c0c46299e6113b4d7305cd917
1 NULL=
2 AUTOMAKE_OPTIONS= 
4 bindir= ${exec_prefix}/${BINSUBDIR}
6 bin_PROGRAMS=   ntpd @MAKE_NTPDSIM@
8 noinst_LIBRARIES=       libntpd.a
10 AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
11         -I$(top_srcdir)/lib/isc/nothreads/include \
12         -I$(top_srcdir)/lib/isc/unix/include $(LIBOPTS_CFLAGS)
14 # LDADD might need RESLIB and ADJLIB.
15 LDADD=  version.o libntpd.a @LIBPARSE@
16 AM_YFLAGS=      -d -t -r all
18 if SAVECONFIG_ENABLED
19 if NTP_CROSSCOMPILE
20 CHECK_SAVECONFIG=
21 else
22 CHECK_SAVECONFIG= check-saveconfig
23 endif
24 else !SAVECONFIG_ENABLED
25 CHECK_SAVECONFIG=
26 endif
28 if NTP_CROSSCOMPILE
29 NTP_KEYWORD_OUT=ntp_keyword.dummy
30 else
31 NTP_KEYWORD_OUT=ntp_keyword.out
32 endif
35 # VPHACK and VPHACK_AFTER are enabled on non-GNU makes (such as 
36 # BSD make) to work around issues specific to compiling
37 # ntp_parser.y into ntp_parser.h and ntp_parser.c in a vPATH
38 # configuration where we would like (for a change) the output
39 # files ntp_parser.[ch] to be placed in the source directory,
40 # as opposed to the build directory.  This allows a single
41 # host of a flock configured with Bison to update ntp_parser.[ch]
42 # used by the rest.
43
45 if VPATH_HACK
46 VPHACK= vphack
47 VPHACK_AFTER= vphack_after
48 else
49 VPHACK=
50 VPHACK_AFTER=
51 endif
53 vphack:
54         test -e ntp_parser.c || ln -s $(srcdir)/ntp_parser.c .
55         test -e ntp_parser.h || ln -s $(srcdir)/ntp_parser.h .
58 # ylwrap script which invokes Bison replaces ntp_parser.h
59 # symlink with the updated file, when ntp_parser.h changes.
60 # vphack_after detects this and copies the updated file to srcdir 
61 # and re-creates the ntp_parser.h symlink in its place.
64 vphack_after:
65         test -L ntp_parser.h || ( \
66                 mv ntp_parser.h $(srcdir)/ntp_parser.h && \
67                 ln -s $(srcdir)/ntp_parser.h . \
68                 )
70 BUILT_SOURCES=  $(VPHACK) ntp_parser.c ntp_parser.h $(VPHACK_AFTER) \
71         ntp_keyword.h ntpd-opts.c ntpd-opts.h ntpd.1 ntpd-opts.texi \
72         ntpd-opts.menu
74 man_MANS=       ntpd.1
76 # ntpdsim.1 is a remnant along with all the ntpdsim-opts.* files, the
77 # simulator currently uses ntpd-opts.[ch].  This also means there is no
78 # longer a reason to have ntpdbase-opts.def split off of ntpd-opts.def.
80 # ntpd may need:
81 # log10                               refclock_wwv.o
82 # sqrt                                ntp_control.o
83 # floor                               refclock_wwv.o
84 # which are (usually) provided by -lm.
85 keyword_gen_LDADD = ../libntp/libntp.a
86 ntpd_LDADD = $(LDADD) -lm @LCRYPTO@ @LSCF@ $(LIBOPTS_LDADD) ../libntp/libntp.a
87 ntpdsim_LDADD = $(LDADD) -lm @LCRYPTO@ @LSCF@ $(LIBOPTS_LDADD) ../libntp/libntpsim.a
88 ntpdsim_CFLAGS = $(CFLAGS) -DSIM
89 check_y2k_LDADD = $(LDADD) ../libntp/libntp.a
90 DISTCLEANFILES = keyword-gen .version version.c
91 CLEANFILES = check-saveconfig compsave.conf ntp_keyword.out \
92         ntp_keyword.dummy
93 EXTRA_DIST = \
94         complete.conf           \
95         ntpd-opts.def           \
96         ntpdbase-opts.def       \
97         ntp_keyword.h           \
98         refclock_msfees.c       \
99         refclock_trak.c         \
100         $(BUILT_SOURCES)        \
101         $(NULL)
102 ETAGS_ARGS = Makefile.am
103 ###                                                     Y2Kfixes
104 check_PROGRAMS = @MAKE_CHECK_Y2K@
105 EXTRA_PROGRAMS = check_y2k ntpdsim keyword-gen
106 run_ag=         cd $(srcdir) &&                                 \
107                 env PATH="$(abs_builddir):$(PATH)"              \
108                 autogen -L ../include --writable
109 std_def_list=   $(top_srcdir)/include/autogen-version.def       \
110                 $(top_srcdir)/include/copyright.def             \
111                 $(top_srcdir)/include/version.def
113 check-local: @MAKE_CHECK_Y2K@ $(CHECK_SAVECONFIG)
114         test -z "@MAKE_CHECK_Y2K@" || ./@MAKE_CHECK_Y2K@
116 ntpd_SOURCES =                  \
117         cmd_args.c              \
118         ntp_config.c            \
119         ntp_data_structures.c   \
120         ntp_io.c                \
121         ntp_parser.y            \
122         ntp_scanner.c           \
123         ntp_scanner.h           \
124         ntpd.c                  \
125         ntpd-opts.c             \
126         ntpd-opts.h             \
127         $(NULL)
128         
129 ntpdsim_SOURCES =               \
130         $(ntpd_SOURCES)         \
131         ntpsim.c                \
132         $(NULL)
134 # libntpd_a_SOURCES do not use #ifdef SIM
136 libntpd_a_SOURCES =             \
137         jupiter.h               \
138         ntp_control.c           \
139         ntp_crypto.c            \
140         ntp_filegen.c           \
141         ntp_intres.c            \
142         ntp_loopfilter.c        \
143         ntp_monitor.c           \
144         ntp_peer.c              \
145         ntp_proto.c             \
146         ntp_refclock.c          \
147         ntp_request.c           \
148         ntp_restrict.c          \
149         ntp_signd.c             \
150         ntp_timer.c             \
151         ntp_util.c              \
152         ppsapi_timepps.h        \
153         refclock_acts.c         \
154         refclock_arbiter.c      \
155         refclock_arc.c          \
156         refclock_as2201.c       \
157         refclock_atom.c         \
158         refclock_bancomm.c      \
159         refclock_chronolog.c    \
160         refclock_chu.c          \
161         refclock_conf.c         \
162         refclock_datum.c        \
163         refclock_dumbclock.c    \
164         refclock_fg.c           \
165         refclock_gpsvme.c       \
166         refclock_heath.c        \
167         refclock_hopfser.c      \
168         refclock_hopfpci.c      \
169         refclock_hpgps.c        \
170         refclock_irig.c         \
171         refclock_jjy.c          \
172         refclock_jupiter.c      \
173         refclock_leitch.c       \
174         refclock_local.c        \
175         refclock_mx4200.c       \
176         refclock_neoclock4x.c   \
177         refclock_nmea.c         \
178         refclock_oncore.c       \
179         refclock_palisade.c     \
180         refclock_palisade.h     \
181         refclock_parse.c        \
182         refclock_pcf.c          \
183         refclock_pst.c          \
184         refclock_ripencc.c      \
185         refclock_shm.c          \
186         refclock_tpro.c         \
187         refclock_true.c         \
188         refclock_tt560.c        \
189         refclock_ulink.c        \
190         refclock_wwv.c          \
191         refclock_wwvb.c         \
192         refclock_zyfer.c        \
193         $(NULL)
195 ntp_keyword.out: keyword-gen
196         ./keyword-gen $(srcdir)/ntp_parser.h > $@
197         grep -v diff_ignore_line < $(srcdir)/ntp_keyword.h > cmp1
198         grep -v diff_ignore_line < $@ > cmp2
199         cmp cmp1 cmp2 > /dev/null || cp $@ $(srcdir)/ntp_keyword.h
200         rm cmp1 cmp2
201         
202 ntp_keyword.dummy:
203         echo stamp > $@
205 $(srcdir)/ntp_keyword.h: $(NTP_KEYWORD_OUT)
206         @: do-nothing action to avoid default SCCS get
207         @: .h updated if needed by ntp_keyword.out rule
209 $(srcdir)/ntpd-opts.h: $(srcdir)/ntpd-opts.c
210         @: do-nothing action to avoid default SCCS get, .h built with .c
211         
212 $(srcdir)/ntpd-opts.c: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def $(std_def_list)
213         $(run_ag) ntpd-opts.def
215 $(srcdir)/ntpd.1: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def $(std_def_list)
216         $(run_ag) -Tagman1.tpl -bntpd ntpd-opts.def
218 $(srcdir)/ntpd-opts.texi $(srcdir)/ntpd-opts.menu: $(srcdir)/ntpd-opts.def $(srcdir)/ntpdbase-opts.def $(std_def_list)
219         $(MAKE) ntpd    # aginfo.tpl runs the binary to extract --help usage text
220         $(run_ag) -Taginfo.tpl -DLEVEL=section ntpd-opts.def
222 $(PROGRAMS): $(LDADD)
224 compsave.conf: ntpd $(srcdir)/complete.conf
225         ./ntpd --configfile $(srcdir)/complete.conf --saveconfigquit $@
227 check-saveconfig: $(srcdir)/complete.conf compsave.conf
228         cmp $(srcdir)/complete.conf compsave.conf && echo stamp > $@
230 ../libntp/libntp.a:
231         cd ../libntp && $(MAKE) libntp.a
233 ../libparse/libparse.a:
234         cd ../libparse && $(MAKE)
236 $(top_srcdir)/version :
237         cd $(top_srcdir) && $(MAKE) version
239 version.o: $(ntpd_OBJECTS) ../libntp/libntp.a @LIBPARSE@ Makefile $(top_srcdir)/version
240         env CSET=`cat $(top_srcdir)/version` $(top_builddir)/scripts/mkver ntpd
241         $(COMPILE) -c version.c
243 include $(top_srcdir)/bincheck.mf
244 include $(top_srcdir)/depsver.mf