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 \
46 support_capture_subprocess \
47 support_capture_subprocess_check \
50 support_copy_file_range \
51 support_descriptor_supports_holes \
53 support_enter_mount_namespace \
54 support_enter_network_namespace \
55 support_format_address_family \
56 support_format_addrinfo \
57 support_format_dns_packet \
58 support_format_herrno \
59 support_format_hostent \
60 support_format_netent \
61 support_isolate_in_subprocess \
62 support_path_support_time64 \
63 support_process_state \
68 support_quote_string \
69 support_record_failure \
71 support_set_small_thread_stack_size \
72 support_shared_allocate \
73 support_small_stack_thread_attribute \
74 support_stat_nanoseconds \
76 support_test_compare_blob \
77 support_test_compare_failure \
78 support_test_compare_string \
79 support_write_file_string \
81 support_test_verify_impl \
125 xpthread_attr_destroy \
127 xpthread_attr_setdetachstate \
128 xpthread_attr_setguardsize \
129 xpthread_attr_setstack \
130 xpthread_attr_setstacksize \
131 xpthread_barrier_destroy \
132 xpthread_barrier_init \
133 xpthread_barrier_wait \
134 xpthread_barrierattr_destroy \
135 xpthread_barrierattr_init \
136 xpthread_barrierattr_setpshared \
138 xpthread_check_return \
143 xpthread_key_create \
144 xpthread_key_delete \
146 xpthread_mutex_consistent \
147 xpthread_mutex_destroy \
148 xpthread_mutex_init \
149 xpthread_mutex_lock \
150 xpthread_mutex_unlock \
151 xpthread_mutexattr_destroy \
152 xpthread_mutexattr_init \
153 xpthread_mutexattr_setprotocol \
154 xpthread_mutexattr_setpshared \
155 xpthread_mutexattr_setrobust \
156 xpthread_mutexattr_settype \
158 xpthread_rwlock_init \
159 xpthread_rwlock_destroy \
160 xpthread_rwlock_rdlock \
161 xpthread_rwlock_unlock \
162 xpthread_rwlock_wrlock \
163 xpthread_rwlockattr_init \
164 xpthread_rwlockattr_setkind_np \
167 xpthread_spin_unlock \
180 xposix_spawn_file_actions_addclose \
181 xposix_spawn_file_actions_adddup2 \
191 libsupport-static-only-routines
:= $(libsupport-routines
)
192 # Only build one variant of the library.
193 libsupport-inhibit-o
:= .os
194 ifeq ($(build-shared
),yes
)
195 libsupport-inhibit-o
+= .o
198 CFLAGS-support_paths.c
= \
199 -DSRCDIR_PATH
=\"`cd .. ; pwd`\" \
200 -DOBJDIR_PATH
=\"`cd $(objpfx)/..; pwd`\" \
201 -DOBJDIR_ELF_LDSO_PATH
=\"`cd $(objpfx)/..; pwd`/elf
/$(rtld-installed-name
)\" \
202 -DINSTDIR_PATH
=\"$(prefix)\" \
203 -DLIBDIR_PATH
=\"$(libdir)\" \
204 -DBINDIR_PATH
=\"$(bindir)\" \
205 -DSBINDIR_PATH
=\"$(sbindir
)\" \
206 -DSLIBDIR_PATH
=\"$(slibdir
)\" \
207 -DROOTSBINDIR_PATH
=\"$(rootsbindir
)\" \
208 -DCOMPLOCALEDIR_PATH
=\"$(complocaledir
)\"
210 # In support_timespec_check_in_range we may be passed a very tight
211 # range for which we should produce a correct result for expected
212 # being withing the observed range. The code uses double internally
213 # in support_timespec_check_in_range and for that computation we use
214 # -fexcess-precision=standard.
215 CFLAGS-timespec.c
+= -fexcess-precision
=standard
218 LINKS_DSO_PROGRAM
= links-dso-program-c
220 LINKS_DSO_PROGRAM
= links-dso-program
221 LDLIBS-links-dso-program
= -lstdc
++ -lgcc
-lgcc_s
$(libunwind
)
224 ifeq (yes
,$(have-selinux
))
225 LDLIBS-
$(LINKS_DSO_PROGRAM
) += -lselinux
229 LDLIBS-test-container
= $(libsupport
)
231 others
+= test-container
232 others-noinstall
+= test-container
234 others
+= shell-container echo-container true-container
235 others-noinstall
+= shell-container echo-container true-container
237 others
+= $(LINKS_DSO_PROGRAM
)
238 others-noinstall
+= $(LINKS_DSO_PROGRAM
)
240 $(objpfx
)test-container
: $(libsupport
)
241 $(objpfx
)shell-container
: $(libsupport
)
242 $(objpfx
)echo-container
: $(libsupport
)
243 $(objpfx
)true-container
: $(libsupport
)
247 tst-support-namespace \
248 tst-support_blob_repeat \
249 tst-support_capture_subprocess \
250 tst-support_descriptors \
251 tst-support_format_dns_packet \
252 tst-support-process_state \
253 tst-support_quote_blob \
254 tst-support_quote_string \
255 tst-support_record_failure \
257 tst-test_compare_blob \
258 tst-test_compare_string \
263 ifeq ($(run-built-tests
),yes
)
265 $(objpfx
)tst-support_record_failure-2.out
267 $(objpfx
)tst-support_record_failure-2.out
: tst-support_record_failure-2.sh \
268 $(objpfx
)tst-support_record_failure
269 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
270 '$(run-program-env)' '$(test-program-prefix-after-env)' \
275 $(objpfx
)tst-support_format_dns_packet
: $(common-objpfx
)resolv
/libresolv.so
277 tst-support_capture_subprocess-ARGS
= -- $(host-test-program-cmd
)