xref: /freebsd/contrib/ntp/sntp/tests/Makefile.am (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1NULL =
2BUILT_SOURCES =
3EXTRA_PROGRAMS =
4
5CLEANFILES =			\
6	debug-output-lfp-bin	\
7	debug-output-lfp-dec	\
8	debug-output-pkt	\
9	kod-output-blank	\
10	kod-output-multiple	\
11	kod-output-single	\
12	testLogfile.log		\
13	testLogfile2.log	\
14	$(NULL)
15
16DISTCLEANFILES =		\
17	kod-output-blank	\
18	kod-output-single 	\
19	kod-output-multiple	\
20	testLogfile.log		\
21	testLogfile2.log	\
22	$(NULL)
23
24std_unity_list =						\
25	$(abs_top_srcdir)/unity/auto/generate_test_runner.rb	\
26	$(abs_srcdir)/testconf.yml				\
27	$(NULL)
28
29run_unity =	ruby $(std_unity_list)
30
31# Use EXTRA_PROGRAMS for test files that are under development but
32# not production-ready
33#EXTRA_PROGRAMS +=		test-packetHandling test-packetProcessing
34
35check_PROGRAMS =			\
36	test-crypto			\
37	test-keyFile			\
38	test-log			\
39	test-networking			\
40	test-packetHandling		\
41	test-packetProcessing		\
42	test-utilities			\
43	$(NULL)
44
45if BUILD_TEST_KODDATABASE
46check_PROGRAMS += test-kodDatabase
47endif
48
49if BUILD_TEST_KODFILE
50check_PROGRAMS += test-kodFile
51endif
52
53noinst_HEADERS =		\
54	sntptest.h		\
55	$(NULL)
56
57dist_check_SCRIPTS =	tests-runner
58
59EXTRA_DIST =				\
60	data/debug-input-lfp-bin	\
61	data/debug-input-lfp-dec	\
62	data/debug-input-pkt		\
63	data/key-test-ascii		\
64	data/key-test-comments		\
65	data/key-test-empty		\
66	data/key-test-hex		\
67	data/key-test-invalid-hex	\
68	data/kod-expected-multiple	\
69	data/kod-expected-single	\
70	data/kod-test-blanks		\
71	data/kod-test-correct		\
72	data/kod-test-empty		\
73	testconf.yml			\
74	$(NULL)
75
76CLEANFILES +=				\
77	data/kod-output-multiple	\
78	data/kod-output-single		\
79	data/debug-output-pkt		\
80	data/debug-output-lfp-dec	\
81	data/kod-output-blank		\
82	data/debug-output-lfp-bin	\
83	$(NULL)
84
85#split into LDADD and tests_LDADD?
86base_LDADD =					\
87	../libsntp.a				\
88	$(LIBOPTS_LDADD)			\
89	$(LDADD_LIBEVENT)			\
90	$(top_builddir)/../libntp/libntp.a	\
91	$(LDADD_LIBNTP)				\
92	$(LDADD_NTP)				\
93	$(NULL)
94
95LDADD =						\
96	$(base_LDADD)				\
97	$(top_builddir)/unity/libunity.a	\
98	$(LIBM)					\
99	$(NULL)
100
101AM_CFLAGS  = $(CFLAGS_NTP)
102AM_CFLAGS += $(NTP_HARD_CFLAGS)
103
104AM_CPPFLAGS  = $(SNTP_INCS)
105AM_CPPFLAGS += -I$(srcdir)/..
106AM_CPPFLAGS += -I$(top_srcdir)/../tests
107AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
108AM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
109AM_CPPFLAGS += $(CPPFLAGS_NTP)
110AM_CPPFLAGS += -DUNITY_INCLUDE_CONFIG_H
111#AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity
112AM_CPPFLAGS += -I$(top_srcdir)/unity
113AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
114
115AM_LDFLAGS  = $(LDFLAGS_NTP)
116AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
117
118BUILT_SOURCES +=				\
119	$(srcdir)/run-crypto.c			\
120	$(srcdir)/run-keyFile.c			\
121	$(srcdir)/run-kodDatabase.c		\
122	$(srcdir)/run-kodFile.c			\
123	$(srcdir)/run-networking.c		\
124	$(srcdir)/run-packetHandling.c		\
125	$(srcdir)/run-packetProcessing.c	\
126	$(srcdir)/run-utilities.c		\
127	$(NULL)
128
129test_networking_SOURCES =		\
130	networking.c			\
131	run-networking.c		\
132	$(top_builddir)/version.c	\
133	$(NULL)
134
135test_packetHandling_SOURCES =		\
136	packetHandling.c		\
137	run-packetHandling.c		\
138	$(top_builddir)/version.c	\
139	$(NULL)
140
141test_kodDatabase_SOURCES =		\
142	kodDatabase.c			\
143	run-kodDatabase.c		\
144	$(top_builddir)/version.c	\
145	$(NULL)
146
147test_keyFile_SOURCES =			\
148	fileHandlingTest.c		\
149	keyFile.c			\
150	run-keyFile.c			\
151	$(top_builddir)/version.c	\
152	$(NULL)
153
154test_kodFile_SOURCES =			\
155	fileHandlingTest.c		\
156	kodFile.c			\
157	run-kodFile.c			\
158	$(top_builddir)/version.c	\
159	$(NULL)
160
161test_packetProcessing_SOURCES =		\
162	packetProcessing.c		\
163	run-packetProcessing.c		\
164	sntptest.c			\
165	$(NULL)
166
167test_utilities_SOURCES =		\
168	fileHandlingTest.c		\
169	utilities.c			\
170	run-utilities.c			\
171	$(NULL)
172
173test_crypto_CFLAGS =			\
174	$(CFLAGS_LIBEVENT)		\
175	$(AM_CFLAGS)			\
176	$(NULL)
177
178test_crypto_SOURCES =			\
179	crypto.c			\
180	run-crypto.c			\
181	$(top_builddir)/version.c	\
182	$(NULL)
183
184test_log_SOURCES =			\
185	t-log.c			\
186	run-t-log.c			\
187	$(top_builddir)/version.c	\
188	$(NULL)
189
190
191$(srcdir)/run-kodFile.c: $(srcdir)/kodFile.c $(std_unity_list)
192	$(run_unity) $< $@
193
194$(srcdir)/run-keyFile.c: $(srcdir)/keyFile.c $(std_unity_list)
195	$(run_unity) $< $@
196
197$(srcdir)/run-kodDatabase.c: $(srcdir)/kodDatabase.c $(std_unity_list)
198	$(run_unity) $< $@
199
200$(srcdir)/run-networking.c: $(srcdir)/networking.c $(std_unity_list)
201	$(run_unity) $< $@
202
203$(srcdir)/run-packetProcessing.c: $(srcdir)/packetProcessing.c $(std_unity_list)
204	$(run_unity) $< $@
205
206$(srcdir)/run-packetHandling.c: $(srcdir)/packetHandling.c $(std_unity_list)
207	$(run_unity) $< $@
208
209$(srcdir)/run-utilities.c: $(srcdir)/utilities.c $(std_unity_list)
210	$(run_unity) $< $@
211
212$(srcdir)/run-crypto.c: $(srcdir)/crypto.c $(std_unity_list)
213	$(run_unity) $< $@
214
215$(srcdir)/run-t-log.c: $(srcdir)/t-log.c $(std_unity_list)
216	$(run_unity) $< $@
217
218
219#$(srcdir)/../version.c: $(srcdir)/../version.c
220#	gcc -o version.o ../version.c
221
222TESTS =
223
224if !NTP_CROSSCOMPILE
225TESTS += $(check_PROGRAMS)
226endif
227#if !NTP_CROSSCOMPILE
228#TESTS += tests-runner
229#endif
230
231## ensure ../libsntp.a is built
232
233BUILT_SOURCES	+= check-libsntp
234CLEANFILES	+= check-libsntp
235
236check-libsntp: ../libsntp.a
237	@echo stamp > $@
238
239../libsntp.a:
240	cd .. && $(MAKE) $(AM_MAKEFLAGS) libsntp.a
241
242## check-libntp.mf - automake fragment
243## slightly adapted for deeper directory
244
245BUILT_SOURCES	+= check-libntp check-libunity
246CLEANFILES	+= check-libntp	check-libunity
247
248check-libntp: ../../libntp/libntp.a
249	@echo stamp > $@
250
251../../libntp/libntp.a:
252	cd ../../libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a
253
254check-libunity: ../unity/libunity.a
255	@echo stamp > $@
256
257../unity/libunity.a:
258	cd ../unity && $(MAKE) $(AM_MAKEFLAGS) libunity.a
259
260include $(top_srcdir)/depsver.mf
261include $(top_srcdir)/includes.mf
262