]> git.ipfire.org Git - thirdparty/glibc.git/blame - resolv/Makefile
resolv: Move ns_makecanon into its own file, and into libc
[thirdparty/glibc.git] / resolv / Makefile
CommitLineData
2b778ceb 1# Copyright (C) 1994-2021 Free Software Foundation, Inc.
28f540f4
RM
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
28f540f4
RM
8
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
41bdb6e2 12# Lesser General Public License for more details.
28f540f4 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6 15# License along with the GNU C Library; if not, see
5a82c748 16# <https://www.gnu.org/licenses/>.
28f540f4
RM
17
18#
19# Sub-makefile for resolv portion of the library.
20#
21subdir := resolv
22
a5f891ac
JM
23include ../Makeconfig
24
500b3a49 25headers := resolv.h bits/types/res_state.h \
c6d80202
RM
26 netdb.h bits/netdb.h \
27 arpa/nameser.h arpa/nameser_compat.h \
6500dff6 28 sys/bitypes.h
28f540f4 29
389c1114 30routines := \
fd8a87c0 31 dn_comp \
640bbdf7 32 dn_expand \
391e0223 33 dn_skipname \
389c1114
FW
34 herror \
35 inet_addr \
36 inet_ntop \
37 inet_pton \
08d4a980 38 ns_makecanon \
13e1f867 39 ns_name_compress \
adcc572a 40 ns_name_ntop \
7ed1ac6d 41 ns_name_pack \
276e9822 42 ns_name_pton \
cff2c78c 43 ns_name_skip \
4e1d3db1 44 ns_name_uncompress \
820bb23f 45 ns_name_unpack \
389c1114
FW
46 nsap_addr \
47 res-close \
2fbe5860 48 res-name-checking \
389c1114 49 res-state \
9515126f 50 res_get_nsaddr \
389c1114
FW
51 res_hconf \
52 res_init \
53 res_libc \
54 res_randomid \
55 resolv_conf \
56 resolv_context \
57 # routines
282d8743 58
37f02b1d 59tests = tst-aton tst-leaks tst-inet_ntop
29fddfc7 60tests-container = tst-leaks2
b062f051 61
108bc404
FW
62tests-internal += tst-inet_aton_exact
63
64
0b20a9e8 65generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
0696c2c0 66
e10546cb
AJ
67extra-libs := libresolv libnss_dns
68ifeq ($(have-thread-library),yes)
69extra-libs += libanl
3897dbb6 70routines += gai_sigqueue
5840c75c
FW
71
72tests += \
73 tst-bug18665 \
74 tst-bug18665-tcp \
07d6f1a3 75 tst-ns_name \
c803cb9b 76 tst-ns_name_compress \
e2a9fca8 77 tst-ns_name_pton \
5840c75c 78 tst-res_hconf_reorder \
5c1a6923 79 tst-res_hnok \
5840c75c 80 tst-resolv-basic \
401311cf 81 tst-resolv-binary \
e14a2772 82 tst-resolv-edns \
5840c75c 83 tst-resolv-network \
108bc404 84 tst-resolv-nondecimal \
89f6307c 85 tst-resolv-res_init-multi \
5840c75c 86 tst-resolv-search \
108bc404 87 tst-resolv-trailing \
5840c75c 88
f1f00c07
FW
89# This test calls __res_context_send directly, which is not exported
90# from libresolv.
91tests-internal += tst-resolv-txnid-collision
92tests-static += tst-resolv-txnid-collision
93
c3261cdb
FW
94# These tests need libdl.
95ifeq (yes,$(build-shared))
96tests += \
7f9f1ecb
FW
97 tst-resolv-ai_idn \
98 tst-resolv-ai_idn-latin1 \
99 tst-resolv-ai_idn-nolibidn2 \
c3261cdb 100 tst-resolv-canonname \
446997ff 101 tst-resolv-trustad \
c3261cdb 102
3f8b44be 103# Needs resolv_context.
2714c5f3
FW
104tests-internal += \
105 tst-resolv-res_init \
106 tst-resolv-res_init-thread \
cb3c27e8
FW
107 tst-resolv-res_ninit \
108 tst-resolv-threads \
e237357a 109
7f9f1ecb
FW
110# Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
111# providing any functions in libidn2.so.0).
112modules-names += tst-no-libidn2
113extra-test-objs += tst-no-libidn2.os
114LDFLAGS-tst-no-libidn2.so = -Wl,-soname,libidn2.so.0
115
116endif # $(build-shared)
c3261cdb 117
44dade71 118# This test accesses __inet_ntop_length, an internal libc function.
60149b28
FW
119tests-internal += tst-inet_pton
120
754034c4 121# This test accesses the __p_secstodate compat symbol.
cfaf5367
FW
122ifeq ($(have-GLIBC_2.26)$(build-shared),yesyes)
123tests += tst-p_secstodate
124endif
754034c4 125
fc82b0a2
FW
126# This test sends millions of packets and is rather slow.
127xtests += tst-resolv-qtypes
5b757a51
FW
128
129# This test has dropped packet tests and runs for a long time.
130xtests += tst-resolv-rotate
e10546cb 131endif
f0f1bf85 132extra-libs-others = $(extra-libs)
389c1114
FW
133libresolv-routines := \
134 base64 \
135 compat-gethnamaddr \
136 compat-hooks \
137 inet_net_ntop \
138 inet_net_pton \
139 inet_neta \
140 ns_date \
141 ns_name \
142 ns_netint \
143 ns_parse \
144 ns_print \
145 ns_samedomain \
146 ns_ttl \
7ec366a0 147 res-putget \
389c1114
FW
148 res_data \
149 res_debug \
150 res_enable_icmp \
17d0407a 151 res_isourserver \
389c1114
FW
152 res_mkquery \
153 res_query \
154 res_send \
08d4a980 155 resolv-deprecated \
389c1114 156 # libresolv-routines
28f540f4 157
dbb949f5 158$(libanl-routines-var) += \
389c1114
FW
159 gai_cancel \
160 gai_error \
161 gai_misc \
162 gai_notify \
163 gai_suspend \
164 getaddrinfo_a \
165 # $(libanl-routines-var)
dbb949f5
FW
166
167libanl-routines += libanl-compat
168libanl-shared-only-routines += libanl-compat
2ace5721 169
fd26970f 170subdir-dirs = nss_dns
68dbb3a6
UD
171vpath %.c nss_dns
172
389c1114
FW
173libnss_dns-routines := \
174 dns-canon \
175 dns-host \
176 dns-network \
177 # libnss_dns-routines
178
40a55d20 179libnss_dns-inhibit-o = $(filter-out .os,$(object-suffixes))
3ff42526
PP
180ifeq ($(build-static-nss),yes)
181routines += $(libnss_dns-routines) $(libresolv-routines)
182static-only-routines += $(libnss_dns-routines) $(libresolv-routines)
5107cf1d 183endif
68dbb3a6 184
f214606a
JM
185ifeq ($(run-built-tests),yes)
186ifneq (no,$(PERL))
29fddfc7
SL
187tests-special += $(objpfx)mtrace-tst-leaks.out $(objpfx)mtrace-tst-leaks2.out \
188 $(objpfx)mtrace-tst-resolv-res_ninit.out
f214606a
JM
189endif
190endif
191
0b20a9e8 192generated += mtrace-tst-leaks.out tst-leaks.mtrace \
e237357a
FW
193 mtrace-tst-leaks2.out tst-leaks2.mtrace \
194 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
434190c0 195
28f540f4 196include ../Rules
0793d348 197
7f9f1ecb
FW
198LOCALES := en_US.UTF-8 en_US.ISO-8859-1
199include ../gen-locales.mk
200
36975e8e 201CFLAGS-res_hconf.c += -fexceptions
443f7933 202
68dbb3a6 203# The DNS NSS modules needs the resolver.
fab7ce3f 204$(objpfx)libnss_dns.so: $(objpfx)libresolv.so
2ace5721
UD
205
206# The asynchronous name lookup code needs the thread library.
fab7ce3f 207$(objpfx)libanl.so: $(shared-thread-library)
2ace5721 208
6f1c7010 209$(objpfx)tst-res_hconf_reorder: $(shared-thread-library)
b57525f1
DL
210tst-res_hconf_reorder-ENV = RESOLV_REORDER=on
211
dd174748
RM
212$(objpfx)tst-leaks: $(objpfx)libresolv.so
213tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
0b20a9e8 214$(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
f0881698
JM
215 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
216 $(evaluate-test)
2ed2dc18
UD
217
218tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace
0b20a9e8 219$(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
aa7e05c3
SL
220 { test -r $(objpfx)tst-leaks2.mtrace \
221 || ( echo "tst-leaks2.mtrace does not exist"; exit 77; ) \
222 && $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace; } > $@; \
f0881698 223 $(evaluate-test)
5840c75c 224
e237357a
FW
225tst-resolv-res_ninit-ENV = MALLOC_TRACE=$(objpfx)tst-resolv-res_ninit.mtrace
226$(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
227 $(common-objpfx)malloc/mtrace \
228 $(objpfx)tst-resolv-res_ninit.mtrace > $@; \
229 $(evaluate-test)
230
5840c75c
FW
231$(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
232$(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
6f1c7010 233$(objpfx)tst-resolv-ai_idn: $(objpfx)libresolv.so $(shared-thread-library)
7f9f1ecb 234$(objpfx)tst-resolv-ai_idn-latin1: \
6f1c7010 235 $(objpfx)libresolv.so $(shared-thread-library)
7f9f1ecb 236$(objpfx)tst-resolv-ai_idn-nolibidn2: \
6f1c7010 237 $(objpfx)libresolv.so $(shared-thread-library)
7f9f1ecb
FW
238$(objpfx)tst-resolv-ai_idn.out: $(gen-locales)
239$(objpfx)tst-resolv-ai_idn-latin1.out: $(gen-locales)
240$(objpfx)tst-resolv-ai_idn-nolibidn2.out: \
241 $(gen-locales) $(objpfx)tst-no-libidn2.so
5840c75c 242$(objpfx)tst-resolv-basic: $(objpfx)libresolv.so $(shared-thread-library)
401311cf 243$(objpfx)tst-resolv-binary: $(objpfx)libresolv.so $(shared-thread-library)
e14a2772 244$(objpfx)tst-resolv-edns: $(objpfx)libresolv.so $(shared-thread-library)
5840c75c 245$(objpfx)tst-resolv-network: $(objpfx)libresolv.so $(shared-thread-library)
6f1c7010 246$(objpfx)tst-resolv-res_init: $(objpfx)libresolv.so
89f6307c
FW
247$(objpfx)tst-resolv-res_init-multi: $(objpfx)libresolv.so \
248 $(shared-thread-library)
6f1c7010 249$(objpfx)tst-resolv-res_init-thread: $(objpfx)libresolv.so \
2714c5f3 250 $(shared-thread-library)
108bc404 251$(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library)
fc82b0a2 252$(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library)
5b757a51 253$(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library)
5840c75c 254$(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
108bc404 255$(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
6f1c7010 256$(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library)
f1f00c07
FW
257$(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
258 $(static-thread-library)
6f1c7010 259$(objpfx)tst-resolv-canonname: $(objpfx)libresolv.so $(shared-thread-library)
446997ff 260$(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
b76e0659 261
07d6f1a3
FW
262$(objpfx)tst-ns_name: $(objpfx)libresolv.so
263$(objpfx)tst-ns_name.out: tst-ns_name.data
c803cb9b 264$(objpfx)tst-ns_name_compress: $(objpfx)libresolv.so
e2a9fca8 265$(objpfx)tst-ns_name_pton: $(objpfx)libresolv.so
5c1a6923 266$(objpfx)tst-res_hnok: $(objpfx)libresolv.so
f120cda6 267$(objpfx)tst-p_secstodate: $(objpfx)libresolv.so