]>
Commit | Line | Data |
---|---|---|
1 | # Makefile for support library, used only at build and test time | |
2 | # Copyright (C) 2016-2024 Free Software Foundation, Inc. | |
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 | |
17 | # <https://www.gnu.org/licenses/>. | |
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 = \ | |
28 | blob_repeat \ | |
29 | check \ | |
30 | check_addrinfo \ | |
31 | check_dns_packet \ | |
32 | check_hostent \ | |
33 | check_netent \ | |
34 | delayed_exit \ | |
35 | dtotimespec \ | |
36 | dtotimespec-time64 \ | |
37 | ignore_stderr \ | |
38 | next_to_fault \ | |
39 | oom_error \ | |
40 | resolv_response_context_duplicate \ | |
41 | resolv_response_context_free \ | |
42 | resolv_test \ | |
43 | set_fortify_handler \ | |
44 | support-open-dev-null-range \ | |
45 | support_become_root \ | |
46 | support_can_chroot \ | |
47 | support_capture_subprocess \ | |
48 | support_capture_subprocess_check \ | |
49 | support_check_stat_fd \ | |
50 | support_check_stat_path \ | |
51 | support_chroot \ | |
52 | support_compare_file_bytes \ | |
53 | support_compare_file_string \ | |
54 | support_copy_file \ | |
55 | support_copy_file_range \ | |
56 | support_create_timer \ | |
57 | support_descriptor_supports_holes \ | |
58 | support_descriptors \ | |
59 | support_enter_mount_namespace \ | |
60 | support_enter_network_namespace \ | |
61 | support_format_address_family \ | |
62 | support_format_addrinfo \ | |
63 | support_format_dns_packet \ | |
64 | support_format_herrno \ | |
65 | support_format_hostent \ | |
66 | support_format_netent \ | |
67 | support_fuse \ | |
68 | support_isolate_in_subprocess \ | |
69 | support_mutex_pi_monotonic \ | |
70 | support_need_proc \ | |
71 | support_open_and_compare_file_bytes \ | |
72 | support_open_and_compare_file_string \ | |
73 | support_openpty \ | |
74 | support_path_support_time64 \ | |
75 | support_paths \ | |
76 | support_process_state \ | |
77 | support_ptrace \ | |
78 | support_quote_blob \ | |
79 | support_quote_blob_wide \ | |
80 | support_quote_string \ | |
81 | support_readdir \ | |
82 | support_readdir_check \ | |
83 | support_readdir_r_check \ | |
84 | support_record_failure \ | |
85 | support_run_diff \ | |
86 | support_select_modifies_timeout \ | |
87 | support_select_normalizes_timeout \ | |
88 | support_set_small_thread_stack_size \ | |
89 | support_set_vma_name_supported \ | |
90 | support_shared_allocate \ | |
91 | support_small_stack_thread_attribute \ | |
92 | support_socket_so_timestamp_time64 \ | |
93 | support_stack_alloc \ | |
94 | support_stat_nanoseconds \ | |
95 | support_subprocess \ | |
96 | support_test_compare_blob \ | |
97 | support_test_compare_failure \ | |
98 | support_test_compare_string \ | |
99 | support_test_compare_string_wide \ | |
100 | support_test_main \ | |
101 | support_test_verify_impl \ | |
102 | support_wait_for_thread_exit \ | |
103 | support_write_file_string \ | |
104 | temp_file \ | |
105 | timespec \ | |
106 | timespec-add \ | |
107 | timespec-add-time64 \ | |
108 | timespec-sub \ | |
109 | timespec-sub-time64 \ | |
110 | timespec-time64 \ | |
111 | write_message \ | |
112 | xaccept \ | |
113 | xaccept4 \ | |
114 | xasprintf \ | |
115 | xbind \ | |
116 | xcalloc \ | |
117 | xchdir \ | |
118 | xchmod \ | |
119 | xchroot \ | |
120 | xclock_gettime \ | |
121 | xclock_gettime_time64 \ | |
122 | xclock_settime \ | |
123 | xclock_settime_time64 \ | |
124 | xclone \ | |
125 | xclose \ | |
126 | xclosedir \ | |
127 | xconnect \ | |
128 | xcopy_file_range \ | |
129 | xdlfcn \ | |
130 | xdlmopen \ | |
131 | xdup2 \ | |
132 | xfchmod \ | |
133 | xfclose \ | |
134 | xfdopendir \ | |
135 | xfgets \ | |
136 | xfopen \ | |
137 | xfork \ | |
138 | xfread \ | |
139 | xfreopen \ | |
140 | xftruncate \ | |
141 | xgetline \ | |
142 | xgetpeername \ | |
143 | xgetsockname \ | |
144 | xlisten \ | |
145 | xlseek \ | |
146 | xmalloc \ | |
147 | xmemstream \ | |
148 | xmkdir \ | |
149 | xmkdirp \ | |
150 | xmkfifo \ | |
151 | xmmap \ | |
152 | xmprotect \ | |
153 | xmunmap \ | |
154 | xnewlocale \ | |
155 | xopen \ | |
156 | xopendir \ | |
157 | xpipe \ | |
158 | xpoll \ | |
159 | xposix_memalign \ | |
160 | xposix_spawn \ | |
161 | xposix_spawn_file_actions_addclose \ | |
162 | xposix_spawn_file_actions_adddup2 \ | |
163 | xpthread_attr_destroy \ | |
164 | xpthread_attr_init \ | |
165 | xpthread_attr_setaffinity_np \ | |
166 | xpthread_attr_setdetachstate \ | |
167 | xpthread_attr_setguardsize \ | |
168 | xpthread_attr_setstack \ | |
169 | xpthread_attr_setstacksize \ | |
170 | xpthread_barrier_destroy \ | |
171 | xpthread_barrier_init \ | |
172 | xpthread_barrier_wait \ | |
173 | xpthread_barrierattr_destroy \ | |
174 | xpthread_barrierattr_init \ | |
175 | xpthread_barrierattr_setpshared \ | |
176 | xpthread_cancel \ | |
177 | xpthread_check_return \ | |
178 | xpthread_cond_signal \ | |
179 | xpthread_cond_wait \ | |
180 | xpthread_create \ | |
181 | xpthread_detach \ | |
182 | xpthread_join \ | |
183 | xpthread_key_create \ | |
184 | xpthread_key_delete \ | |
185 | xpthread_kill \ | |
186 | xpthread_mutex_consistent \ | |
187 | xpthread_mutex_destroy \ | |
188 | xpthread_mutex_init \ | |
189 | xpthread_mutex_lock \ | |
190 | xpthread_mutex_unlock \ | |
191 | xpthread_mutexattr_destroy \ | |
192 | xpthread_mutexattr_init \ | |
193 | xpthread_mutexattr_setprotocol \ | |
194 | xpthread_mutexattr_setpshared \ | |
195 | xpthread_mutexattr_setrobust \ | |
196 | xpthread_mutexattr_settype \ | |
197 | xpthread_once \ | |
198 | xpthread_rwlock_destroy \ | |
199 | xpthread_rwlock_init \ | |
200 | xpthread_rwlock_rdlock \ | |
201 | xpthread_rwlock_unlock \ | |
202 | xpthread_rwlock_wrlock \ | |
203 | xpthread_rwlockattr_init \ | |
204 | xpthread_rwlockattr_setkind_np \ | |
205 | xpthread_sigmask \ | |
206 | xpthread_spin_lock \ | |
207 | xpthread_spin_unlock \ | |
208 | xraise \ | |
209 | xread \ | |
210 | xreadlink \ | |
211 | xrealloc \ | |
212 | xrecvfrom \ | |
213 | xsendto \ | |
214 | xsetlocale \ | |
215 | xsetsockopt \ | |
216 | xsigaction \ | |
217 | xsignal \ | |
218 | xsigstack \ | |
219 | xsocket \ | |
220 | xstatx \ | |
221 | xstrdup \ | |
222 | xstrndup \ | |
223 | xsymlink \ | |
224 | xsysconf \ | |
225 | xsystem \ | |
226 | xunlink \ | |
227 | xuselocale \ | |
228 | xwaitpid \ | |
229 | xwrite \ | |
230 | # libsupport-routines | |
231 | ||
232 | libsupport-static-only-routines := $(libsupport-routines) | |
233 | # Only build one variant of the library. | |
234 | libsupport-inhibit-o := .os | |
235 | ifeq ($(build-shared),yes) | |
236 | libsupport-inhibit-o += .o | |
237 | endif | |
238 | ||
239 | CFLAGS-support_paths.c = \ | |
240 | -DSRCDIR_PATH=\"`cd .. ; pwd`\" \ | |
241 | -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \ | |
242 | -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \ | |
243 | -DINSTDIR_PATH=\"$(prefix)\" \ | |
244 | -DLIBDIR_PATH=\"$(libdir)\" \ | |
245 | -DBINDIR_PATH=\"$(bindir)\" \ | |
246 | -DSBINDIR_PATH=\"$(sbindir)\" \ | |
247 | -DSLIBDIR_PATH=\"$(slibdir)\" \ | |
248 | -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \ | |
249 | -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\" \ | |
250 | -DSYSCONFDIR_PATH=\"$(sysconfdir)\" | |
251 | ||
252 | # Build with exception handling and asynchronous unwind table support. | |
253 | CFLAGS-.oS += -fexceptions -fasynchronous-unwind-tables | |
254 | ||
255 | # In support_timespec_check_in_range we may be passed a very tight | |
256 | # range for which we should produce a correct result for expected | |
257 | # being within the observed range. The code uses double internally | |
258 | # in support_timespec_check_in_range and for that computation we use | |
259 | # -fexcess-precision=standard. | |
260 | CFLAGS-timespec.c += -fexcess-precision=standard | |
261 | CFLAGS-timespec-time64.c += -fexcess-precision=standard | |
262 | ||
263 | # Ensure that general support files use 64-bit time_t | |
264 | CFLAGS-delayed_exit.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
265 | CFLAGS-shell-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
266 | CFLAGS-support_can_chroot.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
267 | CFLAGS-support_copy_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
268 | CFLAGS-support_copy_file_range.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
269 | CFLAGS-support_descriptor_supports_holes.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
270 | CFLAGS-support_descriptors.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
271 | CFLAGS-support_process_state.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
272 | CFLAGS-support_stat_nanoseconds.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
273 | CFLAGS-support_subprocess.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
274 | CFLAGS-support_test_main.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
275 | CFLAGS-test-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
276 | CFLAGS-xmkdirp.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
277 | # This is required to get an mkstemp which can create large files on some | |
278 | # 32-bit platforms. | |
279 | CFLAGS-temp_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
280 | ||
281 | ifeq (,$(CXX)) | |
282 | LINKS_DSO_PROGRAM = links-dso-program-c | |
283 | else | |
284 | LINKS_DSO_PROGRAM = links-dso-program | |
285 | LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind) | |
286 | endif | |
287 | ||
288 | ifeq (yes,$(have-selinux)) | |
289 | LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux | |
290 | endif | |
291 | ||
292 | ||
293 | LDLIBS-test-container = $(libsupport) | |
294 | ||
295 | others += test-container | |
296 | others-noinstall += test-container | |
297 | ||
298 | others += \ | |
299 | echo-container \ | |
300 | shell-container \ | |
301 | true-container \ | |
302 | # others | |
303 | others-noinstall += \ | |
304 | echo-container \ | |
305 | shell-container \ | |
306 | true-container \ | |
307 | # others-noinstall | |
308 | ||
309 | others += $(LINKS_DSO_PROGRAM) | |
310 | others-noinstall += $(LINKS_DSO_PROGRAM) | |
311 | ||
312 | others += test-run-command | |
313 | others-static += test-run-command | |
314 | others-noinstall += test-run-command | |
315 | LDLIBS-test-run-command = $(libsupport) | |
316 | ||
317 | $(objpfx)test-container : $(libsupport) | |
318 | $(objpfx)shell-container : $(libsupport) | |
319 | $(objpfx)echo-container : $(libsupport) | |
320 | $(objpfx)true-container : $(libsupport) | |
321 | $(objpfx)test-run-command : $(libsupport) $(common-objpfx)elf/static-stubs.o | |
322 | ||
323 | tests = \ | |
324 | README-testing \ | |
325 | tst-support-namespace \ | |
326 | tst-support-open-dev-null-range \ | |
327 | tst-support-process_state \ | |
328 | tst-support_blob_repeat \ | |
329 | tst-support_capture_subprocess \ | |
330 | tst-support_descriptors \ | |
331 | tst-support_format_dns_packet \ | |
332 | tst-support_fuse \ | |
333 | tst-support_quote_blob \ | |
334 | tst-support_quote_blob_wide \ | |
335 | tst-support_quote_string \ | |
336 | tst-support_readdir \ | |
337 | tst-support_record_failure \ | |
338 | tst-test_compare \ | |
339 | tst-test_compare_blob \ | |
340 | tst-test_compare_string \ | |
341 | tst-test_compare_string_wide \ | |
342 | tst-timespec \ | |
343 | tst-xdirent \ | |
344 | tst-xreadlink \ | |
345 | tst-xsigstack \ | |
346 | # tests | |
347 | ||
348 | ifeq ($(run-built-tests),yes) | |
349 | tests-special = \ | |
350 | $(objpfx)tst-support_record_failure-2.out | |
351 | ||
352 | $(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \ | |
353 | $(objpfx)tst-support_record_failure | |
354 | $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ | |
355 | '$(run-program-env)' '$(test-program-prefix-after-env)' \ | |
356 | > $@; \ | |
357 | $(evaluate-test) | |
358 | endif | |
359 | ||
360 | tests-special += $(objpfx)tst-glibcpp.out | |
361 | ||
362 | $(objpfx)tst-glibcpp.out: tst-glibcpp.py $(..)scripts/glibcpp.py | |
363 | PYTHONPATH=$(..)scripts $(PYTHON) tst-glibcpp.py > $@ 2>&1; \ | |
364 | $(evaluate-test) | |
365 | ||
366 | $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so | |
367 | ||
368 | tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd) | |
369 | ||
370 | include ../Rules |