]> git.ipfire.org Git - thirdparty/glibc.git/blob - support/Makefile
libsupport: Add support_select_normalizes_timeout
[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-xfstat \
43 support-xstat \
44 support_become_root \
45 support_can_chroot \
46 support_capture_subprocess \
47 support_capture_subprocess_check \
48 support_chroot \
49 support_copy_file \
50 support_copy_file_range \
51 support_descriptor_supports_holes \
52 support_descriptors \
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 \
64 support_ptrace \
65 support_openpty \
66 support_paths \
67 support_quote_blob \
68 support_quote_string \
69 support_record_failure \
70 support_run_diff \
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 \
77 support_subprocess \
78 support_test_compare_blob \
79 support_test_compare_failure \
80 support_test_compare_string \
81 support_write_file_string \
82 support_test_main \
83 support_test_verify_impl \
84 temp_file \
85 timespec \
86 timespec-add \
87 timespec-sub \
88 write_message \
89 xaccept \
90 xaccept4 \
91 xasprintf \
92 xbind \
93 xcalloc \
94 xchdir \
95 xchroot \
96 xclock_gettime \
97 xclock_settime \
98 xclose \
99 xchmod \
100 xconnect \
101 xcopy_file_range \
102 xdlfcn \
103 xdlmopen \
104 xdup2 \
105 xfchmod \
106 xfclose \
107 xfopen \
108 xfork \
109 xftruncate \
110 xgetline \
111 xgetsockname \
112 xlisten \
113 xlseek \
114 xlstat \
115 xmalloc \
116 xmemstream \
117 xmkdir \
118 xmkdirp \
119 xmmap \
120 xmprotect \
121 xmunmap \
122 xnewlocale \
123 xopen \
124 xpipe \
125 xpoll \
126 xposix_memalign \
127 xpthread_attr_destroy \
128 xpthread_attr_init \
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 \
139 xpthread_cancel \
140 xpthread_check_return \
141 xpthread_cond_wait \
142 xpthread_create \
143 xpthread_detach \
144 xpthread_join \
145 xpthread_key_create \
146 xpthread_key_delete \
147 xpthread_kill \
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 \
159 xpthread_once \
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 \
167 xpthread_sigmask \
168 xpthread_spin_lock \
169 xpthread_spin_unlock \
170 xraise \
171 xreadlink \
172 xrealloc \
173 xrecvfrom \
174 xsendto \
175 xsetlocale \
176 xsetsockopt \
177 xsigaction \
178 xsignal \
179 xsigstack \
180 xsocket \
181 xposix_spawn \
182 xposix_spawn_file_actions_addclose \
183 xposix_spawn_file_actions_adddup2 \
184 xstrdup \
185 xstrndup \
186 xsymlink \
187 xsysconf \
188 xunlink \
189 xuselocale \
190 xwaitpid \
191 xwrite \
192
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
198 endif
199
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)\"
211
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
218
219 ifeq (,$(CXX))
220 LINKS_DSO_PROGRAM = links-dso-program-c
221 else
222 LINKS_DSO_PROGRAM = links-dso-program
223 LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
224 endif
225
226 ifeq (yes,$(have-selinux))
227 LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux
228 endif
229
230
231 LDLIBS-test-container = $(libsupport)
232
233 others += test-container
234 others-noinstall += test-container
235
236 others += shell-container echo-container true-container
237 others-noinstall += shell-container echo-container true-container
238
239 others += $(LINKS_DSO_PROGRAM)
240 others-noinstall += $(LINKS_DSO_PROGRAM)
241
242 $(objpfx)test-container : $(libsupport)
243 $(objpfx)shell-container : $(libsupport)
244 $(objpfx)echo-container : $(libsupport)
245 $(objpfx)true-container : $(libsupport)
246
247 tests = \
248 README-testing \
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 \
258 tst-test_compare \
259 tst-test_compare_blob \
260 tst-test_compare_string \
261 tst-timespec \
262 tst-xreadlink \
263 tst-xsigstack \
264
265 ifeq ($(run-built-tests),yes)
266 tests-special = \
267 $(objpfx)tst-support_record_failure-2.out
268
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)' \
273 > $@; \
274 $(evaluate-test)
275 endif
276
277 $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so
278
279 tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd)
280
281 include ../Rules