elf: Remove legacy hwcaps support from the dynamic loader
[glibc.git] / stdio-common / Makefile
blob9c98c02884659745da376bea4bc5d9dac2562d10
1 # Copyright (C) 1991-2022 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
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.
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
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
19 # Specific makefile for stdio-common.
21 subdir := stdio-common
23 include ../Makeconfig
25 headers := stdio_ext.h printf.h bits/printf-ldbl.h bits/stdio_lim.h
27 routines := \
28 _itoa \
29 _itowa \
30 asprintf \
31 ctermid \
32 cuserid \
33 dprintf \
34 flockfile \
35 fprintf \
36 fscanf \
37 ftrylockfile \
38 funlockfile \
39 gentempfd \
40 getline \
41 getw \
42 iovfscanf \
43 isoc99_fscanf \
44 isoc99_scanf \
45 isoc99_sscanf \
46 isoc99_vfscanf \
47 isoc99_vscanf \
48 isoc99_vsscanf \
49 itoa-digits \
50 itoa-udigits \
51 itowa-digits \
52 perror \
53 printf \
54 printf-prs \
55 printf_fp \
56 printf_fphex \
57 printf_size \
58 psiginfo \
59 psignal \
60 putw \
61 reg-modifier \
62 reg-printf \
63 reg-type \
64 remove \
65 rename \
66 renameat \
67 renameat2 \
68 scanf \
69 snprintf \
70 sprintf \
71 sscanf \
72 tempnam \
73 tempname \
74 tmpfile \
75 tmpfile64 \
76 tmpnam \
77 tmpnam_r \
78 vfprintf \
79 vfprintf-internal \
80 vfscanf \
81 vfscanf-internal \
82 vfwprintf \
83 vfwprintf-internal \
84 vfwscanf \
85 vfwscanf-internal \
86 vprintf \
87 # routines
89 aux := \
90 errlist \
91 errlist-data \
92 errname \
93 fxprintf \
94 printf-parsemb \
95 printf-parsewc \
96 siglist \
97 # aux
99 tests := \
100 bug-vfprintf-nargs \
101 bug1 \
102 bug10 \
103 bug11 \
104 bug12 \
105 bug13 \
106 bug14 \
107 bug16 \
108 bug17 \
109 bug18 \
110 bug18a \
111 bug19 \
112 bug19a \
113 bug2 \
114 bug20 \
115 bug21 \
116 bug22 \
117 bug23 \
118 bug23-2 \
119 bug23-3 \
120 bug23-4 \
121 bug24 \
122 bug25 \
123 bug26 \
124 bug3 \
125 bug4 \
126 bug5 \
127 bug6 \
128 bug7 \
129 bug8 \
130 bug9 \
131 errnobug \
132 scanf1 \
133 scanf10 \
134 scanf11 \
135 scanf12 \
136 scanf13 \
137 scanf14 \
138 scanf14a \
139 scanf15 \
140 scanf16 \
141 scanf16a \
142 scanf17 \
143 scanf2 \
144 scanf3 \
145 scanf4 \
146 scanf5 \
147 scanf7 \
148 scanf8 \
149 scanf9 \
150 temptest \
151 test-fseek \
152 test-fwrite \
153 test-popen \
154 test-strerr \
155 test-vfprintf \
156 test_rdwr \
157 tfformat \
158 tiformat \
159 tllformat \
160 tst-bz11319 \
161 tst-bz11319-fortify2 \
162 tst-cookie \
163 tst-fdopen \
164 tst-ferror \
165 tst-fgets \
166 tst-fileno \
167 tst-fmemopen \
168 tst-fmemopen2 \
169 tst-fmemopen3 \
170 tst-fmemopen4 \
171 tst-fphex \
172 tst-fphex-wide \
173 tst-fseek \
174 tst-fwrite \
175 tst-gets \
176 tst-grouping \
177 tst-grouping2 \
178 tst-long-dbl-fphex \
179 tst-memstream-string \
180 tst-obprintf \
181 tst-perror \
182 tst-popen \
183 tst-popen2 \
184 tst-printf-binary \
185 tst-printf-bz18872 \
186 tst-printf-bz25691 \
187 tst-printf-fp-free \
188 tst-printf-fp-leak \
189 tst-printf-round \
190 tst-printfsz \
191 tst-put-error \
192 tst-renameat2 \
193 tst-rndseek \
194 tst-scanf-round \
195 tst-setvbuf1 \
196 tst-sprintf \
197 tst-sprintf-errno \
198 tst-sprintf2 \
199 tst-sprintf3 \
200 tst-sscanf \
201 tst-swprintf \
202 tst-swscanf \
203 tst-tmpnam \
204 tst-ungetc \
205 tst-unlockedio \
206 tst-vfprintf-mbs-prec \
207 tst-vfprintf-user-type \
208 tst-vfprintf-width-prec \
209 tst-vfprintf-width-prec-alloc \
210 tst-vfprintf-width-i18n \
211 tst-wc-printf \
212 tstdiomisc \
213 tstgetln \
214 tstscanf \
215 xbug \
216 # tests
218 generated += \
219 errlist-data-aux-shared.S \
220 errlist-data-aux.S \
221 siglist-aux-shared.S \
222 siglist-aux.S \
223 # generated
225 test-srcs = tst-unbputc tst-printf tst-printfsz-islongdouble
227 ifeq ($(run-built-tests),yes)
228 tests-special += \
229 $(objpfx)tst-printf-bz18872-mem.out \
230 $(objpfx)tst-printf-bz25691-mem.out \
231 $(objpfx)tst-printf-fp-free-mem.out \
232 $(objpfx)tst-printf-fp-leak-mem.out \
233 $(objpfx)tst-printf.out \
234 $(objpfx)tst-printfsz-islongdouble.out \
235 $(objpfx)tst-setvbuf1-cmp.out \
236 $(objpfx)tst-unbputc.out \
237 $(objpfx)tst-vfprintf-width-prec-mem.out \
238 # tests-special
240 generated += \
241 tst-printf-bz18872-mem.out \
242 tst-printf-bz18872.c \
243 tst-printf-bz18872.mtrace \
244 tst-printf-bz25691-mem.out \
245 tst-printf-bz25691.mtrace \
246 tst-printf-fp-free-mem.out \
247 tst-printf-fp-free.mtrace \
248 tst-printf-fp-leak-mem.out \
249 tst-printf-fp-leak.mtrace \
250 tst-vfprintf-width-prec-mem.out \
251 tst-vfprintf-width-prec.mtrace \
252 # generated
253 endif # $(run-built-tests)
255 tests-special += $(objpfx)tst-errno-manual.out
257 include ../Rules
259 # The errlist.c is built in two phases because compiler might reorder the
260 # compat_symbol directive prior the object itself and on binutils older
261 # than 2.29 it might generate object sizes different than the expected ones.
262 $(objpfx)errlist-data-aux-shared.S: errlist-data-gen.c
263 $(make-target-directory)
264 $(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
266 $(objpfx)errlist-data-aux.S: errlist-data-gen.c
267 $(make-target-directory)
268 $(compile-command.c) $(pie-default) $(no-stack-protector) -S
270 ifndef no_deps
271 -include $(objpfx)errlist-data-aux.S.d $(objpfx)errlist-data-aux-shared.S.d
272 endif
274 $(objpfx)errlist-data.os: $(objpfx)errlist-data-aux-shared.S
275 $(objpfx)errlist-data.o: $(objpfx)errlist-data-aux.S
277 $(objpfx)siglist-aux-shared.S: siglist-gen.c
278 $(make-target-directory)
279 $(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
281 $(objpfx)siglist-aux.S: siglist-gen.c
282 $(make-target-directory)
283 $(compile-command.c) $(pie-default) $(no-stack-protector) -S
285 ifndef no_deps
286 -include $(objpfx)siglist-aux.S.d $(objpfx)siglist-aux-shared.S.d
287 endif
289 $(objpfx)siglist.os: $(objpfx)siglist-aux-shared.S
290 $(objpfx)siglist.o: $(objpfx)siglist-aux.S
292 ifeq ($(run-built-tests),yes)
293 LOCALES := \
294 de_DE.ISO-8859-1 \
295 de_DE.UTF-8 \
296 en_US.ISO-8859-1 \
297 hi_IN.UTF-8 \
298 ja_JP.EUC-JP \
299 ps_AF.UTF-8 \
300 # LOCALES
301 include ../gen-locales.mk
303 $(objpfx)bug14.out: $(gen-locales)
304 $(objpfx)scanf13.out: $(gen-locales)
305 $(objpfx)test-vfprintf.out: $(gen-locales)
306 $(objpfx)tst-grouping.out: $(gen-locales)
307 $(objpfx)tst-grouping2.out: $(gen-locales)
308 $(objpfx)tst-sprintf.out: $(gen-locales)
309 $(objpfx)tst-sscanf.out: $(gen-locales)
310 $(objpfx)tst-swprintf.out: $(gen-locales)
311 $(objpfx)tst-vfprintf-mbs-prec.out: $(gen-locales)
312 $(objpfx)tst-vfprintf-width-i18n.out: $(gen-locales)
313 endif
315 tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace \
316 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
317 tst-vfprintf-width-prec-ENV = \
318 MALLOC_TRACE=$(objpfx)tst-vfprintf-width-prec.mtrace \
319 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
320 tst-printf-bz25691-ENV = \
321 MALLOC_TRACE=$(objpfx)tst-printf-bz25691.mtrace \
322 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
323 tst-printf-fp-free-ENV = \
324 MALLOC_TRACE=$(objpfx)tst-printf-fp-free.mtrace \
325 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
326 tst-printf-fp-leak-ENV = \
327 MALLOC_TRACE=$(objpfx)tst-printf-fp-leak.mtrace \
328 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
330 $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
331 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
332 $(evaluate-test)
334 $(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
335 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
336 $(evaluate-test)
338 $(objpfx)tst-printfsz-islongdouble.out: \
339 tst-printfsz-islongdouble.sh $(objpfx)tst-printfsz-islongdouble
340 $(SHELL) $^ '$(test-program-prefix)' $@; \
341 $(evaluate-test)
343 # We generate this source because it requires a printf invocation with
344 # 10K arguments.
345 $(objpfx)tst-printf-bz18872.c: tst-printf-bz18872.sh
346 rm -f $@ && $(BASH) $^ > $@.new && mv $@.new $@
348 $(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
349 $(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
350 $(evaluate-test)
352 errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .)))
354 $(objpfx)tst-errno-manual.out: tst-errno-manual.py \
355 $(errlist-h) \
356 $(..)manual/errno.texi
357 $(PYTHON) tst-errno-manual.py -m $(..)manual/errno.texi \
358 -e $(errlist-h) > $@; \
359 $(evaluate-test)
361 CFLAGS-vfprintf.c += -Wno-uninitialized
362 CFLAGS-vfwprintf.c += -Wno-uninitialized
364 CFLAGS-tmpfile.c += -fexceptions
365 CFLAGS-tmpfile64.c += -fexceptions
366 CFLAGS-tempname.c += -fexceptions
367 CFLAGS-psignal.c += -fexceptions
368 CFLAGS-vprintf.c += -fexceptions
369 CFLAGS-cuserid.c += -fexceptions
371 CFLAGS-vfprintf.c += -fexceptions
372 CFLAGS-fprintf.c += -fexceptions
373 CFLAGS-printf.c += -fexceptions
374 CFLAGS-vfwprintf.c += -fexceptions
375 CFLAGS-vfscanf.c += -fexceptions
376 CFLAGS-vfwscanf.c += -fexceptions
377 CFLAGS-fscanf.c += -fexceptions
378 CFLAGS-scanf.c += -fexceptions
379 CFLAGS-isoc99_vfscanf.c += -fexceptions
380 CFLAGS-isoc99_vscanf.c += -fexceptions
381 CFLAGS-isoc99_fscanf.c += -fexceptions
382 CFLAGS-isoc99_scanf.c += -fexceptions
384 # scanf14a.c and scanf16a.c test a deprecated extension which is no
385 # longer visible under most conformance levels; see the source files
386 # for more detail.
387 CFLAGS-scanf14a.c += -std=gnu89
388 CFLAGS-scanf16a.c += -std=gnu89
390 CFLAGS-bug3.c += -DOBJPFX=\"$(objpfx)\"
391 CFLAGS-bug4.c += -DOBJPFX=\"$(objpfx)\"
392 CFLAGS-bug5.c += -DOBJPFX=\"$(objpfx)\"
393 CFLAGS-test-fseek.c += -DOBJPFX=\"$(objpfx)\"
394 CFLAGS-test-popen.c += -DOBJPFX=\"$(objpfx)\"
395 CFLAGS-test_rdwr.c += -DOBJPFX=\"$(objpfx)\"
397 # tst-gets.c tests a deprecated function.
398 CFLAGS-tst-gets.c += -Wno-deprecated-declarations
400 # BZ #11319 was first fixed for regular vdprintf, then reopened because
401 # the fortified version had the same bug.
402 CFLAGS-tst-bz11319-fortify2.c += -D_FORTIFY_SOURCE=2
404 CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf
406 CPPFLAGS += $(libio-mtsafe)
408 $(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
409 $(test-program-cmd) > $@ 2>&1; \
410 $(evaluate-test)
412 $(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
413 cmp $^ > $@; \
414 $(evaluate-test)
416 $(objpfx)tst-printf-round: $(libm)
417 $(objpfx)tst-scanf-round: $(libm)