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