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