]> git.ipfire.org Git - thirdparty/glibc.git/blame - stdlib/Makefile
posix/glob.c: update from gnulib
[thirdparty/glibc.git] / stdlib / Makefile
CommitLineData
581c785b 1# Copyright (C) 1991-2022 Free Software Foundation, Inc.
28f540f4
RM
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
28f540f4
RM
8
9# The GNU C Library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12# Lesser General Public License for more details.
28f540f4 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6 15# License along with the GNU C Library; if not, see
5a82c748 16# <https://www.gnu.org/licenses/>.
28f540f4
RM
17
18#
19# Makefile for stdlib routines
20#
21subdir := stdlib
22
a5f891ac
JM
23include ../Makeconfig
24
d275970a
AZ
25headers := \
26 alloca.h \
27 bits/errno.h \
28 bits/indirect-return.h \
29 bits/monetary-ldbl.h \
30 bits/stdint-intn.h \
31 bits/stdint-uintn.h \
32 bits/stdlib-bsearch.h \
33 bits/stdlib-float.h \
34 bits/stdlib.h \
35 bits/stdlib-ldbl.h \
36 bits/time64.h \
37 bits/timesize.h \
38 bits/types/error_t.h \
39 bits/wordsize.h \
40 errno.h \
41 fmtmsg.h \
42 inttypes.h \
43 monetary.h \
44 stdint.h \
45 stdlib.h \
46 sys/errno.h \
47 sys/random.h \
48 sys/ucontext.h \
49 ucontext.h \
50 # headers
51
52routines := \
53 a64l \
54 abort \
55 abs \
56 at_quick_exit \
57 atof \
58 atoi \
59 atol\
60 atoll \
61 bsearch \
62 canonicalize \
63 cxa_at_quick_exit \
64 cxa_atexit \
65 cxa_finalize \
66 cxa_thread_atexit_impl \
67 div \
68 drand48 \
69 drand48-iter \
70 drand48_r \
71 erand48 \
72 erand48_r \
73 exit \
74 fmtmsg \
75 getcontext \
76 getentropy \
77 getenv \
78 getrandom \
79 getsubopt \
80 jrand48 \
81 jrand48_r \
82 l64a \
83 labs \
84 lcong48 \
85 lcong48_r \
86 ldiv \
87 llabs \
88 lldiv \
89 lrand48 \
90 lrand48_r \
91 makecontext \
92 mblen \
93 mbstowcs \
94 mbtowc \
95 mrand48 \
96 mrand48_r \
97 msort \
98 nrand48 \
99 nrand48_r \
100 old_atexit \
101 on_exit atexit \
102 putenv \
103 qsort \
104 quick_exit \
105 rand \
106 rand_r \
107 random \
108 random_r \
109 rpmatch \
110 secure-getenv \
111 seed48 \
112 seed48_r \
113 setcontext \
114 setenv \
115 srand48 \
116 srand48_r \
117 strfmon \
118 strfmon_l \
119 strfromd \
120 strfromf \
121 strfroml \
122 strtod \
123 strtod_l \
124 strtod_nan \
125 strtof \
126 strtof_l \
127 strtof_nan \
128 strtol \
129 strtol_l \
130 strtold \
131 strtold_l \
132 strtold_nan \
133 strtoll \
134 strtoll_l \
135 strtoul \
136 strtoul_l \
137 strtoull \
138 strtoull_l \
139 swapcontext \
140 system \
141 wcstombs \
142 wctomb \
143 xpg_basename \
144 # routines
145
146aux = \
147 grouping \
148 groupingwc \
149 tens_in_limb \
150 # aux
28f540f4 151
c08bc50a
UD
152# These routines will be omitted from the libc shared object.
153# Instead the static object files will be included in a special archive
154# linked against when the shared library will be used.
d275970a
AZ
155static-only-routines = \
156 atexit \
157 at_quick_exit \
158 # static-only-routines
159
160test-srcs := \
161 tst-fmtmsg \
162 #test-srcs
c08bc50a 163
f9dab1b5
SP
164tests := \
165 bug-fmtmsg1 \
166 bug-getcontext \
167 bug-strtod \
168 bug-strtod2 \
169 test-a64l \
170 test-at_quick_exit-race \
171 test-atexit-race \
172 test-bz22786 \
173 test-canon \
174 test-canon2 \
175 test-cxa_atexit-race \
176 test-cxa_atexit-race2 \
177 test-dlclose-exit-race \
178 test-on_exit-race \
179 testdiv \
180 testmb \
181 testmb2 \
182 testrand \
183 testsort \
184 tst-at_quick_exit \
185 tst-atexit \
186 tst-atof1 \
187 tst-atof2 \
188 tst-bsearch \
189 tst-bz20544 \
190 tst-canon-bz26341 \
191 tst-cxa_atexit \
192 tst-environ \
193 tst-getrandom \
194 tst-limits \
195 tst-makecontext \
196 tst-makecontext-align \
197 tst-makecontext2 \
198 tst-makecontext3 \
199 tst-on_exit \
200 tst-qsort \
201 tst-qsort2 \
202 tst-quick_exit \
203 tst-rand48 \
204 tst-rand48-2 \
205 tst-random \
206 tst-random2 \
207 tst-realpath \
ee8d5e33 208 tst-realpath-toolong \
f9dab1b5
SP
209 tst-secure-getenv \
210 tst-setcontext \
211 tst-setcontext2 \
212 tst-setcontext3 \
213 tst-setcontext4 \
214 tst-setcontext5 \
215 tst-setcontext6 \
216 tst-setcontext7 \
217 tst-setcontext8 \
218 tst-setcontext9 \
219 tst-strfmon_l \
220 tst-strfrom \
221 tst-strfrom-locale \
222 tst-strtod \
223 tst-strtod-nan-locale \
224 tst-strtod-nan-sign \
225 tst-strtod-overflow \
226 tst-strtod-round \
227 tst-strtod-underflow \
228 tst-strtod2 \
229 tst-strtod5 \
230 tst-strtod6 \
231 tst-strtol \
232 tst-strtol-locale \
233 tst-strtoll \
234 tst-swapcontext1 \
235 tst-thread-quick_exit \
236 tst-tininess \
237 tst-unsetenv1 \
238 tst-width \
239 tst-width-stdint \
240 tst-xpg-basename \
d275970a
AZ
241 # tests
242
243tests-internal := \
244 tst-strtod1i \
245 tst-strtod3 \
246 tst-strtod4 \
247 tst-strtod5i \
248 tst-tls-atexit \
249 tst-tls-atexit-nodelete \
250 # tests-internal
5f3b183d 251
d275970a
AZ
252tests-static := \
253 tst-secure-getenv \
254 # tests-static
255
256tests-container := \
257 tst-system \
258 #tests-container
7c3018f9 259
41389c40 260ifeq ($(build-hardcoded-path-in-tests),yes)
d275970a
AZ
261tests += \
262 tst-empty-env \
263 # tests
41389c40 264endif
7c3018f9 265
26e70aec
PP
266LDLIBS-test-atexit-race = $(shared-thread-library)
267LDLIBS-test-at_quick_exit-race = $(shared-thread-library)
268LDLIBS-test-cxa_atexit-race = $(shared-thread-library)
16adc58e 269LDLIBS-test-cxa_atexit-race2 = $(shared-thread-library)
26e70aec 270LDLIBS-test-on_exit-race = $(shared-thread-library)
961d7cff 271LDLIBS-tst-canon-bz26341 = $(shared-thread-library)
26e70aec 272
6f1c7010 273LDLIBS-test-dlclose-exit-race = $(shared-thread-library)
e5e4d7cc
PP
274LDFLAGS-test-dlclose-exit-race = $(LDFLAGS-rdynamic)
275LDLIBS-test-dlclose-exit-race-helper.so = $(libsupport) $(shared-thread-library)
276
47dd3543
CD
277ifeq ($(have-cxx-thread_local),yes)
278CFLAGS-tst-quick_exit.o = -std=c++11
279LDLIBS-tst-quick_exit = -lstdc++
280CFLAGS-tst-thread-quick_exit.o = -std=c++11
281LDLIBS-tst-thread-quick_exit = -lstdc++
282$(objpfx)tst-thread-quick_exit: $(shared-thread-library)
283else
d275970a
AZ
284tests-unsupported += \
285 tst-quick_exit \
286 tst-thread-quick_exit \
287 # tests-unsupported
47dd3543 288endif
28f540f4 289
d275970a
AZ
290modules-names = \
291 test-dlclose-exit-race-helper \
292 tst-tls-atexit-lib \
293 # modules-names
b4bcb3ae 294extra-test-objs += $(addsuffix .os, $(modules-names))
ba384f6e 295
574b268e 296ifeq ($(build-shared),yes)
d275970a
AZ
297tests += \
298 tst-putenv \
299 # tests
574b268e 300endif
3ef21326
RM
301
302# Several mpn functions from GNU MP are used by the strtod function.
d275970a
AZ
303mpn-routines := \
304 add_n \
305 addmul_1 \
306 cmp \
307 divmod_1 \
308 divrem \
309 inlines \
310 lshift \
311 mod_1 \
312 mul \
313 mul_1 \
314 mul_n \
315 rshift \
316 sub_n \
317 submul_1 \
318 udiv_qrnnd \
319 # mpn-routines
320mpn-headers = \
321 asm-syntax.h \
322 gmp-impl.h \
323 gmp-mparam.h \
324 gmp.h \
325 longlong.h \
326 # mpn-headers
3ef21326 327
d275970a
AZ
328routines := \
329 $(strip $(routines) $(mpn-routines)) \
330 dbl2mpn \
331 ldbl2mpn \
332 mpn2dbl \
333 mpn2flt \
334 mpn2ldbl \
335 # routines
336aux += \
337 fpioconst \
338 mp_clz_tab \
339 # aux
574b268e 340
d275970a
AZ
341tests-extras += \
342 tst-putenvmod \
343 # tests-extras
344
345extra-test-objs += \
346 tst-putenvmod.os \
347 # extra-test-objs
3ef21326 348
d275970a
AZ
349generated += \
350 isomac \
351 isomac.out \
352 tst-putenvmod.so \
353 # generated
3ef21326 354
36975e8e
L
355CFLAGS-bsearch.c += $(uses-callbacks)
356CFLAGS-msort.c += $(uses-callbacks)
357CFLAGS-qsort.c += $(uses-callbacks)
358CFLAGS-system.c += -fexceptions
6bbc689e 359CFLAGS-system.os = -fomit-frame-pointer
36975e8e 360CFLAGS-fmtmsg.c += -fexceptions
dff14448 361
36975e8e
L
362CFLAGS-strfmon.c += $(libio-mtsafe)
363CFLAGS-strfmon_l.c += $(libio-mtsafe)
917e27b8 364
6962682f
GG
365# The strfrom class of functions call __printf_fp in order to convert the
366# floating-point value to characters. This requires the value of IO_MTSAFE_IO.
36975e8e
L
367CFLAGS-strfromd.c += $(libio-mtsafe)
368CFLAGS-strfromf.c += $(libio-mtsafe)
369CFLAGS-strfroml.c += $(libio-mtsafe)
6962682f 370
36975e8e
L
371CFLAGS-tst-bsearch.c += $(stack-align-test-flags)
372CFLAGS-tst-qsort.c += $(stack-align-test-flags)
e535ce25 373CFLAGS-tst-makecontext.c += -funwind-tables
36975e8e 374CFLAGS-tst-makecontext2.c += $(stack-align-test-flags)
a4db3439 375
f214606a
JM
376# Run a test on the header files we use.
377tests-special += $(objpfx)isomac.out
378
379ifeq ($(run-built-tests),yes)
380tests-special += $(objpfx)tst-fmtmsg.out
381endif
382
28f540f4 383include ../Rules
3ef21326 384
f881f6ff 385ifeq ($(run-built-tests),yes)
d275970a
AZ
386LOCALES := \
387 cs_CZ.UTF-8 \
388 de_DE.UTF-8 \
389 el_GR.UTF-8 \
390 en_US.ISO-8859-1 \
391 hi_IN.UTF-8 \
392 hr_HR.UTF-8 \
393 tg_TJ.UTF-8 \
394 tr_TR.ISO-8859-9 \
395 tr_TR.UTF-8 \
396 # LOCALES
f881f6ff
AS
397include ../gen-locales.mk
398
399$(objpfx)bug-strtod2.out: $(gen-locales)
400$(objpfx)testmb2.out: $(gen-locales)
401$(objpfx)tst-strtod.out: $(gen-locales)
e4890300 402$(objpfx)tst-strtod1i.out: $(gen-locales)
f881f6ff
AS
403$(objpfx)tst-strtod3.out: $(gen-locales)
404$(objpfx)tst-strtod4.out: $(gen-locales)
405$(objpfx)tst-strtod5.out: $(gen-locales)
e4890300 406$(objpfx)tst-strtod5i.out: $(gen-locales)
f5eee5c7 407$(objpfx)tst-strtol-locale.out: $(gen-locales)
a7f0c5ae 408$(objpfx)tst-strtod-nan-locale.out: $(gen-locales)
985fc132 409$(objpfx)tst-strfmon_l.out: $(gen-locales)
cd74aa4d
RS
410$(objpfx)tst-strfrom.out: $(gen-locales)
411$(objpfx)tst-strfrom-locale.out: $(gen-locales)
e5e4d7cc 412$(objpfx)test-dlclose-exit-race.out: $(objpfx)test-dlclose-exit-race-helper.so
f881f6ff
AS
413endif
414
e25054c4 415# Testdir has to be named stdlib and needs to be writable
9f835f5f 416test-canon-ARGS = --test-dir=${common-objpfx}stdlib
e25054c4 417
400aa020 418bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
98d3e993 419
ca41028b 420$(objpfx)isomac.out: $(objpfx)isomac
7eff7a05 421 $(dir $<)$(notdir $<) '$(CC)' \
d5afb385 422 '-I../include $(+sysdep-includes) $(sysincludes) -I..' > $@; \
f0881698 423 $(evaluate-test)
1eb687d0 424
e69924e3 425isomac-CFLAGS = -O
1eb687d0
UD
426$(objpfx)isomac: isomac.c
427 $(native-compile)
9f6c1fc4
UD
428
429$(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg
8540f6d2
JM
430 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
431 '$(run-program-env)' '$(test-program-prefix-after-env)' \
8f8052c2 432 $(common-objpfx)stdlib/; \
f0881698 433 $(evaluate-test)
574b268e
UD
434
435$(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so
8b196ac4 436LDFLAGS-tst-putenv = -Wl,--no-as-needed
574b268e 437
fab7ce3f 438$(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps)
574b268e 439 $(build-module)
9cd47470 440libof-tst-putenvmod = extramodules
75ea32ab 441
79520f4b 442$(objpfx)bug-getcontext: $(libm)
45f39d45 443$(objpfx)bug-strtod2: $(libm)
79520f4b
JM
444$(objpfx)tst-strtod-round: $(libm)
445$(objpfx)tst-tininess: $(libm)
446$(objpfx)tst-strtod-underflow: $(libm)
447$(objpfx)tst-strtod6: $(libm)
a7f0c5ae 448$(objpfx)tst-strtod-nan-locale: $(libm)
b12c1e79 449$(objpfx)tst-strtod-nan-sign: $(libm)
ba384f6e
SP
450
451tst-tls-atexit-lib.so-no-z-defs = yes
e5e4d7cc 452test-dlclose-exit-race-helper.so-no-z-defs = yes
ba384f6e 453
6f1c7010 454$(objpfx)tst-tls-atexit: $(shared-thread-library)
ba384f6e 455$(objpfx)tst-tls-atexit.out: $(objpfx)tst-tls-atexit-lib.so
c92d40c0 456
6f1c7010 457$(objpfx)tst-tls-atexit-nodelete: $(shared-thread-library)
90b37cac
SP
458$(objpfx)tst-tls-atexit-nodelete.out: $(objpfx)tst-tls-atexit-lib.so
459
c92d40c0
CD
460$(objpfx)tst-setcontext3.out: tst-setcontext3.sh $(objpfx)tst-setcontext3
461 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
462 '$(run-program-env)' '$(test-program-prefix-after-env)' \
8f8052c2 463 $(common-objpfx)stdlib/; \
c92d40c0 464 $(evaluate-test)