Regenerate sysdeps/mach/hurd/bits/errno.h
[glibc.git] / stdio-common / Makefile
blob7cf8d814ea38231621ad4f11467fe9c255a2bef3
1 # Copyright (C) 1991-2023 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 grouping_iterator \
43 iovfscanf \
44 isoc99_fscanf \
45 isoc99_scanf \
46 isoc99_sscanf \
47 isoc99_vfscanf \
48 isoc99_vscanf \
49 isoc99_vsscanf \
50 isoc23_fscanf \
51 isoc23_scanf \
52 isoc23_sscanf \
53 isoc23_vfscanf \
54 isoc23_vscanf \
55 isoc23_vsscanf \
56 itoa-digits \
57 itoa-udigits \
58 itowa-digits \
59 perror \
60 printf \
61 printf-prs \
62 printf_buffer_as_file \
63 printf_buffer_done \
64 printf_buffer_flush \
65 printf_buffer_pad_1 \
66 printf_buffer_putc_1 \
67 printf_buffer_puts_1 \
68 printf_buffer_to_file \
69 printf_buffer_write \
70 printf_fp \
71 printf_fphex \
72 printf_function_invoke \
73 printf_size \
74 psiginfo \
75 psignal \
76 putw \
77 reg-modifier \
78 reg-printf \
79 reg-type \
80 remove \
81 rename \
82 renameat \
83 renameat2 \
84 scanf \
85 snprintf \
86 sprintf \
87 sscanf \
88 tempnam \
89 tempname \
90 tmpfile \
91 tmpfile64 \
92 tmpnam \
93 tmpnam_r \
94 translated_number_width \
95 vfprintf \
96 vfprintf-internal \
97 vfscanf \
98 vfscanf-internal \
99 vfwprintf \
100 vfwprintf-internal \
101 vfwscanf \
102 vfwscanf-internal \
103 vprintf \
104 wprintf_buffer_as_file \
105 wprintf_buffer_done \
106 wprintf_buffer_flush \
107 wprintf_buffer_pad_1 \
108 wprintf_buffer_putc_1 \
109 wprintf_buffer_puts_1 \
110 wprintf_buffer_to_file \
111 wprintf_buffer_write \
112 wprintf_function_invoke \
113 # routines
115 aux := \
116 errlist \
117 errlist-data \
118 errname \
119 fxprintf \
120 printf-parsemb \
121 printf-parsewc \
122 siglist \
123 # aux
125 tests := \
126 bug-vfprintf-nargs \
127 bug1 \
128 bug10 \
129 bug11 \
130 bug12 \
131 bug13 \
132 bug14 \
133 bug16 \
134 bug17 \
135 bug18 \
136 bug18a \
137 bug19 \
138 bug19a \
139 bug2 \
140 bug20 \
141 bug21 \
142 bug22 \
143 bug23 \
144 bug23-2 \
145 bug23-3 \
146 bug23-4 \
147 bug24 \
148 bug25 \
149 bug26 \
150 bug3 \
151 bug4 \
152 bug5 \
153 bug6 \
154 bug7 \
155 bug8 \
156 bug9 \
157 errnobug \
158 scanf1 \
159 scanf10 \
160 scanf11 \
161 scanf12 \
162 scanf13 \
163 scanf14 \
164 scanf14a \
165 scanf15 \
166 scanf16 \
167 scanf16a \
168 scanf17 \
169 scanf2 \
170 scanf3 \
171 scanf4 \
172 scanf5 \
173 scanf7 \
174 scanf8 \
175 scanf9 \
176 temptest \
177 test-fseek \
178 test-fwrite \
179 test-popen \
180 test-strerr \
181 test-vfprintf \
182 test_rdwr \
183 tfformat \
184 tiformat \
185 tllformat \
186 tst-bz11319 \
187 tst-bz11319-fortify2 \
188 tst-cookie \
189 tst-dprintf-length \
190 tst-fdopen \
191 tst-ferror \
192 tst-fgets \
193 tst-fileno \
194 tst-fmemopen \
195 tst-fmemopen2 \
196 tst-fmemopen3 \
197 tst-fmemopen4 \
198 tst-fphex \
199 tst-fphex-wide \
200 tst-fseek \
201 tst-fwrite \
202 tst-gets \
203 tst-grouping \
204 tst-grouping2 \
205 tst-grouping3 \
206 tst-long-dbl-fphex \
207 tst-memstream-string \
208 tst-obprintf \
209 tst-perror \
210 tst-popen \
211 tst-popen2 \
212 tst-printf-binary \
213 tst-printf-bz18872 \
214 tst-printf-bz25691 \
215 tst-printf-fp-free \
216 tst-printf-fp-leak \
217 tst-printf-oct \
218 tst-printf-round \
219 tst-printfsz \
220 tst-put-error \
221 tst-renameat2 \
222 tst-rndseek \
223 tst-scanf-binary-c11 \
224 tst-scanf-binary-c2x \
225 tst-scanf-binary-gnu11 \
226 tst-scanf-binary-gnu89 \
227 tst-scanf-round \
228 tst-setvbuf1 \
229 tst-sprintf \
230 tst-sprintf-errno \
231 tst-sprintf2 \
232 tst-sprintf3 \
233 tst-sscanf \
234 tst-swprintf \
235 tst-swscanf \
236 tst-tmpnam \
237 tst-ungetc \
238 tst-unlockedio \
239 tst-vfprintf-mbs-prec \
240 tst-vfprintf-user-type \
241 tst-vfprintf-width-prec \
242 tst-vfprintf-width-prec-alloc \
243 tst-vfprintf-width-i18n \
244 tst-wc-printf \
245 tstdiomisc \
246 tstgetln \
247 tstscanf \
248 xbug \
249 # tests
251 tests-container += \
252 tst-popen3
254 generated += \
255 errlist-data-aux-shared.S \
256 errlist-data-aux.S \
257 siglist-aux-shared.S \
258 siglist-aux.S \
259 # generated
261 tests-internal = \
262 tst-grouping_iterator \
263 # tests-internal
265 test-srcs = tst-unbputc tst-printf tst-printfsz-islongdouble
267 ifeq ($(run-built-tests),yes)
268 tests-special += \
269 $(objpfx)tst-printf-bz18872-mem.out \
270 $(objpfx)tst-printf-bz25691-mem.out \
271 $(objpfx)tst-printf-fp-free-mem.out \
272 $(objpfx)tst-printf-fp-leak-mem.out \
273 $(objpfx)tst-printf.out \
274 $(objpfx)tst-printfsz-islongdouble.out \
275 $(objpfx)tst-setvbuf1-cmp.out \
276 $(objpfx)tst-unbputc.out \
277 $(objpfx)tst-vfprintf-width-prec-mem.out \
278 # tests-special
280 generated += \
281 tst-printf-bz18872-mem.out \
282 tst-printf-bz18872.c \
283 tst-printf-bz18872.mtrace \
284 tst-printf-bz25691-mem.out \
285 tst-printf-bz25691.mtrace \
286 tst-printf-fp-free-mem.out \
287 tst-printf-fp-free.mtrace \
288 tst-printf-fp-leak-mem.out \
289 tst-printf-fp-leak.mtrace \
290 tst-vfprintf-width-prec-mem.out \
291 tst-vfprintf-width-prec.mtrace \
292 # generated
293 endif # $(run-built-tests)
295 tests-special += $(objpfx)tst-errno-manual.out
297 include ../Rules
299 # The errlist.c is built in two phases because compiler might reorder the
300 # compat_symbol directive prior the object itself and on binutils older
301 # than 2.29 it might generate object sizes different than the expected ones.
302 $(objpfx)errlist-data-aux-shared.S: errlist-data-gen.c
303 $(make-target-directory)
304 $(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
306 $(objpfx)errlist-data-aux.S: errlist-data-gen.c
307 $(make-target-directory)
308 $(compile-command.c) $(pie-default) $(no-stack-protector) -S
310 ifndef no_deps
311 -include $(objpfx)errlist-data-aux.S.d $(objpfx)errlist-data-aux-shared.S.d
312 endif
314 $(objpfx)errlist-data.os: $(objpfx)errlist-data-aux-shared.S
315 $(addprefix $(objpfx)errlist-data, $(object-suffixes-noshared)): \
316 $(objpfx)errlist-data-aux.S
318 $(objpfx)siglist-aux-shared.S: siglist-gen.c
319 $(make-target-directory)
320 $(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
322 $(objpfx)siglist-aux.S: siglist-gen.c
323 $(make-target-directory)
324 $(compile-command.c) $(pie-default) $(no-stack-protector) -S
326 ifndef no_deps
327 -include $(objpfx)siglist-aux.S.d $(objpfx)siglist-aux-shared.S.d
328 endif
330 $(objpfx)siglist.os: $(objpfx)siglist-aux-shared.S
331 $(addprefix $(objpfx)siglist, $(object-suffixes-noshared)): \
332 $(objpfx)siglist-aux.S
334 ifeq ($(run-built-tests),yes)
335 LOCALES := \
336 de_DE.ISO-8859-1 \
337 de_DE.UTF-8 \
338 en_US.ISO-8859-1 \
339 hi_IN.UTF-8 \
340 ja_JP.EUC-JP \
341 ps_AF.UTF-8 \
342 tg_TJ.UTF-8 \
343 # LOCALES
344 include ../gen-locales.mk
346 $(objpfx)bug14.out: $(gen-locales)
347 $(objpfx)scanf13.out: $(gen-locales)
348 $(objpfx)test-vfprintf.out: $(gen-locales)
349 $(objpfx)tst-grouping.out: $(gen-locales)
350 $(objpfx)tst-grouping2.out: $(gen-locales)
351 $(objpfx)tst-grouping_iterator.out: $(gen-locales)
352 $(objpfx)tst-sprintf.out: $(gen-locales)
353 $(objpfx)tst-sscanf.out: $(gen-locales)
354 $(objpfx)tst-swprintf.out: $(gen-locales)
355 $(objpfx)tst-vfprintf-mbs-prec.out: $(gen-locales)
356 $(objpfx)tst-vfprintf-width-i18n.out: $(gen-locales)
357 $(objpfx)tst-grouping3.out: $(gen-locales)
358 endif
360 tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace \
361 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
362 tst-vfprintf-width-prec-ENV = \
363 MALLOC_TRACE=$(objpfx)tst-vfprintf-width-prec.mtrace \
364 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
365 tst-printf-bz25691-ENV = \
366 MALLOC_TRACE=$(objpfx)tst-printf-bz25691.mtrace \
367 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
368 tst-printf-fp-free-ENV = \
369 MALLOC_TRACE=$(objpfx)tst-printf-fp-free.mtrace \
370 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
371 tst-printf-fp-leak-ENV = \
372 MALLOC_TRACE=$(objpfx)tst-printf-fp-leak.mtrace \
373 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
375 $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
376 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
377 $(evaluate-test)
379 $(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
380 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
381 $(evaluate-test)
383 $(objpfx)tst-printfsz-islongdouble.out: \
384 tst-printfsz-islongdouble.sh $(objpfx)tst-printfsz-islongdouble
385 $(SHELL) $^ '$(test-program-prefix)' $@; \
386 $(evaluate-test)
388 # We generate this source because it requires a printf invocation with
389 # 10K arguments.
390 $(objpfx)tst-printf-bz18872.c: tst-printf-bz18872.sh
391 rm -f $@ && $(BASH) $^ > $@.new && mv $@.new $@
393 $(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
394 $(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
395 $(evaluate-test)
397 errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .)))
399 $(objpfx)tst-errno-manual.out: tst-errno-manual.py \
400 $(errlist-h) \
401 $(..)manual/errno.texi
402 $(PYTHON) tst-errno-manual.py -m $(..)manual/errno.texi \
403 -e $(errlist-h) > $@; \
404 $(evaluate-test)
406 CFLAGS-vfprintf.c += -Wno-uninitialized
407 CFLAGS-vfwprintf.c += -Wno-uninitialized
409 CFLAGS-tmpfile.c += -fexceptions
410 CFLAGS-tmpfile64.c += -fexceptions
411 CFLAGS-tempname.c += -fexceptions
412 CFLAGS-psignal.c += -fexceptions
413 CFLAGS-vprintf.c += -fexceptions
414 CFLAGS-cuserid.c += -fexceptions
416 CFLAGS-vfprintf.c += -fexceptions
417 CFLAGS-fprintf.c += -fexceptions
418 CFLAGS-printf.c += -fexceptions
419 CFLAGS-vfwprintf.c += -fexceptions
420 CFLAGS-vfscanf.c += -fexceptions
421 CFLAGS-vfwscanf.c += -fexceptions
422 CFLAGS-fscanf.c += -fexceptions
423 CFLAGS-scanf.c += -fexceptions
424 CFLAGS-isoc99_vfscanf.c += -fexceptions
425 CFLAGS-isoc99_vscanf.c += -fexceptions
426 CFLAGS-isoc99_fscanf.c += -fexceptions
427 CFLAGS-isoc99_scanf.c += -fexceptions
428 CFLAGS-isoc23_vfscanf.c += -fexceptions
429 CFLAGS-isoc23_vscanf.c += -fexceptions
430 CFLAGS-isoc23_fscanf.c += -fexceptions
431 CFLAGS-isoc23_scanf.c += -fexceptions
433 CFLAGS-dprintf.c += $(config-cflags-wno-ignored-attributes)
435 # scanf14a.c and scanf16a.c test a deprecated extension which is no
436 # longer visible under most conformance levels; see the source files
437 # for more detail.
438 CFLAGS-scanf14a.c += -std=gnu89
439 CFLAGS-scanf16a.c += -std=gnu89
441 CFLAGS-bug3.c += -DOBJPFX=\"$(objpfx)\"
442 CFLAGS-bug4.c += -DOBJPFX=\"$(objpfx)\"
443 CFLAGS-bug5.c += -DOBJPFX=\"$(objpfx)\"
444 CFLAGS-test-fseek.c += -DOBJPFX=\"$(objpfx)\"
445 CFLAGS-test-popen.c += -DOBJPFX=\"$(objpfx)\"
446 CFLAGS-test_rdwr.c += -DOBJPFX=\"$(objpfx)\"
448 # tst-gets.c tests a deprecated function.
449 CFLAGS-tst-gets.c += -Wno-deprecated-declarations
451 # BZ #11319 was first fixed for regular vdprintf, then reopened because
452 # the fortified version had the same bug.
453 CFLAGS-tst-bz11319-fortify2.c += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
455 CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf
457 # Some versions of GCC supported for building glibc do not support -std=c2x, so
458 # the test for that version uses -std=c11 and then _ISOC2X_SOURCE is defined in
459 # the test as needed.
460 CFLAGS-tst-scanf-binary-c11.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
461 CFLAGS-tst-scanf-binary-c2x.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
462 CFLAGS-tst-scanf-binary-gnu11.c += -std=gnu11 -DOBJPFX=\"$(objpfx)\"
463 CFLAGS-tst-scanf-binary-gnu89.c += -std=gnu89 -DOBJPFX=\"$(objpfx)\"
465 CPPFLAGS += $(libio-mtsafe)
467 $(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
468 $(test-program-cmd) > $@ 2>&1; \
469 $(evaluate-test)
471 $(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
472 cmp $^ > $@; \
473 $(evaluate-test)
475 $(objpfx)tst-printf-round: $(libm)
476 $(objpfx)tst-scanf-round: $(libm)