]> git.ipfire.org Git - thirdparty/glibc.git/blob - support/Makefile
support: Add support_mutex_pi_monotonic
[thirdparty/glibc.git] / support / Makefile
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.
4
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.
9
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.
14
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/>.
18
19 subdir := support
20
21 include ../Makeconfig
22
23 extra-libs := libsupport
24 extra-libs-others = $(extra-libs)
25 extra-libs-noinstall := $(extra-libs)
26
27 libsupport-routines = \
28 blob_repeat \
29 check \
30 check_addrinfo \
31 check_dns_packet \
32 check_hostent \
33 check_netent \
34 delayed_exit \
35 ignore_stderr \
36 next_to_fault \
37 oom_error \
38 resolv_response_context_duplicate \
39 resolv_response_context_free \
40 resolv_test \
41 set_fortify_handler \
42 support_stack_alloc \
43 support-xfstat \
44 support-xfstat-time64 \
45 support-xstat \
46 support-xstat-time64 \
47 support_become_root \
48 support_can_chroot \
49 support_capture_subprocess \
50 support_capture_subprocess_check \
51 support_chroot \
52 support_copy_file \
53 support_copy_file_range \
54 support_create_timer \
55 support_descriptor_supports_holes \
56 support_descriptors \
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 \
67 support_path_support_time64 \
68 support_process_state \
69 support_ptrace \
70 support-open-dev-null-range \
71 support_openpty \
72 support_paths \
73 support_quote_blob \
74 support_quote_string \
75 support_record_failure \
76 support_run_diff \
77 support_select_modifies_timeout \
78 support_select_normalizes_timeout \
79 support_set_small_thread_stack_size \
80 support_shared_allocate \
81 support_small_stack_thread_attribute \
82 support_stat_nanoseconds \
83 support_subprocess \
84 support_test_compare_blob \
85 support_test_compare_failure \
86 support_test_compare_string \
87 support_test_main \
88 support_test_verify_impl \
89 support_wait_for_thread_exit \
90 support_write_file_string \
91 temp_file \
92 timespec \
93 timespec-time64 \
94 timespec-add \
95 timespec-add-time64 \
96 timespec-sub \
97 timespec-sub-time64 \
98 write_message \
99 xaccept \
100 xaccept4 \
101 xasprintf \
102 xbind \
103 xcalloc \
104 xchdir \
105 xchroot \
106 xclock_gettime \
107 xclock_gettime_time64 \
108 xclock_settime \
109 xclock_settime_time64 \
110 xclone \
111 xclose \
112 xchmod \
113 xconnect \
114 xcopy_file_range \
115 xdlfcn \
116 xdlmopen \
117 xdup2 \
118 xfchmod \
119 xfclose \
120 xfopen \
121 xfork \
122 xftruncate \
123 xgetline \
124 xgetsockname \
125 xlisten \
126 xlseek \
127 xlstat \
128 xlstat-time64 \
129 xmalloc \
130 xmemstream \
131 xmkdir \
132 xmkdirp \
133 xmmap \
134 xmprotect \
135 xmunmap \
136 xnewlocale \
137 xopen \
138 xpipe \
139 xpoll \
140 xposix_memalign \
141 xpthread_attr_destroy \
142 xpthread_attr_init \
143 xpthread_attr_setdetachstate \
144 xpthread_attr_setguardsize \
145 xpthread_attr_setaffinity_np \
146 xpthread_attr_setstack \
147 xpthread_attr_setstacksize \
148 xpthread_barrier_destroy \
149 xpthread_barrier_init \
150 xpthread_barrier_wait \
151 xpthread_barrierattr_destroy \
152 xpthread_barrierattr_init \
153 xpthread_barrierattr_setpshared \
154 xpthread_cancel \
155 xpthread_check_return \
156 xpthread_cond_wait \
157 xpthread_create \
158 xpthread_detach \
159 xpthread_join \
160 xpthread_key_create \
161 xpthread_key_delete \
162 xpthread_kill \
163 xpthread_mutex_consistent \
164 xpthread_mutex_destroy \
165 xpthread_mutex_init \
166 xpthread_mutex_lock \
167 xpthread_mutex_unlock \
168 xpthread_mutexattr_destroy \
169 xpthread_mutexattr_init \
170 xpthread_mutexattr_setprotocol \
171 xpthread_mutexattr_setpshared \
172 xpthread_mutexattr_setrobust \
173 xpthread_mutexattr_settype \
174 xpthread_once \
175 xpthread_rwlock_init \
176 xpthread_rwlock_destroy \
177 xpthread_rwlock_rdlock \
178 xpthread_rwlock_unlock \
179 xpthread_rwlock_wrlock \
180 xpthread_rwlockattr_init \
181 xpthread_rwlockattr_setkind_np \
182 xpthread_sigmask \
183 xpthread_spin_lock \
184 xpthread_spin_unlock \
185 xraise \
186 xreadlink \
187 xrealloc \
188 xrecvfrom \
189 xsendto \
190 xsetlocale \
191 xsetsockopt \
192 xsigaction \
193 xsignal \
194 xsigstack \
195 xsocket \
196 xposix_spawn \
197 xposix_spawn_file_actions_addclose \
198 xposix_spawn_file_actions_adddup2 \
199 xstrdup \
200 xstrndup \
201 xsymlink \
202 xsysconf \
203 xunlink \
204 xuselocale \
205 xwaitpid \
206 xwrite \
207
208 libsupport-static-only-routines := $(libsupport-routines)
209 # Only build one variant of the library.
210 libsupport-inhibit-o := .os
211 ifeq ($(build-shared),yes)
212 libsupport-inhibit-o += .o
213 endif
214
215 CFLAGS-support_paths.c = \
216 -DSRCDIR_PATH=\"`cd .. ; pwd`\" \
217 -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
218 -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \
219 -DINSTDIR_PATH=\"$(prefix)\" \
220 -DLIBDIR_PATH=\"$(libdir)\" \
221 -DBINDIR_PATH=\"$(bindir)\" \
222 -DSBINDIR_PATH=\"$(sbindir)\" \
223 -DSLIBDIR_PATH=\"$(slibdir)\" \
224 -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \
225 -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\"
226
227 # In support_timespec_check_in_range we may be passed a very tight
228 # range for which we should produce a correct result for expected
229 # being withing the observed range. The code uses double internally
230 # in support_timespec_check_in_range and for that computation we use
231 # -fexcess-precision=standard.
232 CFLAGS-timespec.c += -fexcess-precision=standard
233 CFLAGS-timespec-time64.c += -fexcess-precision=standard
234
235 ifeq (,$(CXX))
236 LINKS_DSO_PROGRAM = links-dso-program-c
237 else
238 LINKS_DSO_PROGRAM = links-dso-program
239 LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
240 endif
241
242 ifeq (yes,$(have-selinux))
243 LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux
244 endif
245
246
247 LDLIBS-test-container = $(libsupport)
248
249 others += test-container
250 others-noinstall += test-container
251
252 others += shell-container echo-container true-container
253 others-noinstall += shell-container echo-container true-container
254
255 others += $(LINKS_DSO_PROGRAM)
256 others-noinstall += $(LINKS_DSO_PROGRAM)
257
258 $(objpfx)test-container : $(libsupport)
259 $(objpfx)shell-container : $(libsupport)
260 $(objpfx)echo-container : $(libsupport)
261 $(objpfx)true-container : $(libsupport)
262
263 tests = \
264 README-testing \
265 tst-support-namespace \
266 tst-support_blob_repeat \
267 tst-support_capture_subprocess \
268 tst-support_descriptors \
269 tst-support_format_dns_packet \
270 tst-support-open-dev-null-range \
271 tst-support-process_state \
272 tst-support_quote_blob \
273 tst-support_quote_string \
274 tst-support_record_failure \
275 tst-test_compare \
276 tst-test_compare_blob \
277 tst-test_compare_string \
278 tst-timespec \
279 tst-xreadlink \
280 tst-xsigstack \
281
282 ifeq ($(run-built-tests),yes)
283 tests-special = \
284 $(objpfx)tst-support_record_failure-2.out
285
286 $(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \
287 $(objpfx)tst-support_record_failure
288 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
289 '$(run-program-env)' '$(test-program-prefix-after-env)' \
290 > $@; \
291 $(evaluate-test)
292 endif
293
294 $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so
295
296 tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd)
297
298 include ../Rules