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