]> git.ipfire.org Git - thirdparty/glibc.git/blob - support/Makefile
support: Add create_temp_file_in_dir
[thirdparty/glibc.git] / support / Makefile
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.
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_range \
50 support_descriptor_supports_holes \
51 support_descriptors \
52 support_enter_mount_namespace \
53 support_enter_network_namespace \
54 support_format_address_family \
55 support_format_addrinfo \
56 support_format_dns_packet \
57 support_format_herrno \
58 support_format_hostent \
59 support_format_netent \
60 support_isolate_in_subprocess \
61 support_process_state \
62 support_ptrace \
63 support_openpty \
64 support_paths \
65 support_quote_blob \
66 support_quote_string \
67 support_record_failure \
68 support_run_diff \
69 support_set_small_thread_stack_size \
70 support_shared_allocate \
71 support_small_stack_thread_attribute \
72 support_subprocess \
73 support_test_compare_blob \
74 support_test_compare_failure \
75 support_test_compare_string \
76 support_write_file_string \
77 support_test_main \
78 support_test_verify_impl \
79 temp_file \
80 timespec \
81 timespec-add \
82 timespec-sub \
83 write_message \
84 xaccept \
85 xaccept4 \
86 xasprintf \
87 xbind \
88 xcalloc \
89 xchroot \
90 xclock_gettime \
91 xclose \
92 xconnect \
93 xcopy_file_range \
94 xdlfcn \
95 xdlmopen \
96 xdup2 \
97 xfclose \
98 xfopen \
99 xfork \
100 xftruncate \
101 xgetline \
102 xgetsockname \
103 xlisten \
104 xlseek \
105 xlstat \
106 xmalloc \
107 xmemstream \
108 xmkdir \
109 xmkdirp \
110 xmmap \
111 xmprotect \
112 xmunmap \
113 xnewlocale \
114 xopen \
115 xpipe \
116 xpoll \
117 xposix_memalign \
118 xpthread_attr_destroy \
119 xpthread_attr_init \
120 xpthread_attr_setdetachstate \
121 xpthread_attr_setguardsize \
122 xpthread_attr_setstack \
123 xpthread_attr_setstacksize \
124 xpthread_barrier_destroy \
125 xpthread_barrier_init \
126 xpthread_barrier_wait \
127 xpthread_barrierattr_destroy \
128 xpthread_barrierattr_init \
129 xpthread_barrierattr_setpshared \
130 xpthread_cancel \
131 xpthread_check_return \
132 xpthread_cond_wait \
133 xpthread_create \
134 xpthread_detach \
135 xpthread_join \
136 xpthread_key_create \
137 xpthread_key_delete \
138 xpthread_mutex_consistent \
139 xpthread_mutex_destroy \
140 xpthread_mutex_init \
141 xpthread_mutex_lock \
142 xpthread_mutex_unlock \
143 xpthread_mutexattr_destroy \
144 xpthread_mutexattr_init \
145 xpthread_mutexattr_setprotocol \
146 xpthread_mutexattr_setpshared \
147 xpthread_mutexattr_setrobust \
148 xpthread_mutexattr_settype \
149 xpthread_once \
150 xpthread_rwlock_init \
151 xpthread_rwlock_destroy \
152 xpthread_rwlock_rdlock \
153 xpthread_rwlock_unlock \
154 xpthread_rwlock_wrlock \
155 xpthread_rwlockattr_init \
156 xpthread_rwlockattr_setkind_np \
157 xpthread_sigmask \
158 xpthread_spin_lock \
159 xpthread_spin_unlock \
160 xraise \
161 xreadlink \
162 xrealloc \
163 xrecvfrom \
164 xsendto \
165 xsetlocale \
166 xsetsockopt \
167 xsigaction \
168 xsignal \
169 xsigstack \
170 xsocket \
171 xposix_spawn \
172 xposix_spawn_file_actions_addclose \
173 xposix_spawn_file_actions_adddup2 \
174 xstrdup \
175 xstrndup \
176 xsymlink \
177 xsysconf \
178 xunlink \
179 xuselocale \
180 xwaitpid \
181 xwrite \
182
183 libsupport-static-only-routines := $(libsupport-routines)
184 # Only build one variant of the library.
185 libsupport-inhibit-o := .os
186 ifeq ($(build-shared),yes)
187 libsupport-inhibit-o += .o
188 endif
189
190 CFLAGS-support_paths.c = \
191 -DSRCDIR_PATH=\"`cd .. ; pwd`\" \
192 -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
193 -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \
194 -DINSTDIR_PATH=\"$(prefix)\" \
195 -DLIBDIR_PATH=\"$(libdir)\" \
196 -DBINDIR_PATH=\"$(bindir)\" \
197 -DSBINDIR_PATH=\"$(sbindir)\" \
198 -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \
199 -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\"
200
201 # In support_timespec_check_in_range we may be passed a very tight
202 # range for which we should produce a correct result for expected
203 # being withing the observed range. The code uses double internally
204 # in support_timespec_check_in_range and for that computation we use
205 # -fexcess-precision=standard.
206 CFLAGS-timespec.c += -fexcess-precision=standard
207
208 ifeq (,$(CXX))
209 LINKS_DSO_PROGRAM = links-dso-program-c
210 else
211 LINKS_DSO_PROGRAM = links-dso-program
212 LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
213 endif
214
215 ifeq (yes,$(have-selinux))
216 LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux
217 endif
218
219
220 LDLIBS-test-container = $(libsupport)
221
222 others += test-container
223 others-noinstall += test-container
224
225 others += shell-container echo-container true-container
226 others-noinstall += shell-container echo-container true-container
227
228 others += $(LINKS_DSO_PROGRAM)
229 others-noinstall += $(LINKS_DSO_PROGRAM)
230
231 $(objpfx)test-container : $(libsupport)
232 $(objpfx)shell-container : $(libsupport)
233 $(objpfx)echo-container : $(libsupport)
234 $(objpfx)true-container : $(libsupport)
235
236 tests = \
237 README-testing \
238 tst-support-namespace \
239 tst-support_blob_repeat \
240 tst-support_capture_subprocess \
241 tst-support_descriptors \
242 tst-support_format_dns_packet \
243 tst-support-process_state \
244 tst-support_quote_blob \
245 tst-support_quote_string \
246 tst-support_record_failure \
247 tst-test_compare \
248 tst-test_compare_blob \
249 tst-test_compare_string \
250 tst-timespec \
251 tst-xreadlink \
252 tst-xsigstack \
253
254 ifeq ($(run-built-tests),yes)
255 tests-special = \
256 $(objpfx)tst-support_record_failure-2.out
257
258 $(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \
259 $(objpfx)tst-support_record_failure
260 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
261 '$(run-program-env)' '$(test-program-prefix-after-env)' \
262 > $@; \
263 $(evaluate-test)
264 endif
265
266 $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so
267
268 tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd)
269
270 include ../Rules