xref: /netbsd-src/external/bsd/ntp/dist/tests/ntpd/Makefile.am (revision 3587d6f89c746bbb4f886219ddacd41ace480ecf)
1NULL =
2BUILT_SOURCES =
3CLEANFILES =
4
5std_unity_list =							\
6	$(abs_top_srcdir)/sntp/unity/auto/generate_test_runner.rb	\
7	$(abs_srcdir)/testconf.yml					\
8	$(NULL)
9
10run_unity =	ruby $(std_unity_list)
11
12EXTRA_DIST =				\
13	testconf.yml			\
14	$(NULL)
15
16check_PROGRAMS =		\
17	test-leapsec		\
18	test-ntp_prio_q		\
19	$(NULL)
20if BUILD_TEST_NTP_RESTRICT
21check_PROGRAMS += test-ntp_restrict
22endif
23if BUILD_TEST_NTP_SCANNER
24check_PROGRAMS += test-ntp_scanner
25endif
26if BUILD_TEST_NTP_SIGND
27check_PROGRAMS += test-ntp_signd
28endif
29check_PROGRAMS += 		\
30	test-rc_cmdlength	\
31	$(NULL)
32
33EXTRA_PROGRAMS =		\
34	test-ntp_restrict	\
35	test-ntp_scanner	\
36	test-ntp_signd		\
37	$(NULL)
38
39
40LDADD =					\
41	$(top_builddir)/ntpd/libntpd.a	\
42	$(top_builddir)/libntp/libntp.a	\
43	$(LDADD_LIBNTP)			\
44	$(PTHREAD_LIBS)			\
45	$(LDADD_NTP)			\
46	$(NULL)
47
48unity_tests_LDADD =				\
49	$(LDADD)				\
50	$(top_builddir)/sntp/unity/libunity.a	\
51	$(LIBM)					\
52	$(NULL)
53
54AM_CFLAGS   = $(CFLAGS_NTP)
55AM_CFLAGS += $(NTP_HARD_CFLAGS)
56
57AM_CPPFLAGS  = $(NTP_INCS)
58AM_CPPFLAGS += -I$(top_srcdir)/sntp
59AM_CPPFLAGS += -I$(top_srcdir)/ntpd
60AM_CPPFLAGS += -I$(top_srcdir)/tests/libntp
61AM_CPPFLAGS += $(CPPFLAGS_NTP)
62AM_CPPFLAGS += -DUNITY_INCLUDE_CONFIG_H
63AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity
64AM_CPPFLAGS += $(NTP_HARD_CPPFLAGS)
65
66AM_LDFLAGS  = $(LDFLAGS_NTP)
67AM_LDFLAGS += $(NTP_HARD_LDFLAGS)
68
69BUILT_SOURCES +=			\
70	$(srcdir)/run-leapsec.c		\
71	$(srcdir)/run-ntp_prio_q.c	\
72	$(srcdir)/run-ntp_restrict.c	\
73	$(srcdir)/run-rc_cmdlength.c	\
74	$(srcdir)/run-t-ntp_signd.c	\
75	$(NULL)
76
77###
78
79test_leapsec_CFLAGS = 			\
80	$(AM_CFLAGS)			\
81	-I$(top_srcdir)/sntp/unity	\
82	$(NULL)
83
84# Might need pthread support
85test_leapsec_LDADD =			\
86	$(unity_tests_LDADD)		\
87	$(NULL)
88
89test_leapsec_SOURCES =			\
90	leapsec.c			\
91	run-leapsec.c			\
92	$(srcdir)/../libntp/test-libntp.c		\
93	$(NULL)
94
95$(srcdir)/run-leapsec.c: $(srcdir)/leapsec.c $(std_unity_list)
96	$(run_unity) $< $@
97
98###
99test_ntp_prio_q_CFLAGS =		\
100	$(AM_CFLAGS)			\
101	-I$(top_srcdir)/sntp/unity	\
102	$(NULL)
103
104test_ntp_prio_q_LDADD =			\
105	$(unity_tests_LDADD)		\
106	../../ntpd/ntpdsim-ntp_prio_q.o	\
107	$(NULL)
108
109test_ntp_prio_q_SOURCES =			\
110	ntp_prio_q.c				\
111	run-ntp_prio_q.c			\
112	$(srcdir)/../libntp/test-libntp.c	\
113	$(NULL)
114
115$(srcdir)/run-ntp_prio_q.c: $(srcdir)/ntp_prio_q.c $(std_unity_list)
116	$(run_unity) $< $@
117
118
119###
120test_ntp_restrict_CFLAGS =		\
121	$(AM_CFLAGS)			\
122	-I$(top_srcdir)/sntp/unity	\
123	$(NULL)
124
125test_ntp_restrict_LDADD =		\
126	$(unity_tests_LDADD)		\
127	$(NULL)
128
129test_ntp_restrict_SOURCES =		\
130	ntp_restrict.c			\
131	run-ntp_restrict.c		\
132	$(srcdir)/../libntp/test-libntp.c	\
133	$(NULL)
134
135$(srcdir)/run-ntp_restrict.c: $(srcdir)/ntp_restrict.c $(std_unity_list)
136	$(run_unity) $< $@
137
138
139
140###
141test_rc_cmdlength_CFLAGS =		\
142	$(AM_CFLAGS)			\
143	-I$(top_srcdir)/sntp/unity	\
144	$(NULL)
145
146test_rc_cmdlength_LDADD =		\
147	$(unity_tests_LDADD)		\
148	$(NULL)
149
150test_rc_cmdlength_SOURCES =		\
151	rc_cmdlength.c			\
152	run-rc_cmdlength.c		\
153	$(srcdir)/../libntp/test-libntp.c	\
154	$(NULL)
155
156$(srcdir)/run-rc_cmdlength.c: $(srcdir)/rc_cmdlength.c $(std_unity_list)
157	$(run_unity) $< $@
158
159###
160
161test_ntp_signd_LDADD =			\
162	$(unity_tests_LDADD)		\
163	$(top_builddir)/ntpd/ntp_config.o	\
164	$(top_builddir)/ntpd/ntp_io.o	\
165	$(NULL)
166
167test_ntp_signd_SOURCES =			\
168	t-ntp_signd.c				\
169	run-t-ntp_signd.c			\
170	$(srcdir)/../libntp/test-libntp.c	\
171	$(NULL)
172
173$(srcdir)/run-t-ntp_signd.c: $(srcdir)/t-ntp_signd.c $(std_unity_list)
174	$(run_unity) $< $@
175
176###
177test_ntp_scanner_CFLAGS =		\
178	$(AM_CFLAGS)			\
179	-I$(top_srcdir)/sntp/unity	\
180	$(NULL)
181
182test_ntp_scanner_LDADD =		\
183	$(unity_tests_LDADD)		\
184	$(top_builddir)/ntpd/ntp_config.o	\
185	$(top_builddir)/ntpd/ntp_io.o		\
186	$(top_builddir)/ntpd/ntp_parser.o	\
187	$(NULL)
188
189test_ntp_scanner_SOURCES =			\
190	t-ntp_scanner.c				\
191	run-t-ntp_scanner.c			\
192	$(srcdir)/../libntp/test-libntp.c	\
193	$(NULL)
194
195$(srcdir)/run-t-ntp_scanner.c: $(srcdir)/t-ntp_scanner.c $(std_unity_list)
196	$(run_unity) $< $@
197
198
199TESTS =
200
201if !NTP_CROSSCOMPILE
202TESTS += $(check_PROGRAMS)
203endif
204
205## check-libntp.mf - automake fragment
206## slightly adapted for deeper directory
207
208BUILT_SOURCES	+= check-libntpd check-libntp check-libunity
209CLEANFILES	+= check-libntpd check-libntp check-libunity
210
211check-libntpd: ../../ntpd/libntpd.a
212	@echo stamp > $@
213
214../../ntpd/libntpd.a:
215	cd ../../ntpd && $(MAKE) $(AM_MAKEFLAGS) libntpd.a
216
217
218check-libntp: ../../libntp/libntp.a
219	@echo stamp > $@
220
221../../libntp/libntp.a:
222	cd ../../libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a
223
224
225check-libunity: ../../sntp/unity/libunity.a
226	@echo stamp > $@
227
228../../sntp/unity/libunity.a:
229	cd ../../sntp/unity && $(MAKE) $(AM_MAKEFLAGS) libunity.a
230
231$(top_builddir)/ntpd/ntpdsim-ntp_prio_q.o:
232	cd ../../ntpd/ && $(MAKE) $(AM_MAKEFLAGS) ntpdsim-ntp_prio_q.o
233
234include $(top_srcdir)/depsver.mf
235include $(top_srcdir)/includes.mf
236