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/>.
23 extra-libs
:= libsupport
24 extra-libs-others
= $(extra-libs
)
25 extra-libs-noinstall
:= $(extra-libs
)
27 libsupport-routines
= \
38 resolv_response_context_duplicate \
39 resolv_response_context_free \
44 support-xfstat-time64 \
46 support-xstat-time64 \
49 support_capture_subprocess \
50 support_capture_subprocess_check \
53 support_copy_file_range \
54 support_create_timer \
55 support_descriptor_supports_holes \
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 \
68 support_path_support_time64 \
69 support_process_state \
71 support-open-dev-null-range \
75 support_quote_blob_wide \
76 support_quote_string \
77 support_record_failure \
79 support_select_modifies_timeout \
80 support_select_normalizes_timeout \
81 support_set_small_thread_stack_size \
82 support_shared_allocate \
83 support_small_stack_thread_attribute \
84 support_socket_so_timestamp_time64 \
85 support_stat_nanoseconds \
87 support_test_compare_blob \
88 support_test_compare_failure \
89 support_test_compare_string \
90 support_test_compare_string_wide \
92 support_test_verify_impl \
93 support_wait_for_thread_exit \
94 support_write_file_string \
101 timespec-sub-time64 \
111 xclock_gettime_time64 \
113 xclock_settime_time64 \
146 xpthread_attr_destroy \
148 xpthread_attr_setdetachstate \
149 xpthread_attr_setguardsize \
150 xpthread_attr_setaffinity_np \
151 xpthread_attr_setstack \
152 xpthread_attr_setstacksize \
153 xpthread_barrier_destroy \
154 xpthread_barrier_init \
155 xpthread_barrier_wait \
156 xpthread_barrierattr_destroy \
157 xpthread_barrierattr_init \
158 xpthread_barrierattr_setpshared \
160 xpthread_check_return \
165 xpthread_key_create \
166 xpthread_key_delete \
168 xpthread_mutex_consistent \
169 xpthread_mutex_destroy \
170 xpthread_mutex_init \
171 xpthread_mutex_lock \
172 xpthread_mutex_unlock \
173 xpthread_mutexattr_destroy \
174 xpthread_mutexattr_init \
175 xpthread_mutexattr_setprotocol \
176 xpthread_mutexattr_setpshared \
177 xpthread_mutexattr_setrobust \
178 xpthread_mutexattr_settype \
180 xpthread_rwlock_init \
181 xpthread_rwlock_destroy \
182 xpthread_rwlock_rdlock \
183 xpthread_rwlock_unlock \
184 xpthread_rwlock_wrlock \
185 xpthread_rwlockattr_init \
186 xpthread_rwlockattr_setkind_np \
189 xpthread_spin_unlock \
202 xposix_spawn_file_actions_addclose \
203 xposix_spawn_file_actions_adddup2 \
213 libsupport-static-only-routines
:= $(libsupport-routines
)
214 # Only build one variant of the library.
215 libsupport-inhibit-o
:= .os
216 ifeq ($(build-shared
),yes
)
217 libsupport-inhibit-o
+= .o
220 CFLAGS-support_paths.c
= \
221 -DSRCDIR_PATH
=\"`cd .. ; pwd`\" \
222 -DOBJDIR_PATH
=\"`cd $(objpfx)/..; pwd`\" \
223 -DOBJDIR_ELF_LDSO_PATH
=\"`cd $(objpfx)/..; pwd`/elf
/$(rtld-installed-name
)\" \
224 -DINSTDIR_PATH
=\"$(prefix)\" \
225 -DLIBDIR_PATH
=\"$(libdir)\" \
226 -DBINDIR_PATH
=\"$(bindir)\" \
227 -DSBINDIR_PATH
=\"$(sbindir
)\" \
228 -DSLIBDIR_PATH
=\"$(slibdir
)\" \
229 -DROOTSBINDIR_PATH
=\"$(rootsbindir
)\" \
230 -DCOMPLOCALEDIR_PATH
=\"$(complocaledir
)\"
232 # In support_timespec_check_in_range we may be passed a very tight
233 # range for which we should produce a correct result for expected
234 # being withing the observed range. The code uses double internally
235 # in support_timespec_check_in_range and for that computation we use
236 # -fexcess-precision=standard.
237 CFLAGS-timespec.c
+= -fexcess-precision
=standard
238 CFLAGS-timespec-time64.c
+= -fexcess-precision
=standard
241 LINKS_DSO_PROGRAM
= links-dso-program-c
243 LINKS_DSO_PROGRAM
= links-dso-program
244 LDLIBS-links-dso-program
= -lstdc
++ -lgcc
-lgcc_s
$(libunwind
)
247 ifeq (yes
,$(have-selinux
))
248 LDLIBS-
$(LINKS_DSO_PROGRAM
) += -lselinux
252 LDLIBS-test-container
= $(libsupport
)
254 others
+= test-container
255 others-noinstall
+= test-container
257 others
+= shell-container echo-container true-container
258 others-noinstall
+= shell-container echo-container true-container
260 others
+= $(LINKS_DSO_PROGRAM
)
261 others-noinstall
+= $(LINKS_DSO_PROGRAM
)
263 others
+= test-run-command
264 others-static
+= test-run-command
265 others-noinstall
+= test-run-command
266 LDLIBS-test-run-command
= $(libsupport
)
268 $(objpfx
)test-container
: $(libsupport
)
269 $(objpfx
)shell-container
: $(libsupport
)
270 $(objpfx
)echo-container
: $(libsupport
)
271 $(objpfx
)true-container
: $(libsupport
)
272 $(objpfx
)test-run-command
: $(libsupport
) $(common-objpfx
)elf
/static-stubs.o
276 tst-support-namespace \
277 tst-support_blob_repeat \
278 tst-support_capture_subprocess \
279 tst-support_descriptors \
280 tst-support_format_dns_packet \
281 tst-support-open-dev-null-range \
282 tst-support-process_state \
283 tst-support_quote_blob \
284 tst-support_quote_blob_wide \
285 tst-support_quote_string \
286 tst-support_record_failure \
288 tst-test_compare_blob \
289 tst-test_compare_string \
290 tst-test_compare_string_wide \
295 ifeq ($(run-built-tests
),yes
)
297 $(objpfx
)tst-support_record_failure-2.out
299 $(objpfx
)tst-support_record_failure-2.out
: tst-support_record_failure-2.sh \
300 $(objpfx
)tst-support_record_failure
301 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
302 '$(run-program-env)' '$(test-program-prefix-after-env)' \
307 $(objpfx
)tst-support_format_dns_packet
: $(common-objpfx
)resolv
/libresolv.so
309 tst-support_capture_subprocess-ARGS
= -- $(host-test-program-cmd
)