]>
Commit | Line | Data |
---|---|---|
c23de0aa | 1 | # Makefile for support library, used only at build and test time |
2b778ceb | 2 | # Copyright (C) 2016-2021 Free Software Foundation, Inc. |
c23de0aa FW |
3 | # This file is part of the GNU C Library. |
4 | ||
5 | # The GNU C Library is free software; you can redistribute it and/or | |
6 | # modify it under the terms of the GNU Lesser General Public | |
7 | # License as published by the Free Software Foundation; either | |
8 | # version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | # The GNU C Library is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | # Lesser General Public License for more details. | |
14 | ||
15 | # You should have received a copy of the GNU Lesser General Public | |
16 | # License along with the GNU C Library; if not, see | |
5a82c748 | 17 | # <https://www.gnu.org/licenses/>. |
c23de0aa FW |
18 | |
19 | subdir := support | |
20 | ||
21 | include ../Makeconfig | |
22 | ||
23 | extra-libs := libsupport | |
24 | extra-libs-others = $(extra-libs) | |
25 | extra-libs-noinstall := $(extra-libs) | |
26 | ||
27 | libsupport-routines = \ | |
f5e7e959 | 28 | blob_repeat \ |
c23de0aa | 29 | check \ |
5840c75c FW |
30 | check_addrinfo \ |
31 | check_dns_packet \ | |
32 | check_hostent \ | |
33 | check_netent \ | |
c23de0aa FW |
34 | delayed_exit \ |
35 | ignore_stderr \ | |
cae87e64 | 36 | next_to_fault \ |
c23de0aa | 37 | oom_error \ |
873e239a FW |
38 | resolv_response_context_duplicate \ |
39 | resolv_response_context_free \ | |
5840c75c | 40 | resolv_test \ |
c23de0aa | 41 | set_fortify_handler \ |
bad7a0c8 | 42 | support-xfstat \ |
2714c5f3 | 43 | support-xstat \ |
5707a64d | 44 | support_become_root \ |
2714c5f3 | 45 | support_can_chroot \ |
91b6eb11 | 46 | support_capture_subprocess \ |
2714c5f3 | 47 | support_capture_subprocess_check \ |
d4165eed | 48 | support_chroot \ |
603ae243 | 49 | support_copy_file \ |
81b9d87b | 50 | support_copy_file_range \ |
aa42b3db | 51 | support_descriptor_supports_holes \ |
f255336a | 52 | support_descriptors \ |
273a0c49 | 53 | support_enter_mount_namespace \ |
5707a64d | 54 | support_enter_network_namespace \ |
5840c75c FW |
55 | support_format_address_family \ |
56 | support_format_addrinfo \ | |
57 | support_format_dns_packet \ | |
58 | support_format_herrno \ | |
59 | support_format_hostent \ | |
60 | support_format_netent \ | |
2714c5f3 | 61 | support_isolate_in_subprocess \ |
b2970919 | 62 | support_path_support_time64 \ |
dfe9aa91 | 63 | support_process_state \ |
2f9046fb | 64 | support_ptrace \ |
2cc7bad0 | 65 | support_openpty \ |
561b0bec | 66 | support_paths \ |
2afece36 | 67 | support_quote_blob \ |
c74a91de | 68 | support_quote_string \ |
5f0b8437 | 69 | support_record_failure \ |
5840c75c | 70 | support_run_diff \ |
5628f103 | 71 | support_select_modifies_timeout \ |
49a40ba1 | 72 | support_select_normalizes_timeout \ |
36ada9ee | 73 | support_set_small_thread_stack_size \ |
2714c5f3 | 74 | support_shared_allocate \ |
36ada9ee | 75 | support_small_stack_thread_attribute \ |
1966f47a | 76 | support_stat_nanoseconds \ |
0e169691 | 77 | support_subprocess \ |
2afece36 | 78 | support_test_compare_blob \ |
93485524 | 79 | support_test_compare_failure \ |
1df872fd | 80 | support_test_compare_string \ |
2714c5f3 | 81 | support_write_file_string \ |
c23de0aa | 82 | support_test_main \ |
5f0b8437 | 83 | support_test_verify_impl \ |
c23de0aa | 84 | temp_file \ |
51983996 MC |
85 | timespec \ |
86 | timespec-add \ | |
87 | timespec-sub \ | |
c23de0aa | 88 | write_message \ |
5840c75c | 89 | xaccept \ |
e9203023 | 90 | xaccept4 \ |
c23de0aa | 91 | xasprintf \ |
5840c75c | 92 | xbind \ |
c23de0aa | 93 | xcalloc \ |
a7e9dbb7 | 94 | xchdir \ |
2714c5f3 | 95 | xchroot \ |
33647a72 | 96 | xclock_gettime \ |
a1565550 | 97 | xclock_settime \ |
ed3ea040 | 98 | xclose \ |
42dda89d | 99 | xchmod \ |
5840c75c | 100 | xconnect \ |
81b9d87b | 101 | xcopy_file_range \ |
1cc9e59a | 102 | xdlfcn \ |
94b63e66 | 103 | xdlmopen \ |
91b6eb11 | 104 | xdup2 \ |
7a722654 | 105 | xfchmod \ |
5840c75c FW |
106 | xfclose \ |
107 | xfopen \ | |
5f0b8437 | 108 | xfork \ |
bad7a0c8 | 109 | xftruncate \ |
dfe9aa91 | 110 | xgetline \ |
5840c75c FW |
111 | xgetsockname \ |
112 | xlisten \ | |
bad7a0c8 | 113 | xlseek \ |
173ec37b | 114 | xlstat \ |
c23de0aa | 115 | xmalloc \ |
5840c75c | 116 | xmemstream \ |
2714c5f3 | 117 | xmkdir \ |
561b0bec | 118 | xmkdirp \ |
faf0e9c8 | 119 | xmmap \ |
60149b28 | 120 | xmprotect \ |
faf0e9c8 | 121 | xmunmap \ |
653200ef | 122 | xnewlocale \ |
2714c5f3 | 123 | xopen \ |
91b6eb11 | 124 | xpipe \ |
5840c75c | 125 | xpoll \ |
bc79db3f | 126 | xposix_memalign \ |
f8bf15fe CD |
127 | xpthread_attr_destroy \ |
128 | xpthread_attr_init \ | |
129 | xpthread_attr_setdetachstate \ | |
0edbf123 | 130 | xpthread_attr_setguardsize \ |
d85ad0e5 | 131 | xpthread_attr_setaffinity_np \ |
bc79db3f | 132 | xpthread_attr_setstack \ |
446d22e9 | 133 | xpthread_attr_setstacksize \ |
c23de0aa FW |
134 | xpthread_barrier_destroy \ |
135 | xpthread_barrier_init \ | |
136 | xpthread_barrier_wait \ | |
0ce2fa69 FW |
137 | xpthread_barrierattr_destroy \ |
138 | xpthread_barrierattr_init \ | |
139 | xpthread_barrierattr_setpshared \ | |
c23de0aa FW |
140 | xpthread_cancel \ |
141 | xpthread_check_return \ | |
142 | xpthread_cond_wait \ | |
143 | xpthread_create \ | |
144 | xpthread_detach \ | |
145 | xpthread_join \ | |
a9bfa435 MD |
146 | xpthread_key_create \ |
147 | xpthread_key_delete \ | |
0280b390 | 148 | xpthread_kill \ |
faf0e9c8 FW |
149 | xpthread_mutex_consistent \ |
150 | xpthread_mutex_destroy \ | |
151 | xpthread_mutex_init \ | |
c23de0aa FW |
152 | xpthread_mutex_lock \ |
153 | xpthread_mutex_unlock \ | |
faf0e9c8 FW |
154 | xpthread_mutexattr_destroy \ |
155 | xpthread_mutexattr_init \ | |
156 | xpthread_mutexattr_setprotocol \ | |
157 | xpthread_mutexattr_setpshared \ | |
158 | xpthread_mutexattr_setrobust \ | |
159 | xpthread_mutexattr_settype \ | |
5840c75c | 160 | xpthread_once \ |
faf8c066 | 161 | xpthread_rwlock_init \ |
5fc9ed4c | 162 | xpthread_rwlock_destroy \ |
faf8c066 | 163 | xpthread_rwlock_rdlock \ |
faf8c066 | 164 | xpthread_rwlock_unlock \ |
1ffe1ccb | 165 | xpthread_rwlock_wrlock \ |
faf8c066 CD |
166 | xpthread_rwlockattr_init \ |
167 | xpthread_rwlockattr_setkind_np \ | |
c23de0aa FW |
168 | xpthread_sigmask \ |
169 | xpthread_spin_lock \ | |
170 | xpthread_spin_unlock \ | |
446d22e9 | 171 | xraise \ |
1ffe1ccb | 172 | xreadlink \ |
c23de0aa | 173 | xrealloc \ |
5840c75c FW |
174 | xrecvfrom \ |
175 | xsendto \ | |
cce35a50 | 176 | xsetlocale \ |
5840c75c | 177 | xsetsockopt \ |
446d22e9 FW |
178 | xsigaction \ |
179 | xsignal \ | |
fbbc9a4e | 180 | xsigstack \ |
5707a64d | 181 | xsocket \ |
0e169691 AZ |
182 | xposix_spawn \ |
183 | xposix_spawn_file_actions_addclose \ | |
184 | xposix_spawn_file_actions_adddup2 \ | |
5840c75c | 185 | xstrdup \ |
1ffe1ccb | 186 | xstrndup \ |
561b0bec | 187 | xsymlink \ |
446d22e9 | 188 | xsysconf \ |
1ffe1ccb | 189 | xunlink \ |
653200ef | 190 | xuselocale \ |
5f0b8437 | 191 | xwaitpid \ |
5840c75c | 192 | xwrite \ |
c23de0aa FW |
193 | |
194 | libsupport-static-only-routines := $(libsupport-routines) | |
195 | # Only build one variant of the library. | |
196 | libsupport-inhibit-o := .os | |
197 | ifeq ($(build-shared),yes) | |
198 | libsupport-inhibit-o += .o | |
199 | endif | |
200 | ||
561b0bec DD |
201 | CFLAGS-support_paths.c = \ |
202 | -DSRCDIR_PATH=\"`cd .. ; pwd`\" \ | |
203 | -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \ | |
e7624d70 | 204 | -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \ |
561b0bec | 205 | -DINSTDIR_PATH=\"$(prefix)\" \ |
c7ac9caa | 206 | -DLIBDIR_PATH=\"$(libdir)\" \ |
d50f0918 | 207 | -DBINDIR_PATH=\"$(bindir)\" \ |
75c51570 | 208 | -DSBINDIR_PATH=\"$(sbindir)\" \ |
cb81264f | 209 | -DSLIBDIR_PATH=\"$(slibdir)\" \ |
92954ffa CD |
210 | -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \ |
211 | -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\" | |
561b0bec | 212 | |
f896fc0f L |
213 | # In support_timespec_check_in_range we may be passed a very tight |
214 | # range for which we should produce a correct result for expected | |
215 | # being withing the observed range. The code uses double internally | |
216 | # in support_timespec_check_in_range and for that computation we use | |
217 | # -fexcess-precision=standard. | |
218 | CFLAGS-timespec.c += -fexcess-precision=standard | |
219 | ||
561b0bec DD |
220 | ifeq (,$(CXX)) |
221 | LINKS_DSO_PROGRAM = links-dso-program-c | |
222 | else | |
223 | LINKS_DSO_PROGRAM = links-dso-program | |
acc2842a | 224 | LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind) |
561b0bec DD |
225 | endif |
226 | ||
99135114 DD |
227 | ifeq (yes,$(have-selinux)) |
228 | LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux | |
229 | endif | |
230 | ||
231 | ||
561b0bec DD |
232 | LDLIBS-test-container = $(libsupport) |
233 | ||
234 | others += test-container | |
235 | others-noinstall += test-container | |
236 | ||
237 | others += shell-container echo-container true-container | |
238 | others-noinstall += shell-container echo-container true-container | |
239 | ||
240 | others += $(LINKS_DSO_PROGRAM) | |
241 | others-noinstall += $(LINKS_DSO_PROGRAM) | |
242 | ||
243 | $(objpfx)test-container : $(libsupport) | |
244 | $(objpfx)shell-container : $(libsupport) | |
245 | $(objpfx)echo-container : $(libsupport) | |
246 | $(objpfx)true-container : $(libsupport) | |
247 | ||
5f0b8437 FW |
248 | tests = \ |
249 | README-testing \ | |
5707a64d | 250 | tst-support-namespace \ |
f5e7e959 | 251 | tst-support_blob_repeat \ |
91b6eb11 | 252 | tst-support_capture_subprocess \ |
f255336a | 253 | tst-support_descriptors \ |
f889e73f | 254 | tst-support_format_dns_packet \ |
dfe9aa91 | 255 | tst-support-process_state \ |
2afece36 | 256 | tst-support_quote_blob \ |
c74a91de | 257 | tst-support_quote_string \ |
5f0b8437 | 258 | tst-support_record_failure \ |
93485524 | 259 | tst-test_compare \ |
2afece36 | 260 | tst-test_compare_blob \ |
1df872fd | 261 | tst-test_compare_string \ |
04deeaa9 | 262 | tst-timespec \ |
1ffe1ccb | 263 | tst-xreadlink \ |
fbbc9a4e | 264 | tst-xsigstack \ |
5f0b8437 | 265 | |
ef83c83a | 266 | ifeq ($(run-built-tests),yes) |
5f0b8437 FW |
267 | tests-special = \ |
268 | $(objpfx)tst-support_record_failure-2.out | |
269 | ||
270 | $(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \ | |
271 | $(objpfx)tst-support_record_failure | |
272 | $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ | |
273 | '$(run-program-env)' '$(test-program-prefix-after-env)' \ | |
274 | > $@; \ | |
275 | $(evaluate-test) | |
ef83c83a | 276 | endif |
c23de0aa | 277 | |
f889e73f FW |
278 | $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so |
279 | ||
0e169691 AZ |
280 | tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd) |
281 | ||
c23de0aa | 282 | include ../Rules |