Update NEWS.
[glibc.git] / support / Makefile
blob5ddcb8d15813a67abb5f0debb0d6730d425b4de7
1 # Makefile for support library, used only at build and test time
2 # Copyright (C) 2016-2022 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 ignore_stderr \
36 next_to_fault \
37 oom_error \
38 resolv_response_context_duplicate \
39 resolv_response_context_free \
40 resolv_test \
41 set_fortify_handler \
42 support_stack_alloc \
43 support-xfstat \
44 support-xfstat-time64 \
45 support-xstat \
46 support-xstat-time64 \
47 support_become_root \
48 support_can_chroot \
49 support_capture_subprocess \
50 support_capture_subprocess_check \
51 support_chroot \
52 support_copy_file \
53 support_copy_file_range \
54 support_create_timer \
55 support_descriptor_supports_holes \
56 support_descriptors \
57 support_enter_mount_namespace \
58 support_enter_network_namespace \
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 \
65 support_isolate_in_subprocess \
66 support_mutex_pi_monotonic \
67 support_path_support_time64 \
68 support_process_state \
69 support_ptrace \
70 support-open-dev-null-range \
71 support_openpty \
72 support_paths \
73 support_quote_blob \
74 support_quote_blob_wide \
75 support_quote_string \
76 support_record_failure \
77 support_run_diff \
78 support_select_modifies_timeout \
79 support_select_normalizes_timeout \
80 support_set_small_thread_stack_size \
81 support_shared_allocate \
82 support_small_stack_thread_attribute \
83 support_socket_so_timestamp_time64 \
84 support_stat_nanoseconds \
85 support_subprocess \
86 support_test_compare_blob \
87 support_test_compare_failure \
88 support_test_compare_string \
89 support_test_compare_string_wide \
90 support_test_main \
91 support_test_verify_impl \
92 support_wait_for_thread_exit \
93 support_write_file_string \
94 temp_file \
95 timespec \
96 timespec-time64 \
97 timespec-add \
98 timespec-add-time64 \
99 timespec-sub \
100 timespec-sub-time64 \
101 write_message \
102 xaccept \
103 xaccept4 \
104 xasprintf \
105 xbind \
106 xcalloc \
107 xchdir \
108 xchroot \
109 xclock_gettime \
110 xclock_gettime_time64 \
111 xclock_settime \
112 xclock_settime_time64 \
113 xclone \
114 xclose \
115 xchmod \
116 xconnect \
117 xcopy_file_range \
118 xdlfcn \
119 xdlmopen \
120 xdup2 \
121 xfchmod \
122 xfclose \
123 xfopen \
124 xfork \
125 xftruncate \
126 xgetline \
127 xgetsockname \
128 xlisten \
129 xlseek \
130 xlstat \
131 xlstat-time64 \
132 xmalloc \
133 xmemstream \
134 xmkdir \
135 xmkdirp \
136 xmmap \
137 xmprotect \
138 xmunmap \
139 xnewlocale \
140 xopen \
141 xpipe \
142 xpoll \
143 xposix_memalign \
144 xpthread_attr_destroy \
145 xpthread_attr_init \
146 xpthread_attr_setdetachstate \
147 xpthread_attr_setguardsize \
148 xpthread_attr_setaffinity_np \
149 xpthread_attr_setstack \
150 xpthread_attr_setstacksize \
151 xpthread_barrier_destroy \
152 xpthread_barrier_init \
153 xpthread_barrier_wait \
154 xpthread_barrierattr_destroy \
155 xpthread_barrierattr_init \
156 xpthread_barrierattr_setpshared \
157 xpthread_cancel \
158 xpthread_check_return \
159 xpthread_cond_wait \
160 xpthread_create \
161 xpthread_detach \
162 xpthread_join \
163 xpthread_key_create \
164 xpthread_key_delete \
165 xpthread_kill \
166 xpthread_mutex_consistent \
167 xpthread_mutex_destroy \
168 xpthread_mutex_init \
169 xpthread_mutex_lock \
170 xpthread_mutex_unlock \
171 xpthread_mutexattr_destroy \
172 xpthread_mutexattr_init \
173 xpthread_mutexattr_setprotocol \
174 xpthread_mutexattr_setpshared \
175 xpthread_mutexattr_setrobust \
176 xpthread_mutexattr_settype \
177 xpthread_once \
178 xpthread_rwlock_init \
179 xpthread_rwlock_destroy \
180 xpthread_rwlock_rdlock \
181 xpthread_rwlock_unlock \
182 xpthread_rwlock_wrlock \
183 xpthread_rwlockattr_init \
184 xpthread_rwlockattr_setkind_np \
185 xpthread_sigmask \
186 xpthread_spin_lock \
187 xpthread_spin_unlock \
188 xraise \
189 xreadlink \
190 xrealloc \
191 xrecvfrom \
192 xsendto \
193 xsetlocale \
194 xsetsockopt \
195 xsigaction \
196 xsignal \
197 xsigstack \
198 xsocket \
199 xposix_spawn \
200 xposix_spawn_file_actions_addclose \
201 xposix_spawn_file_actions_adddup2 \
202 xstrdup \
203 xstrndup \
204 xsymlink \
205 xsysconf \
206 xunlink \
207 xuselocale \
208 xwaitpid \
209 xwrite \
211 libsupport-static-only-routines := $(libsupport-routines)
212 # Only build one variant of the library.
213 libsupport-inhibit-o := .os
214 ifeq ($(build-shared),yes)
215 libsupport-inhibit-o += .o
216 endif
218 CFLAGS-support_paths.c = \
219 -DSRCDIR_PATH=\"`cd .. ; pwd`\" \
220 -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
221 -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \
222 -DINSTDIR_PATH=\"$(prefix)\" \
223 -DLIBDIR_PATH=\"$(libdir)\" \
224 -DBINDIR_PATH=\"$(bindir)\" \
225 -DSBINDIR_PATH=\"$(sbindir)\" \
226 -DSLIBDIR_PATH=\"$(slibdir)\" \
227 -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \
228 -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\"
230 # In support_timespec_check_in_range we may be passed a very tight
231 # range for which we should produce a correct result for expected
232 # being withing the observed range. The code uses double internally
233 # in support_timespec_check_in_range and for that computation we use
234 # -fexcess-precision=standard.
235 CFLAGS-timespec.c += -fexcess-precision=standard
236 CFLAGS-timespec-time64.c += -fexcess-precision=standard
238 ifeq (,$(CXX))
239 LINKS_DSO_PROGRAM = links-dso-program-c
240 else
241 LINKS_DSO_PROGRAM = links-dso-program
242 LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
243 endif
245 ifeq (yes,$(have-selinux))
246 LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux
247 endif
250 LDLIBS-test-container = $(libsupport)
252 others += test-container
253 others-noinstall += test-container
255 others += shell-container echo-container true-container
256 others-noinstall += shell-container echo-container true-container
258 others += $(LINKS_DSO_PROGRAM)
259 others-noinstall += $(LINKS_DSO_PROGRAM)
261 others += test-run-command
262 others-static += test-run-command
263 others-noinstall += test-run-command
264 LDLIBS-test-run-command = $(libsupport)
266 $(objpfx)test-container : $(libsupport)
267 $(objpfx)shell-container : $(libsupport)
268 $(objpfx)echo-container : $(libsupport)
269 $(objpfx)true-container : $(libsupport)
270 $(objpfx)test-run-command : $(libsupport) $(common-objpfx)elf/static-stubs.o
272 tests = \
273 README-testing \
274 tst-support-namespace \
275 tst-support_blob_repeat \
276 tst-support_capture_subprocess \
277 tst-support_descriptors \
278 tst-support_format_dns_packet \
279 tst-support-open-dev-null-range \
280 tst-support-process_state \
281 tst-support_quote_blob \
282 tst-support_quote_blob_wide \
283 tst-support_quote_string \
284 tst-support_record_failure \
285 tst-test_compare \
286 tst-test_compare_blob \
287 tst-test_compare_string \
288 tst-test_compare_string_wide \
289 tst-timespec \
290 tst-xreadlink \
291 tst-xsigstack \
293 ifeq ($(run-built-tests),yes)
294 tests-special = \
295 $(objpfx)tst-support_record_failure-2.out
297 $(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \
298 $(objpfx)tst-support_record_failure
299 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
300 '$(run-program-env)' '$(test-program-prefix-after-env)' \
301 > $@; \
302 $(evaluate-test)
303 endif
305 $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so
307 tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd)
309 include ../Rules