]>
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 \ |
ae8c243d | 42 | support_stack_alloc \ |
bad7a0c8 | 43 | support-xfstat \ |
372d2ef1 | 44 | support-xfstat-time64 \ |
2714c5f3 | 45 | support-xstat \ |
372d2ef1 | 46 | support-xstat-time64 \ |
5707a64d | 47 | support_become_root \ |
2714c5f3 | 48 | support_can_chroot \ |
91b6eb11 | 49 | support_capture_subprocess \ |
2714c5f3 | 50 | support_capture_subprocess_check \ |
d4165eed | 51 | support_chroot \ |
603ae243 | 52 | support_copy_file \ |
81b9d87b | 53 | support_copy_file_range \ |
92f7b465 | 54 | support_create_timer \ |
aa42b3db | 55 | support_descriptor_supports_holes \ |
f255336a | 56 | support_descriptors \ |
273a0c49 | 57 | support_enter_mount_namespace \ |
5707a64d | 58 | support_enter_network_namespace \ |
5840c75c FW |
59 | support_format_address_family \ |
60 | support_format_addrinfo \ | |
61 | support_format_dns_packet \ | |
62 | support_format_herrno \ | |
63 | support_format_hostent \ | |
64 | support_format_netent \ | |
2714c5f3 | 65 | support_isolate_in_subprocess \ |
b2970919 | 66 | support_path_support_time64 \ |
dfe9aa91 | 67 | support_process_state \ |
2f9046fb | 68 | support_ptrace \ |
e814f4b0 | 69 | support-open-dev-null-range \ |
2cc7bad0 | 70 | support_openpty \ |
561b0bec | 71 | support_paths \ |
2afece36 | 72 | support_quote_blob \ |
c74a91de | 73 | support_quote_string \ |
5f0b8437 | 74 | support_record_failure \ |
5840c75c | 75 | support_run_diff \ |
5628f103 | 76 | support_select_modifies_timeout \ |
49a40ba1 | 77 | support_select_normalizes_timeout \ |
36ada9ee | 78 | support_set_small_thread_stack_size \ |
2714c5f3 | 79 | support_shared_allocate \ |
36ada9ee | 80 | support_small_stack_thread_attribute \ |
1966f47a | 81 | support_stat_nanoseconds \ |
0e169691 | 82 | support_subprocess \ |
2afece36 | 83 | support_test_compare_blob \ |
93485524 | 84 | support_test_compare_failure \ |
1df872fd | 85 | support_test_compare_string \ |
2714c5f3 | 86 | support_write_file_string \ |
c23de0aa | 87 | support_test_main \ |
5f0b8437 | 88 | support_test_verify_impl \ |
c23de0aa | 89 | temp_file \ |
51983996 | 90 | timespec \ |
e9bc2b3b | 91 | timespec-time64 \ |
51983996 | 92 | timespec-add \ |
e9bc2b3b | 93 | timespec-add-time64 \ |
51983996 | 94 | timespec-sub \ |
e9bc2b3b | 95 | timespec-sub-time64 \ |
c23de0aa | 96 | write_message \ |
5840c75c | 97 | xaccept \ |
e9203023 | 98 | xaccept4 \ |
c23de0aa | 99 | xasprintf \ |
5840c75c | 100 | xbind \ |
c23de0aa | 101 | xcalloc \ |
a7e9dbb7 | 102 | xchdir \ |
2714c5f3 | 103 | xchroot \ |
33647a72 | 104 | xclock_gettime \ |
e9bc2b3b | 105 | xclock_gettime_time64 \ |
a1565550 | 106 | xclock_settime \ |
e9bc2b3b | 107 | xclock_settime_time64 \ |
de8995a2 | 108 | xclone \ |
ed3ea040 | 109 | xclose \ |
42dda89d | 110 | xchmod \ |
5840c75c | 111 | xconnect \ |
81b9d87b | 112 | xcopy_file_range \ |
1cc9e59a | 113 | xdlfcn \ |
94b63e66 | 114 | xdlmopen \ |
91b6eb11 | 115 | xdup2 \ |
7a722654 | 116 | xfchmod \ |
5840c75c FW |
117 | xfclose \ |
118 | xfopen \ | |
5f0b8437 | 119 | xfork \ |
bad7a0c8 | 120 | xftruncate \ |
dfe9aa91 | 121 | xgetline \ |
5840c75c FW |
122 | xgetsockname \ |
123 | xlisten \ | |
bad7a0c8 | 124 | xlseek \ |
173ec37b | 125 | xlstat \ |
372d2ef1 | 126 | xlstat-time64 \ |
c23de0aa | 127 | xmalloc \ |
5840c75c | 128 | xmemstream \ |
2714c5f3 | 129 | xmkdir \ |
561b0bec | 130 | xmkdirp \ |
faf0e9c8 | 131 | xmmap \ |
60149b28 | 132 | xmprotect \ |
faf0e9c8 | 133 | xmunmap \ |
653200ef | 134 | xnewlocale \ |
2714c5f3 | 135 | xopen \ |
91b6eb11 | 136 | xpipe \ |
5840c75c | 137 | xpoll \ |
bc79db3f | 138 | xposix_memalign \ |
f8bf15fe CD |
139 | xpthread_attr_destroy \ |
140 | xpthread_attr_init \ | |
141 | xpthread_attr_setdetachstate \ | |
0edbf123 | 142 | xpthread_attr_setguardsize \ |
d85ad0e5 | 143 | xpthread_attr_setaffinity_np \ |
bc79db3f | 144 | xpthread_attr_setstack \ |
446d22e9 | 145 | xpthread_attr_setstacksize \ |
c23de0aa FW |
146 | xpthread_barrier_destroy \ |
147 | xpthread_barrier_init \ | |
148 | xpthread_barrier_wait \ | |
0ce2fa69 FW |
149 | xpthread_barrierattr_destroy \ |
150 | xpthread_barrierattr_init \ | |
151 | xpthread_barrierattr_setpshared \ | |
c23de0aa FW |
152 | xpthread_cancel \ |
153 | xpthread_check_return \ | |
154 | xpthread_cond_wait \ | |
155 | xpthread_create \ | |
156 | xpthread_detach \ | |
157 | xpthread_join \ | |
a9bfa435 MD |
158 | xpthread_key_create \ |
159 | xpthread_key_delete \ | |
0280b390 | 160 | xpthread_kill \ |
faf0e9c8 FW |
161 | xpthread_mutex_consistent \ |
162 | xpthread_mutex_destroy \ | |
163 | xpthread_mutex_init \ | |
c23de0aa FW |
164 | xpthread_mutex_lock \ |
165 | xpthread_mutex_unlock \ | |
faf0e9c8 FW |
166 | xpthread_mutexattr_destroy \ |
167 | xpthread_mutexattr_init \ | |
168 | xpthread_mutexattr_setprotocol \ | |
169 | xpthread_mutexattr_setpshared \ | |
170 | xpthread_mutexattr_setrobust \ | |
171 | xpthread_mutexattr_settype \ | |
5840c75c | 172 | xpthread_once \ |
faf8c066 | 173 | xpthread_rwlock_init \ |
5fc9ed4c | 174 | xpthread_rwlock_destroy \ |
faf8c066 | 175 | xpthread_rwlock_rdlock \ |
faf8c066 | 176 | xpthread_rwlock_unlock \ |
1ffe1ccb | 177 | xpthread_rwlock_wrlock \ |
faf8c066 CD |
178 | xpthread_rwlockattr_init \ |
179 | xpthread_rwlockattr_setkind_np \ | |
c23de0aa FW |
180 | xpthread_sigmask \ |
181 | xpthread_spin_lock \ | |
182 | xpthread_spin_unlock \ | |
446d22e9 | 183 | xraise \ |
1ffe1ccb | 184 | xreadlink \ |
c23de0aa | 185 | xrealloc \ |
5840c75c FW |
186 | xrecvfrom \ |
187 | xsendto \ | |
cce35a50 | 188 | xsetlocale \ |
5840c75c | 189 | xsetsockopt \ |
446d22e9 FW |
190 | xsigaction \ |
191 | xsignal \ | |
fbbc9a4e | 192 | xsigstack \ |
5707a64d | 193 | xsocket \ |
0e169691 AZ |
194 | xposix_spawn \ |
195 | xposix_spawn_file_actions_addclose \ | |
196 | xposix_spawn_file_actions_adddup2 \ | |
5840c75c | 197 | xstrdup \ |
1ffe1ccb | 198 | xstrndup \ |
561b0bec | 199 | xsymlink \ |
446d22e9 | 200 | xsysconf \ |
1ffe1ccb | 201 | xunlink \ |
653200ef | 202 | xuselocale \ |
5f0b8437 | 203 | xwaitpid \ |
5840c75c | 204 | xwrite \ |
c23de0aa FW |
205 | |
206 | libsupport-static-only-routines := $(libsupport-routines) | |
207 | # Only build one variant of the library. | |
208 | libsupport-inhibit-o := .os | |
209 | ifeq ($(build-shared),yes) | |
210 | libsupport-inhibit-o += .o | |
211 | endif | |
212 | ||
561b0bec DD |
213 | CFLAGS-support_paths.c = \ |
214 | -DSRCDIR_PATH=\"`cd .. ; pwd`\" \ | |
215 | -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \ | |
e7624d70 | 216 | -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \ |
561b0bec | 217 | -DINSTDIR_PATH=\"$(prefix)\" \ |
c7ac9caa | 218 | -DLIBDIR_PATH=\"$(libdir)\" \ |
d50f0918 | 219 | -DBINDIR_PATH=\"$(bindir)\" \ |
75c51570 | 220 | -DSBINDIR_PATH=\"$(sbindir)\" \ |
cb81264f | 221 | -DSLIBDIR_PATH=\"$(slibdir)\" \ |
92954ffa CD |
222 | -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \ |
223 | -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\" | |
561b0bec | 224 | |
f896fc0f L |
225 | # In support_timespec_check_in_range we may be passed a very tight |
226 | # range for which we should produce a correct result for expected | |
227 | # being withing the observed range. The code uses double internally | |
228 | # in support_timespec_check_in_range and for that computation we use | |
229 | # -fexcess-precision=standard. | |
230 | CFLAGS-timespec.c += -fexcess-precision=standard | |
e9bc2b3b | 231 | CFLAGS-timespec-time64.c += -fexcess-precision=standard |
f896fc0f | 232 | |
561b0bec DD |
233 | ifeq (,$(CXX)) |
234 | LINKS_DSO_PROGRAM = links-dso-program-c | |
235 | else | |
236 | LINKS_DSO_PROGRAM = links-dso-program | |
acc2842a | 237 | LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind) |
561b0bec DD |
238 | endif |
239 | ||
99135114 DD |
240 | ifeq (yes,$(have-selinux)) |
241 | LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux | |
242 | endif | |
243 | ||
244 | ||
561b0bec DD |
245 | LDLIBS-test-container = $(libsupport) |
246 | ||
247 | others += test-container | |
248 | others-noinstall += test-container | |
249 | ||
250 | others += shell-container echo-container true-container | |
251 | others-noinstall += shell-container echo-container true-container | |
252 | ||
253 | others += $(LINKS_DSO_PROGRAM) | |
254 | others-noinstall += $(LINKS_DSO_PROGRAM) | |
255 | ||
256 | $(objpfx)test-container : $(libsupport) | |
257 | $(objpfx)shell-container : $(libsupport) | |
258 | $(objpfx)echo-container : $(libsupport) | |
259 | $(objpfx)true-container : $(libsupport) | |
260 | ||
5f0b8437 FW |
261 | tests = \ |
262 | README-testing \ | |
5707a64d | 263 | tst-support-namespace \ |
f5e7e959 | 264 | tst-support_blob_repeat \ |
91b6eb11 | 265 | tst-support_capture_subprocess \ |
f255336a | 266 | tst-support_descriptors \ |
f889e73f | 267 | tst-support_format_dns_packet \ |
e814f4b0 | 268 | tst-support-open-dev-null-range \ |
dfe9aa91 | 269 | tst-support-process_state \ |
2afece36 | 270 | tst-support_quote_blob \ |
c74a91de | 271 | tst-support_quote_string \ |
5f0b8437 | 272 | tst-support_record_failure \ |
93485524 | 273 | tst-test_compare \ |
2afece36 | 274 | tst-test_compare_blob \ |
1df872fd | 275 | tst-test_compare_string \ |
04deeaa9 | 276 | tst-timespec \ |
1ffe1ccb | 277 | tst-xreadlink \ |
fbbc9a4e | 278 | tst-xsigstack \ |
5f0b8437 | 279 | |
ef83c83a | 280 | ifeq ($(run-built-tests),yes) |
5f0b8437 FW |
281 | tests-special = \ |
282 | $(objpfx)tst-support_record_failure-2.out | |
283 | ||
284 | $(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \ | |
285 | $(objpfx)tst-support_record_failure | |
286 | $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ | |
287 | '$(run-program-env)' '$(test-program-prefix-after-env)' \ | |
288 | > $@; \ | |
289 | $(evaluate-test) | |
ef83c83a | 290 | endif |
c23de0aa | 291 | |
f889e73f FW |
292 | $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so |
293 | ||
0e169691 AZ |
294 | tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd) |
295 | ||
c23de0aa | 296 | include ../Rules |