1# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2#
3# SPDX-License-Identifier: MPL-2.0
4#
5# This Source Code Form is subject to the terms of the Mozilla Public
6# License, v. 2.0.  If a copy of the MPL was not distributed with this
7# file, you can obtain one at https://mozilla.org/MPL/2.0/.
8#
9# See the COPYRIGHT file distributed with this work for additional
10# information regarding copyright ownership.
11
12srcdir =	@srcdir@
13VPATH =		@srcdir@
14top_srcdir =	@top_srcdir@
15
16VERSION=@BIND9_VERSION@
17
18@BIND9_MAKE_INCLUDES@
19
20CINCLUDES =	-I. -Iinclude ${ISC_INCLUDES} \
21		${OPENSSL_CFLAGS} @CMOCKA_CFLAGS@ \
22		${JSON_C_CFLAGS} \
23		${LIBUV_CFLAGS} \
24		${LIBXML2_CFLAGS}
25CDEFINES =	-DTESTS="\"${top_builddir}/lib/isc/tests/\""
26
27ISCLIBS =	../libisc.@A@ @NO_LIBTOOL_ISCLIBS@
28ISCDEPLIBS =	../libisc.@A@
29
30LIBS =		@LIBS@ @CMOCKA_LIBS@
31
32OBJS =		isctest.@O@
33
34SRCS =		isctest.c aes_test.c buffer_test.c \
35		counter_test.c crc64_test.c errno_test.c file_test.c hash_test.c \
36		heap_test.c hmac_test.c ht_test.c lex_test.c \
37		mem_test.c md_test.c netaddr_test.c netmgr_test.c \
38		parse_test.c pool_test.c \
39		quota_test.c radix_test.c random_test.c \
40		regex_test.c result_test.c safe_test.c siphash_test.c sockaddr_test.c \
41		socket_test.c stats_test.c symtab_test.c task_test.c \
42		taskpool_test.c time_test.c timer_test.c
43
44SUBDIRS =
45TARGETS =	aes_test@EXEEXT@ buffer_test@EXEEXT@ \
46		counter_test@EXEEXT@ crc64_test@EXEEXT@ \
47		errno_test@EXEEXT@ file_test@EXEEXT@ \
48		hash_test@EXEEXT@ heap_test@EXEEXT@ hmac_test@EXEEXT@ \
49		ht_test@EXEEXT@ lex_test@EXEEXT@ \
50		mem_test@EXEEXT@ md_test@EXEEXT@ \
51		netaddr_test@EXEEXT@ netmgr_test@EXEEXT@ \
52		parse_test@EXEEXT@ pool_test@EXEEXT@ \
53		quota_test@EXEEXT@ radix_test@EXEEXT@ \
54		random_test@EXEEXT@ regex_test@EXEEXT@ result_test@EXEEXT@ \
55		safe_test@EXEEXT@ siphash_test@EXEEXT@ sockaddr_test@EXEEXT@ \
56		socket_test@EXEEXT@ stats_test@EXEEXT@ symtab_test@EXEEXT@ \
57		task_test@EXEEXT@ taskpool_test@EXEEXT@ time_test@EXEEXT@ \
58		timer_test@EXEEXT@
59
60@BIND9_MAKE_RULES@
61
62aes_test@EXEEXT@: aes_test.@O@ ${ISCDEPLIBS}
63	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
64		${LDFLAGS} -o $@ aes_test.@O@ \
65		${ISCLIBS} ${LIBS}
66
67buffer_test@EXEEXT@: buffer_test.@O@ isctest.@O@ ${ISCDEPLIBS}
68	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
69		${LDFLAGS} -o $@ buffer_test.@O@ isctest.@O@ \
70		${ISCLIBS} ${LIBS}
71
72counter_test@EXEEXT@: counter_test.@O@ isctest.@O@ ${ISCDEPLIBS}
73	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
74		${LDFLAGS} -o $@ counter_test.@O@ isctest.@O@ \
75		${ISCLIBS} ${LIBS}
76
77crc64_test@EXEEXT@: crc64_test.@O@ ${ISCDEPLIBS}
78	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
79		${LDFLAGS} -o $@ crc64_test.@O@ \
80		${ISCLIBS} ${LIBS}
81
82errno_test@EXEEXT@: errno_test.@O@ ${ISCDEPLIBS}
83	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
84		${LDFLAGS} -o $@ errno_test.@O@ \
85		${ISCLIBS} ${LIBS}
86
87file_test@EXEEXT@: file_test.@O@ ${ISCDEPLIBS}
88	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
89		${LDFLAGS} -o $@ file_test.@O@ \
90		${ISCLIBS} ${LIBS}
91
92hash_test@EXEEXT@: hash_test.@O@ ${ISCDEPLIBS}
93	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
94		${LDFLAGS} -o $@ hash_test.@O@ \
95		${ISCLIBS} ${LIBS}
96
97heap_test@EXEEXT@: heap_test.@O@ isctest.@O@ ${ISCDEPLIBS}
98	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
99		${LDFLAGS} -o $@ heap_test.@O@ isctest.@O@ \
100		${ISCLIBS} ${LIBS}
101
102hmac_test@EXEEXT@: hmac_test.@O@ ${ISCDEPLIBS}
103	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
104		${LDFLAGS} -o $@ hmac_test.@O@ \
105		${ISCLIBS} ${OPENSSL_LIBS} ${LIBS}
106
107ht_test@EXEEXT@: ht_test.@O@ isctest.@O@ ${ISCDEPLIBS}
108	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
109		${LDFLAGS} -o $@ ht_test.@O@ isctest.@O@ \
110		${ISCLIBS} ${LIBS}
111
112lex_test@EXEEXT@: lex_test.@O@ isctest.@O@ ${ISCDEPLIBS}
113	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
114		${LDFLAGS} -o $@ lex_test.@O@ isctest.@O@ \
115		${ISCLIBS} ${LIBS}
116
117md_test@EXEEXT@: md_test.@O@ ${ISCDEPLIBS}
118	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
119		${LDFLAGS} -o $@ md_test.@O@ \
120		${ISCLIBS} ${OPENSSL_LIBS} ${LIBS}
121
122mem_test@EXEEXT@: mem_test.@O@ isctest.@O@ ${ISCDEPLIBS}
123	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
124		${LDFLAGS} -o $@ mem_test.@O@ isctest.@O@ \
125		${ISCLIBS} ${LIBS}
126
127netaddr_test@EXEEXT@: netaddr_test.@O@ ${ISCDEPLIBS}
128	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
129		${LDFLAGS} -o $@ netaddr_test.@O@ \
130		${ISCLIBS} ${LIBS}
131
132parse_test@EXEEXT@: parse_test.@O@ isctest.@O@ ${ISCDEPLIBS}
133	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
134		${LDFLAGS} -o $@ parse_test.@O@ isctest.@O@ \
135		${ISCLIBS} ${LIBS}
136
137pool_test@EXEEXT@: pool_test.@O@ isctest.@O@ ${ISCDEPLIBS}
138	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
139		${LDFLAGS} -o $@ pool_test.@O@ isctest.@O@ \
140		${ISCLIBS} ${LIBS}
141
142quota_test@EXEEXT@: quota_test.@O@ isctest.@O@ ${ISCDEPLIBS}
143	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
144		${LDFLAGS} -o $@ quota_test.@O@ isctest.@O@ \
145		${ISCLIBS} ${LIBS}
146
147radix_test@EXEEXT@: radix_test.@O@ isctest.@O@ ${ISCDEPLIBS}
148	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
149		${LDFLAGS} -o $@ radix_test.@O@ isctest.@O@ \
150		${ISCLIBS} ${LIBS}
151
152random_test@EXEEXT@: random_test.@O@ isctest.@O@ ${ISCDEPLIBS}
153	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
154		${LDFLAGS} -o $@ random_test.@O@ isctest.@O@ \
155		${ISCLIBS} ${LIBS} -lm
156
157regex_test@EXEEXT@: regex_test.@O@ ${ISCDEPLIBS}
158	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
159		${LDFLAGS} -o $@ regex_test.@O@ \
160		${ISCLIBS} ${LIBS}
161
162result_test@EXEEXT@: result_test.@O@ ${ISCDEPLIBS}
163	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
164		${LDFLAGS} -o $@ result_test.@O@ \
165		${ISCLIBS} ${LIBS}
166
167safe_test@EXEEXT@: safe_test.@O@ ${ISCDEPLIBS}
168	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
169		${LDFLAGS} -o $@ safe_test.@O@ \
170		${ISCLIBS} ${LIBS}
171
172siphash_test@EXEEXT@: siphash_test.@O@ ../siphash.c ${ISCDEPLIBS}
173	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
174		${LDFLAGS} -o $@ siphash_test.@O@ \
175		${ISCLIBS} ${LIBS}
176
177socket_test@EXEEXT@: socket_test.@O@ isctest.@O@ ${ISCDEPLIBS}
178	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
179		${LDFLAGS} -o $@ socket_test.@O@ isctest.@O@ \
180		${ISCLIBS} ${LIBS}
181
182sockaddr_test@EXEEXT@: sockaddr_test.@O@ isctest.@O@ ${ISCDEPLIBS}
183	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
184		${LDFLAGS} -o $@ sockaddr_test.@O@ isctest.@O@ \
185		${ISCLIBS} ${LIBS}
186
187stats_test@EXEEXT@: stats_test.@O@ isctest.@O@ ${ISCDEPLIBS}
188	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
189		${LDFLAGS} -o $@ stats_test.@O@ isctest.@O@ \
190		${ISCLIBS} ${LIBS}
191
192symtab_test@EXEEXT@: symtab_test.@O@ isctest.@O@ ${ISCDEPLIBS}
193	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
194		${LDFLAGS} -o $@ symtab_test.@O@ isctest.@O@ \
195		${ISCLIBS} ${LIBS}
196
197task_test@EXEEXT@: task_test.@O@ isctest.@O@ ${ISCDEPLIBS}
198	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
199		${LDFLAGS} -o $@ task_test.@O@ isctest.@O@ \
200		${ISCLIBS} ${LIBS}
201
202taskpool_test@EXEEXT@: taskpool_test.@O@ isctest.@O@ ${ISCDEPLIBS}
203	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
204		${LDFLAGS} -o $@ taskpool_test.@O@ isctest.@O@ \
205		${ISCLIBS} ${LIBS}
206
207netmgr_test@EXEEXT@: netmgr_test.@O@ isctest.@O@ ${ISCDEPLIBS}
208	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
209		${LDFLAGS} -o $@ netmgr_test.@O@ isctest.@O@ \
210		${ISCLIBS} ${LIBS} ${LIBUV_LIBS}
211
212time_test@EXEEXT@: time_test.@O@ ${ISCDEPLIBS}
213	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
214		${LDFLAGS} -o $@ time_test.@O@ \
215		${ISCLIBS} ${LIBS}
216
217timer_test@EXEEXT@: timer_test.@O@ isctest.@O@ ${ISCDEPLIBS}
218	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} \
219		${LDFLAGS} -o $@ timer_test.@O@ isctest.@O@ \
220		${ISCLIBS} ${LIBS}
221
222unit::
223	sh ${top_builddir}/unit/unittest.sh
224
225clean distclean::
226	rm -f ${TARGETS}
227	rm -f atf.out
228