1 # Makefile for support library, used only at build and test time
2 # Copyright (C) 2016-2020 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
= \
44 support_capture_subprocess \
45 support_capture_subprocess_check \
47 support_copy_file_range \
48 support_descriptor_supports_holes \
50 support_enter_mount_namespace \
51 support_enter_network_namespace \
52 support_format_address_family \
53 support_format_addrinfo \
54 support_format_dns_packet \
55 support_format_herrno \
56 support_format_hostent \
57 support_format_netent \
58 support_isolate_in_subprocess \
59 support_process_state \
64 support_quote_string \
65 support_record_failure \
67 support_set_small_thread_stack_size \
68 support_shared_allocate \
69 support_small_stack_thread_attribute \
71 support_test_compare_blob \
72 support_test_compare_failure \
73 support_test_compare_string \
74 support_write_file_string \
76 support_test_verify_impl \
116 xpthread_attr_destroy \
118 xpthread_attr_setdetachstate \
119 xpthread_attr_setguardsize \
120 xpthread_attr_setstack \
121 xpthread_attr_setstacksize \
122 xpthread_barrier_destroy \
123 xpthread_barrier_init \
124 xpthread_barrier_wait \
125 xpthread_barrierattr_destroy \
126 xpthread_barrierattr_init \
127 xpthread_barrierattr_setpshared \
129 xpthread_check_return \
134 xpthread_key_create \
135 xpthread_key_delete \
136 xpthread_mutex_consistent \
137 xpthread_mutex_destroy \
138 xpthread_mutex_init \
139 xpthread_mutex_lock \
140 xpthread_mutex_unlock \
141 xpthread_mutexattr_destroy \
142 xpthread_mutexattr_init \
143 xpthread_mutexattr_setprotocol \
144 xpthread_mutexattr_setpshared \
145 xpthread_mutexattr_setrobust \
146 xpthread_mutexattr_settype \
148 xpthread_rwlock_init \
149 xpthread_rwlock_destroy \
150 xpthread_rwlock_rdlock \
151 xpthread_rwlock_unlock \
152 xpthread_rwlock_wrlock \
153 xpthread_rwlockattr_init \
154 xpthread_rwlockattr_setkind_np \
157 xpthread_spin_unlock \
170 xposix_spawn_file_actions_addclose \
171 xposix_spawn_file_actions_adddup2 \
181 libsupport-static-only-routines
:= $(libsupport-routines
)
182 # Only build one variant of the library.
183 libsupport-inhibit-o
:= .os
184 ifeq ($(build-shared
),yes
)
185 libsupport-inhibit-o
+= .o
188 CFLAGS-support_paths.c
= \
189 -DSRCDIR_PATH
=\"`cd .. ; pwd`\" \
190 -DOBJDIR_PATH
=\"`cd $(objpfx)/..; pwd`\" \
191 -DOBJDIR_ELF_LDSO_PATH
=\"`cd $(objpfx)/..; pwd`/elf
/$(rtld-installed-name
)\" \
192 -DINSTDIR_PATH
=\"$(prefix)\" \
193 -DLIBDIR_PATH
=\"$(libdir)\" \
194 -DBINDIR_PATH
=\"$(bindir)\" \
195 -DSBINDIR_PATH
=\"$(sbindir
)\" \
196 -DROOTSBINDIR_PATH
=\"$(rootsbindir
)\" \
197 -DCOMPLOCALEDIR_PATH
=\"$(complocaledir
)\"
199 # In support_timespec_check_in_range we may be passed a very tight
200 # range for which we should produce a correct result for expected
201 # being withing the observed range. The code uses double internally
202 # in support_timespec_check_in_range and for that computation we use
203 # -fexcess-precision=standard.
204 CFLAGS-timespec.c
+= -fexcess-precision
=standard
207 LINKS_DSO_PROGRAM
= links-dso-program-c
209 LINKS_DSO_PROGRAM
= links-dso-program
210 LDLIBS-links-dso-program
= -lstdc
++ -lgcc
-lgcc_s
$(libunwind
)
213 ifeq (yes
,$(have-selinux
))
214 LDLIBS-
$(LINKS_DSO_PROGRAM
) += -lselinux
218 LDLIBS-test-container
= $(libsupport
)
220 others
+= test-container
221 others-noinstall
+= test-container
223 others
+= shell-container echo-container true-container
224 others-noinstall
+= shell-container echo-container true-container
226 others
+= $(LINKS_DSO_PROGRAM
)
227 others-noinstall
+= $(LINKS_DSO_PROGRAM
)
229 $(objpfx
)test-container
: $(libsupport
)
230 $(objpfx
)shell-container
: $(libsupport
)
231 $(objpfx
)echo-container
: $(libsupport
)
232 $(objpfx
)true-container
: $(libsupport
)
236 tst-support-namespace \
237 tst-support_blob_repeat \
238 tst-support_capture_subprocess \
239 tst-support_descriptors \
240 tst-support_format_dns_packet \
241 tst-support-process_state \
242 tst-support_quote_blob \
243 tst-support_quote_string \
244 tst-support_record_failure \
246 tst-test_compare_blob \
247 tst-test_compare_string \
252 ifeq ($(run-built-tests
),yes
)
254 $(objpfx
)tst-support_record_failure-2.out
256 $(objpfx
)tst-support_record_failure-2.out
: tst-support_record_failure-2.sh \
257 $(objpfx
)tst-support_record_failure
258 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix-before-env)' \
259 '$(run-program-env)' '$(test-program-prefix-after-env)' \
264 $(objpfx
)tst-support_format_dns_packet
: $(common-objpfx
)resolv
/libresolv.so
266 tst-support_capture_subprocess-ARGS
= -- $(host-test-program-cmd
)