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