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