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_select_modifies_timeout \
72 support_select_normalizes_timeout \
73 support_set_small_thread_stack_size \
74 support_shared_allocate \
75 support_small_stack_thread_attribute \
76 support_stat_nanoseconds \
78 support_test_compare_blob \
79 support_test_compare_failure \
80 support_test_compare_string \
81 support_write_file_string \
83 support_test_verify_impl \
127 xpthread_attr_destroy \
129 xpthread_attr_setdetachstate \
130 xpthread_attr_setguardsize \
131 xpthread_attr_setstack \
132 xpthread_attr_setstacksize \
133 xpthread_barrier_destroy \
134 xpthread_barrier_init \
135 xpthread_barrier_wait \
136 xpthread_barrierattr_destroy \
137 xpthread_barrierattr_init \
138 xpthread_barrierattr_setpshared \
140 xpthread_check_return \
145 xpthread_key_create \
146 xpthread_key_delete \
148 xpthread_mutex_consistent \
149 xpthread_mutex_destroy \
150 xpthread_mutex_init \
151 xpthread_mutex_lock \
152 xpthread_mutex_unlock \
153 xpthread_mutexattr_destroy \
154 xpthread_mutexattr_init \
155 xpthread_mutexattr_setprotocol \
156 xpthread_mutexattr_setpshared \
157 xpthread_mutexattr_setrobust \
158 xpthread_mutexattr_settype \
160 xpthread_rwlock_init \
161 xpthread_rwlock_destroy \
162 xpthread_rwlock_rdlock \
163 xpthread_rwlock_unlock \
164 xpthread_rwlock_wrlock \
165 xpthread_rwlockattr_init \
166 xpthread_rwlockattr_setkind_np \
169 xpthread_spin_unlock \
182 xposix_spawn_file_actions_addclose \
183 xposix_spawn_file_actions_adddup2 \
193 libsupport-static-only-routines
:= $(libsupport-routines
)
194 # Only build one variant of the library.
195 libsupport-inhibit-o
:= .os
196 ifeq ($(build-shared
),yes
)
197 libsupport-inhibit-o
+= .o
200 CFLAGS-support_paths.c
= \
201 -DSRCDIR_PATH
=\"`cd .. ; pwd`\" \
202 -DOBJDIR_PATH
=\"`cd $(objpfx)/..; pwd`\" \
203 -DOBJDIR_ELF_LDSO_PATH
=\"`cd $(objpfx)/..; pwd`/elf
/$(rtld-installed-name
)\" \
204 -DINSTDIR_PATH
=\"$(prefix)\" \
205 -DLIBDIR_PATH
=\"$(libdir)\" \
206 -DBINDIR_PATH
=\"$(bindir)\" \
207 -DSBINDIR_PATH
=\"$(sbindir
)\" \
208 -DSLIBDIR_PATH
=\"$(slibdir
)\" \
209 -DROOTSBINDIR_PATH
=\"$(rootsbindir
)\" \
210 -DCOMPLOCALEDIR_PATH
=\"$(complocaledir
)\"
212 # In support_timespec_check_in_range we may be passed a very tight
213 # range for which we should produce a correct result for expected
214 # being withing the observed range. The code uses double internally
215 # in support_timespec_check_in_range and for that computation we use
216 # -fexcess-precision=standard.
217 CFLAGS-timespec.c
+= -fexcess-precision
=standard
220 LINKS_DSO_PROGRAM
= links-dso-program-c
222 LINKS_DSO_PROGRAM
= links-dso-program
223 LDLIBS-links-dso-program
= -lstdc
++ -lgcc
-lgcc_s
$(libunwind
)
226 ifeq (yes
,$(have-selinux
))
227 LDLIBS-
$(LINKS_DSO_PROGRAM
) += -lselinux
231 LDLIBS-test-container
= $(libsupport
)
233 others
+= test-container
234 others-noinstall
+= test-container
236 others
+= shell-container echo-container true-container
237 others-noinstall
+= shell-container echo-container true-container
239 others
+= $(LINKS_DSO_PROGRAM
)
240 others-noinstall
+= $(LINKS_DSO_PROGRAM
)
242 $(objpfx
)test-container
: $(libsupport
)
243 $(objpfx
)shell-container
: $(libsupport
)
244 $(objpfx
)echo-container
: $(libsupport
)
245 $(objpfx
)true-container
: $(libsupport
)
249 tst-support-namespace \
250 tst-support_blob_repeat \
251 tst-support_capture_subprocess \
252 tst-support_descriptors \
253 tst-support_format_dns_packet \
254 tst-support-process_state \
255 tst-support_quote_blob \
256 tst-support_quote_string \
257 tst-support_record_failure \
259 tst-test_compare_blob \
260 tst-test_compare_string \
265 ifeq ($(run-built-tests
),yes
)
267 $(objpfx
)tst-support_record_failure-2.out
269 $(objpfx
)tst-support_record_failure-2.out
: tst-support_record_failure-2.sh \
270 $(objpfx
)tst-support_record_failure
271 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
272 '$(run-program-env)' '$(test-program-prefix-after-env)' \
277 $(objpfx
)tst-support_format_dns_packet
: $(common-objpfx
)resolv
/libresolv.so
279 tst-support_capture_subprocess-ARGS
= -- $(host-test-program-cmd
)