1 # Makefile for support library, used only at build and test time
2 # Copyright (C) 2016-2021 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_path_support_time64 \
67 support_process_state \
72 support_quote_string \
73 support_record_failure \
75 support_select_modifies_timeout \
76 support_select_normalizes_timeout \
77 support_set_small_thread_stack_size \
78 support_shared_allocate \
79 support_small_stack_thread_attribute \
80 support_stat_nanoseconds \
82 support_test_compare_blob \
83 support_test_compare_failure \
84 support_test_compare_string \
85 support_write_file_string \
87 support_test_verify_impl \
104 xclock_gettime_time64 \
106 xclock_settime_time64 \
138 xpthread_attr_destroy \
140 xpthread_attr_setdetachstate \
141 xpthread_attr_setguardsize \
142 xpthread_attr_setaffinity_np \
143 xpthread_attr_setstack \
144 xpthread_attr_setstacksize \
145 xpthread_barrier_destroy \
146 xpthread_barrier_init \
147 xpthread_barrier_wait \
148 xpthread_barrierattr_destroy \
149 xpthread_barrierattr_init \
150 xpthread_barrierattr_setpshared \
152 xpthread_check_return \
157 xpthread_key_create \
158 xpthread_key_delete \
160 xpthread_mutex_consistent \
161 xpthread_mutex_destroy \
162 xpthread_mutex_init \
163 xpthread_mutex_lock \
164 xpthread_mutex_unlock \
165 xpthread_mutexattr_destroy \
166 xpthread_mutexattr_init \
167 xpthread_mutexattr_setprotocol \
168 xpthread_mutexattr_setpshared \
169 xpthread_mutexattr_setrobust \
170 xpthread_mutexattr_settype \
172 xpthread_rwlock_init \
173 xpthread_rwlock_destroy \
174 xpthread_rwlock_rdlock \
175 xpthread_rwlock_unlock \
176 xpthread_rwlock_wrlock \
177 xpthread_rwlockattr_init \
178 xpthread_rwlockattr_setkind_np \
181 xpthread_spin_unlock \
194 xposix_spawn_file_actions_addclose \
195 xposix_spawn_file_actions_adddup2 \
205 libsupport-static-only-routines
:= $(libsupport-routines
)
206 # Only build one variant of the library.
207 libsupport-inhibit-o
:= .os
208 ifeq ($(build-shared
),yes
)
209 libsupport-inhibit-o
+= .o
212 CFLAGS-support_paths.c
= \
213 -DSRCDIR_PATH
=\"`cd .. ; pwd`\" \
214 -DOBJDIR_PATH
=\"`cd $(objpfx)/..; pwd`\" \
215 -DOBJDIR_ELF_LDSO_PATH
=\"`cd $(objpfx)/..; pwd`/elf
/$(rtld-installed-name
)\" \
216 -DINSTDIR_PATH
=\"$(prefix)\" \
217 -DLIBDIR_PATH
=\"$(libdir)\" \
218 -DBINDIR_PATH
=\"$(bindir)\" \
219 -DSBINDIR_PATH
=\"$(sbindir
)\" \
220 -DSLIBDIR_PATH
=\"$(slibdir
)\" \
221 -DROOTSBINDIR_PATH
=\"$(rootsbindir
)\" \
222 -DCOMPLOCALEDIR_PATH
=\"$(complocaledir
)\"
224 # In support_timespec_check_in_range we may be passed a very tight
225 # range for which we should produce a correct result for expected
226 # being withing the observed range. The code uses double internally
227 # in support_timespec_check_in_range and for that computation we use
228 # -fexcess-precision=standard.
229 CFLAGS-timespec.c
+= -fexcess-precision
=standard
230 CFLAGS-timespec-time64.c
+= -fexcess-precision
=standard
233 LINKS_DSO_PROGRAM
= links-dso-program-c
235 LINKS_DSO_PROGRAM
= links-dso-program
236 LDLIBS-links-dso-program
= -lstdc
++ -lgcc
-lgcc_s
$(libunwind
)
239 ifeq (yes
,$(have-selinux
))
240 LDLIBS-
$(LINKS_DSO_PROGRAM
) += -lselinux
244 LDLIBS-test-container
= $(libsupport
)
246 others
+= test-container
247 others-noinstall
+= test-container
249 others
+= shell-container echo-container true-container
250 others-noinstall
+= shell-container echo-container true-container
252 others
+= $(LINKS_DSO_PROGRAM
)
253 others-noinstall
+= $(LINKS_DSO_PROGRAM
)
255 $(objpfx
)test-container
: $(libsupport
)
256 $(objpfx
)shell-container
: $(libsupport
)
257 $(objpfx
)echo-container
: $(libsupport
)
258 $(objpfx
)true-container
: $(libsupport
)
262 tst-support-namespace \
263 tst-support_blob_repeat \
264 tst-support_capture_subprocess \
265 tst-support_descriptors \
266 tst-support_format_dns_packet \
267 tst-support-process_state \
268 tst-support_quote_blob \
269 tst-support_quote_string \
270 tst-support_record_failure \
272 tst-test_compare_blob \
273 tst-test_compare_string \
278 ifeq ($(run-built-tests
),yes
)
280 $(objpfx
)tst-support_record_failure-2.out
282 $(objpfx
)tst-support_record_failure-2.out
: tst-support_record_failure-2.sh \
283 $(objpfx
)tst-support_record_failure
284 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
285 '$(run-program-env)' '$(test-program-prefix-after-env)' \
290 $(objpfx
)tst-support_format_dns_packet
: $(common-objpfx
)resolv
/libresolv.so
292 tst-support_capture_subprocess-ARGS
= -- $(host-test-program-cmd
)