elf: Ignore LD_LIBRARY_PATH and debug env var for setuid for static
[glibc.git] / resolv / Makefile
blob2f99eb38625fecc1343c10e1c6669fa747870300
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-noaaaa-vc \
106 tst-resolv-nondecimal \
107 tst-resolv-res_init-multi \
108 tst-resolv-search \
109 tst-resolv-trailing \
111 # This test calls __res_context_send directly, which is not exported
112 # from libresolv.
113 tests-internal += tst-resolv-txnid-collision
114 tests-static += tst-resolv-txnid-collision
116 # Likewise for __ns_samebinaryname.
117 tests-internal += tst-ns_samebinaryname
118 tests-static += tst-ns_samebinaryname
120 # Likewise for __ns_name_length_uncompressed.
121 tests-internal += tst-ns_name_length_uncompressed
122 tests-static += tst-ns_name_length_uncompressed
124 # Likewise for struct ns_rr_cursor and its functions.
125 tests-internal += tst-ns_rr_cursor
126 tests-static += tst-ns_rr_cursor
128 # These tests need libdl.
129 ifeq (yes,$(build-shared))
130 tests += \
131 tst-resolv-ai_idn \
132 tst-resolv-ai_idn-latin1 \
133 tst-resolv-ai_idn-nolibidn2 \
134 tst-resolv-canonname \
135 tst-resolv-trustad \
137 # Needs resolv_context.
138 tests-internal += \
139 tst-resolv-res_init \
140 tst-resolv-res_init-thread \
141 tst-resolv-res_ninit \
142 tst-resolv-threads \
144 # Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
145 # providing any functions in libidn2.so.0).
146 modules-names += tst-no-libidn2
147 extra-test-objs += tst-no-libidn2.os
148 LDFLAGS-tst-no-libidn2.so = -Wl,-soname,libidn2.so.0
150 endif # $(build-shared)
152 # This test accesses __inet_ntop_length, an internal libc function.
153 tests-internal += tst-inet_pton
155 # This test accesses the __p_secstodate compat symbol.
156 ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
157 tests += tst-p_secstodate
158 endif
160 # This test sends millions of packets and is rather slow.
161 xtests += tst-resolv-qtypes
163 # This test has dropped packet tests and runs for a long time.
164 xtests += tst-resolv-rotate
165 endif # $(have-thread-library)
167 extra-libs-others = $(extra-libs)
168 libresolv-routines := \
169 base64 \
170 compat-gethnamaddr \
171 compat-hooks \
172 inet_net_ntop \
173 inet_net_pton \
174 inet_neta \
175 ns_date \
176 ns_name \
177 ns_netint \
178 ns_parse \
179 ns_print \
180 ns_samedomain \
181 ns_ttl \
182 res-putget \
183 res_data \
184 res_debug \
185 res_hostalias \
186 res_isourserver \
187 resolv-deprecated \
188 # libresolv-routines
190 ifeq ($(have-anl-library),yes)
191 # Empty compatibility library for old binaries.
192 extra-libs += libanl
193 libanl-routines += libanl-compat
194 libanl-shared-only-routines += libanl-compat
195 endif
197 $(libanl-routines-var) += \
198 gai_cancel \
199 gai_error \
200 gai_misc \
201 gai_notify \
202 gai_suspend \
203 getaddrinfo_a \
204 # $(libanl-routines-var)
206 # Pretend that libanl.so is a linker script, so that the symbolic link
207 # is not installed.
208 install-lib-ldscripts = libanl.so
209 $(inst_libdir)/libanl.so:
211 subdir-dirs = nss_dns
212 vpath %.c nss_dns
214 # Build only an empty shared libnss_dns.
215 libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
217 # Pretend that libnss_dns.so is a linker script, so that the symbolic link
218 # is not installed.
219 install-lib-ldscripts = libnss_dns.so
220 $(inst_libdir)/libnss_dns.so:
222 ifeq ($(run-built-tests),yes)
223 ifneq (no,$(PERL))
224 tests-special += $(objpfx)mtrace-tst-leaks.out $(objpfx)mtrace-tst-leaks2.out \
225 $(objpfx)mtrace-tst-resolv-res_ninit.out
226 endif
227 endif
229 generated += mtrace-tst-leaks.out tst-leaks.mtrace \
230 mtrace-tst-leaks2.out tst-leaks2.mtrace \
231 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
233 include ../Rules
235 LOCALES := en_US.UTF-8 en_US.ISO-8859-1
236 include ../gen-locales.mk
238 CFLAGS-res_hconf.c += -fexceptions
239 CFLAGS-inet_pton.c += $(config-cflags-wno-ignored-attributes)
241 # The DNS NSS modules needs the resolver.
242 $(objpfx)libnss_dns.so: $(objpfx)libresolv.so
244 # The asynchronous name lookup code needs the thread library.
245 $(objpfx)libanl.so: $(shared-thread-library)
247 $(objpfx)tst-res_hconf_reorder: $(shared-thread-library)
248 tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
250 $(objpfx)tst-leaks: $(objpfx)libresolv.so
251 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
252 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
253 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
254 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
255 $(evaluate-test)
257 tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace \
258 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
259 $(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
260 { test -r $(objpfx)tst-leaks2.mtrace \
261 || ( echo "tst-leaks2.mtrace does not exist"; exit 77; ) \
262 && $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace; } > $@; \
263 $(evaluate-test)
265 tst-resolv-res_ninit-ENV = MALLOC_TRACE=$(objpfx)tst-resolv-res_ninit.mtrace \
266 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
267 $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
268 $(common-objpfx)malloc/mtrace \
269 $(objpfx)tst-resolv-res_ninit.mtrace > $@; \
270 $(evaluate-test)
272 $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
273 $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
274 $(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
275 $(objpfx)tst-resolv-ai_idn-latin1: \
276 $(objpfx)libresolv.so $(shared-thread-library)
277 $(objpfx)tst-resolv-ai_idn-nolibidn2: \
278 $(objpfx)libresolv.so $(shared-thread-library)
279 $(objpfx)tst-resolv-ai_idn.out: $(gen-locales)
280 $(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)
281 $(objpfx)tst-resolv-ai_idn-nolibidn2.out: \
282 $(gen-locales) $(objpfx)tst-no-libidn2.so
283 $(objpfx)tst-resolv-aliases: $(objpfx)libresolv.so $(shared-thread-library)
284 $(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)
285 $(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)
286 $(objpfx)tst-resolv-byaddr: $(objpfx)libresolv.so $(shared-thread-library)
287 $(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)
288 $(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)
289 $(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so
290 $(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \
291 $(shared-thread-library)
292 $(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \
293 $(shared-thread-library)
294 $(objpfx)tst-resolv-invalid-cname: $(objpfx)libresolv.so \
295 $(shared-thread-library)
296 $(objpfx)tst-resolv-noaaaa: $(objpfx)libresolv.so $(shared-thread-library)
297 $(objpfx)tst-resolv-noaaaa-vc: $(objpfx)libresolv.so $(shared-thread-library)
298 $(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)
299 $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
300 $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)
301 $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
302 $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
303 $(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)
304 $(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
305 $(static-thread-library)
306 $(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)
307 $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
309 $(objpfx)tst-ns_name: $(objpfx)libresolv.so
310 $(objpfx)tst-ns_name.out: tst-ns_name.data
311 $(objpfx)tst-ns_name_compress: $(objpfx)libresolv.so
312 $(objpfx)tst-ns_name_pton: $(objpfx)libresolv.so
313 $(objpfx)tst-res_hnok: $(objpfx)libresolv.so
314 $(objpfx)tst-p_secstodate: $(objpfx)libresolv.so