stdio-common: Reformat Makefile.
[glibc.git] / resolv / Makefile
blob054b1fa36ca5b68acb007ecc6307b7a0c5e362b2
1 # Copyright (C) 1994-2023 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
19 # Sub-makefile for resolv portion of the library.
21 subdir := resolv
23 include ../Makeconfig
25 headers := resolv.h bits/types/res_state.h \
26 netdb.h bits/netdb.h \
27 arpa/nameser.h arpa/nameser_compat.h \
28 sys/bitypes.h
30 routines := \
31 dn_comp \
32 dn_expand \
33 dn_skipname \
34 dns-canon \
35 dns-host \
36 dns-network \
37 herror \
38 inet_addr \
39 inet_ntop \
40 inet_pton \
41 ns_makecanon \
42 ns_name_compress \
43 ns_name_length_uncompressed \
44 ns_name_ntop \
45 ns_name_pack \
46 ns_name_pton \
47 ns_name_skip \
48 ns_name_uncompress \
49 ns_name_unpack \
50 ns_rr_cursor_init \
51 ns_rr_cursor_next \
52 ns_samebinaryname \
53 ns_samename \
54 nsap_addr \
55 nss_dns_functions \
56 res-close \
57 res-name-checking \
58 res-noaaaa \
59 res-state \
60 res_context_hostalias \
61 res_enable_icmp \
62 res_get_nsaddr \
63 res_hconf \
64 res_init \
65 res_libc \
66 res_mkquery \
67 res_nameinquery \
68 res_queriesmatch \
69 res_query \
70 res_randomid \
71 res_send \
72 resolv_conf \
73 resolv_context \
74 # routines
76 tests = tst-aton tst-leaks tst-inet_ntop
77 tests-container = tst-leaks2
79 tests-internal += tst-inet_aton_exact
82 generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
84 extra-libs := libresolv libnss_dns
85 ifeq ($(have-thread-library),yes)
86 routines += gai_sigqueue
88 tests += \
89 tst-bug18665 \
90 tst-bug18665-tcp \
91 tst-inet_addr-binary \
92 tst-ns_name \
93 tst-ns_name_compress \
94 tst-ns_name_pton \
95 tst-res_hconf_reorder \
96 tst-res_hnok \
97 tst-resolv-aliases \
98 tst-resolv-basic \
99 tst-resolv-binary \
100 tst-resolv-byaddr \
101 tst-resolv-edns \
102 tst-resolv-invalid-cname \
103 tst-resolv-network \
104 tst-resolv-noaaaa \
105 tst-resolv-nondecimal \
106 tst-resolv-res_init-multi \
107 tst-resolv-search \
108 tst-resolv-trailing \
110 # This test calls __res_context_send directly, which is not exported
111 # from libresolv.
112 tests-internal += tst-resolv-txnid-collision
113 tests-static += tst-resolv-txnid-collision
115 # Likewise for __ns_samebinaryname.
116 tests-internal += tst-ns_samebinaryname
117 tests-static += tst-ns_samebinaryname
119 # Likewise for __ns_name_length_uncompressed.
120 tests-internal += tst-ns_name_length_uncompressed
121 tests-static += tst-ns_name_length_uncompressed
123 # Likewise for struct ns_rr_cursor and its functions.
124 tests-internal += tst-ns_rr_cursor
125 tests-static += tst-ns_rr_cursor
127 # These tests need libdl.
128 ifeq (yes,$(build-shared))
129 tests += \
130 tst-resolv-ai_idn \
131 tst-resolv-ai_idn-latin1 \
132 tst-resolv-ai_idn-nolibidn2 \
133 tst-resolv-canonname \
134 tst-resolv-trustad \
136 # Needs resolv_context.
137 tests-internal += \
138 tst-resolv-res_init \
139 tst-resolv-res_init-thread \
140 tst-resolv-res_ninit \
141 tst-resolv-threads \
143 # Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
144 # providing any functions in libidn2.so.0).
145 modules-names += tst-no-libidn2
146 extra-test-objs += tst-no-libidn2.os
147 LDFLAGS-tst-no-libidn2.so = -Wl,-soname,libidn2.so.0
149 endif # $(build-shared)
151 # This test accesses __inet_ntop_length, an internal libc function.
152 tests-internal += tst-inet_pton
154 # This test accesses the __p_secstodate compat symbol.
155 ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
156 tests += tst-p_secstodate
157 endif
159 # This test sends millions of packets and is rather slow.
160 xtests += tst-resolv-qtypes
162 # This test has dropped packet tests and runs for a long time.
163 xtests += tst-resolv-rotate
164 endif # $(have-thread-library)
166 extra-libs-others = $(extra-libs)
167 libresolv-routines := \
168 base64 \
169 compat-gethnamaddr \
170 compat-hooks \
171 inet_net_ntop \
172 inet_net_pton \
173 inet_neta \
174 ns_date \
175 ns_name \
176 ns_netint \
177 ns_parse \
178 ns_print \
179 ns_samedomain \
180 ns_ttl \
181 res-putget \
182 res_data \
183 res_debug \
184 res_hostalias \
185 res_isourserver \
186 resolv-deprecated \
187 # libresolv-routines
189 ifeq ($(have-anl-library),yes)
190 # Empty compatibility library for old binaries.
191 extra-libs += libanl
192 libanl-routines += libanl-compat
193 libanl-shared-only-routines += libanl-compat
194 endif
196 $(libanl-routines-var) += \
197 gai_cancel \
198 gai_error \
199 gai_misc \
200 gai_notify \
201 gai_suspend \
202 getaddrinfo_a \
203 # $(libanl-routines-var)
205 # Pretend that libanl.so is a linker script, so that the symbolic link
206 # is not installed.
207 install-lib-ldscripts = libanl.so
208 $(inst_libdir)/libanl.so:
210 subdir-dirs = nss_dns
211 vpath %.c nss_dns
213 # Build only an empty shared libnss_dns.
214 libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
216 # Pretend that libnss_dns.so is a linker script, so that the symbolic link
217 # is not installed.
218 install-lib-ldscripts = libnss_dns.so
219 $(inst_libdir)/libnss_dns.so:
221 ifeq ($(run-built-tests),yes)
222 ifneq (no,$(PERL))
223 tests-special += $(objpfx)mtrace-tst-leaks.out $(objpfx)mtrace-tst-leaks2.out \
224 $(objpfx)mtrace-tst-resolv-res_ninit.out
225 endif
226 endif
228 generated += mtrace-tst-leaks.out tst-leaks.mtrace \
229 mtrace-tst-leaks2.out tst-leaks2.mtrace \
230 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
232 include ../Rules
234 LOCALES := en_US.UTF-8 en_US.ISO-8859-1
235 include ../gen-locales.mk
237 CFLAGS-res_hconf.c += -fexceptions
238 CFLAGS-inet_pton.c += $(config-cflags-wno-ignored-attributes)
240 # The DNS NSS modules needs the resolver.
241 $(objpfx)libnss_dns.so: $(objpfx)libresolv.so
243 # The asynchronous name lookup code needs the thread library.
244 $(objpfx)libanl.so: $(shared-thread-library)
246 $(objpfx)tst-res_hconf_reorder: $(shared-thread-library)
247 tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
249 $(objpfx)tst-leaks: $(objpfx)libresolv.so
250 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
251 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
252 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
253 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
254 $(evaluate-test)
256 tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace \
257 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
258 $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
259 { test -r $(objpfx)tst-leaks2.mtrace \
260 || ( echo "tst-leaks2.mtrace does not exist"; exit 77; ) \
261 && $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace; } > $@; \
262 $(evaluate-test)
264 tst-resolv-res_ninit-ENV = MALLOC_TRACE=$(objpfx)tst-resolv-res_ninit.mtrace \
265 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
266 $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
267 $(common-objpfx)malloc/mtrace \
268 $(objpfx)tst-resolv-res_ninit.mtrace > $@; \
269 $(evaluate-test)
271 $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
272 $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
273 $(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
274 $(objpfx)tst-resolv-ai_idn-latin1: \
275 $(objpfx)libresolv.so $(shared-thread-library)
276 $(objpfx)tst-resolv-ai_idn-nolibidn2: \
277 $(objpfx)libresolv.so $(shared-thread-library)
278 $(objpfx)tst-resolv-ai_idn.out: $(gen-locales)
279 $(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)
280 $(objpfx)tst-resolv-ai_idn-nolibidn2.out: \
281 $(gen-locales) $(objpfx)tst-no-libidn2.so
282 $(objpfx)tst-resolv-aliases: $(objpfx)libresolv.so $(shared-thread-library)
283 $(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)
284 $(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)
285 $(objpfx)tst-resolv-byaddr: $(objpfx)libresolv.so $(shared-thread-library)
286 $(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)
287 $(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)
288 $(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so
289 $(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \
290 $(shared-thread-library)
291 $(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \
292 $(shared-thread-library)
293 $(objpfx)tst-resolv-invalid-cname: $(objpfx)libresolv.so \
294 $(shared-thread-library)
295 $(objpfx)tst-resolv-noaaaa: $(objpfx)libresolv.so $(shared-thread-library)
296 $(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)
297 $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
298 $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)
299 $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
300 $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
301 $(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)
302 $(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
303 $(static-thread-library)
304 $(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)
305 $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
307 $(objpfx)tst-ns_name: $(objpfx)libresolv.so
308 $(objpfx)tst-ns_name.out: tst-ns_name.data
309 $(objpfx)tst-ns_name_compress: $(objpfx)libresolv.so
310 $(objpfx)tst-ns_name_pton: $(objpfx)libresolv.so
311 $(objpfx)tst-res_hnok: $(objpfx)libresolv.so
312 $(objpfx)tst-p_secstodate: $(objpfx)libresolv.so