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
67 printf_buffer_as_file \
71 printf_buffer_putc_1 \
72 printf_buffer_puts_1 \
73 printf_buffer_to_file \
77 printf_function_invoke \
99 translated_number_width \
109 wprintf_buffer_as_file \
110 wprintf_buffer_done \
111 wprintf_buffer_flush \
112 wprintf_buffer_pad_1 \
113 wprintf_buffer_putc_1 \
114 wprintf_buffer_puts_1 \
115 wprintf_buffer_to_file \
116 wprintf_buffer_write \
117 wprintf_function_invoke \
120 # Exclude fortified routines from being built with _FORTIFY_SOURCE
121 routines_no_fortify
+= \
131 # routines_no_fortify
205 tst-bz11319-fortify2 \
225 tst-memstream-string \
242 tst-scanf-binary-c11 \
243 tst-scanf-binary-c2x \
244 tst-scanf-binary-gnu11 \
245 tst-scanf-binary-gnu89 \
247 tst-scanf-to_inpunct \
259 tst-vfprintf-mbs-prec \
260 tst-vfprintf-user-type \
261 tst-vfprintf-width-i18n \
262 tst-vfprintf-width-prec \
263 tst-vfprintf-width-prec-alloc \
276 errlist-data-aux-shared.S \
278 siglist-aux-shared.S \
283 tst-grouping_iterator \
288 tst-printfsz-islongdouble \
292 ifeq ($(run-built-tests
),yes
)
294 $(objpfx
)tst-printf-bz18872-mem.out \
295 $(objpfx
)tst-printf-bz25691-mem.out \
296 $(objpfx
)tst-printf-fp-free-mem.out \
297 $(objpfx
)tst-printf-fp-leak-mem.out \
298 $(objpfx
)tst-printf.out \
299 $(objpfx
)tst-printfsz-islongdouble.out \
300 $(objpfx
)tst-setvbuf1-cmp.out \
301 $(objpfx
)tst-unbputc.out \
302 $(objpfx
)tst-vfprintf-width-prec-mem.out \
306 tst-printf-bz18872-mem.out \
307 tst-printf-bz18872.c \
308 tst-printf-bz18872.mtrace \
309 tst-printf-bz25691-mem.out \
310 tst-printf-bz25691.mtrace \
311 tst-printf-fp-free-mem.out \
312 tst-printf-fp-free.mtrace \
313 tst-printf-fp-leak-mem.out \
314 tst-printf-fp-leak.mtrace \
315 tst-vfprintf-width-prec-mem.out \
316 tst-vfprintf-width-prec.mtrace \
318 endif # $(run-built-tests)
320 tests-special
+= $(objpfx
)tst-errno-manual.out
324 # The errlist.c is built in two phases because compiler might reorder the
325 # compat_symbol directive prior the object itself and on binutils older
326 # than 2.29 it might generate object sizes different than the expected ones.
327 $(objpfx
)errlist-data-aux-shared.S
: errlist-data-gen.c
328 $(make-target-directory
)
329 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
331 $(objpfx
)errlist-data-aux.S
: errlist-data-gen.c
332 $(make-target-directory
)
333 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
336 -include $(objpfx
)errlist-data-aux.S.d
$(objpfx
)errlist-data-aux-shared.S.d
339 $(objpfx
)errlist-data.os
: $(objpfx
)errlist-data-aux-shared.S
340 $(addprefix $(objpfx
)errlist-data
, $(object-suffixes-noshared
)): \
341 $(objpfx
)errlist-data-aux.S
343 $(objpfx
)siglist-aux-shared.S
: siglist-gen.c
344 $(make-target-directory
)
345 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
347 $(objpfx
)siglist-aux.S
: siglist-gen.c
348 $(make-target-directory
)
349 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
352 -include $(objpfx
)siglist-aux.S.d
$(objpfx
)siglist-aux-shared.S.d
355 $(objpfx
)siglist.os
: $(objpfx
)siglist-aux-shared.S
356 $(addprefix $(objpfx
)siglist
, $(object-suffixes-noshared
)): \
357 $(objpfx
)siglist-aux.S
359 ifeq ($(run-built-tests
),yes
)
370 include ..
/gen-locales.mk
372 $(objpfx
)bug14.out
: $(gen-locales
)
373 $(objpfx
)scanf13.out
: $(gen-locales
)
374 $(objpfx
)test-vfprintf.out
: $(gen-locales
)
375 $(objpfx
)tst-grouping.out
: $(gen-locales
)
376 $(objpfx
)tst-grouping2.out
: $(gen-locales
)
377 $(objpfx
)tst-grouping_iterator.out
: $(gen-locales
)
378 $(objpfx
)tst-sprintf.out
: $(gen-locales
)
379 $(objpfx
)tst-sscanf.out
: $(gen-locales
)
380 $(objpfx
)tst-swprintf.out
: $(gen-locales
)
381 $(objpfx
)tst-vfprintf-mbs-prec.out
: $(gen-locales
)
382 $(objpfx
)tst-vfprintf-width-i18n.out
: $(gen-locales
)
383 $(objpfx
)tst-grouping3.out
: $(gen-locales
)
384 $(objpfx
)tst-scanf-to_inpunct.out
: $(gen-locales
)
387 tst-printf-bz18872-ENV
= MALLOC_TRACE
=$(objpfx
)tst-printf-bz18872.mtrace \
388 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
389 tst-vfprintf-width-prec-ENV
= \
390 MALLOC_TRACE
=$(objpfx
)tst-vfprintf-width-prec.mtrace \
391 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
392 tst-printf-bz25691-ENV
= \
393 MALLOC_TRACE
=$(objpfx
)tst-printf-bz25691.mtrace \
394 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
395 tst-printf-fp-free-ENV
= \
396 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-free.mtrace \
397 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
398 tst-printf-fp-leak-ENV
= \
399 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-leak.mtrace \
400 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
402 $(objpfx
)tst-unbputc.out
: tst-unbputc.sh
$(objpfx
)tst-unbputc
403 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
406 $(objpfx
)tst-printf.out
: tst-printf.sh
$(objpfx
)tst-printf
407 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
410 $(objpfx
)tst-printfsz-islongdouble.out
: \
411 tst-printfsz-islongdouble.sh
$(objpfx
)tst-printfsz-islongdouble
412 $(SHELL
) $^
'$(test-program-prefix)' $@
; \
415 # We generate this source because it requires a printf invocation with
417 $(objpfx
)tst-printf-bz18872.c
: tst-printf-bz18872.sh
418 rm -f
$@
&& $(BASH
) $^
> $@.new
&& mv
$@.new
$@
420 $(objpfx
)tst-
%-mem.out
: $(objpfx
)tst-
%.out
421 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-
$*.mtrace
> $@
; \
424 errlist-h
= $(firstword $(wildcard $(addsuffix /errlist.h
,$(sysdirs
) .
)))
426 $(objpfx
)tst-errno-manual.out
: tst-errno-manual.py \
428 $(..
)manual
/errno.texi
429 $(PYTHON
) tst-errno-manual.py
-m
$(..
)manual
/errno.texi \
430 -e
$(errlist-h
) > $@
; \
433 CFLAGS-vfprintf.c
+= -Wno-uninitialized
434 CFLAGS-vfwprintf.c
+= -Wno-uninitialized
436 CFLAGS-tmpfile.c
+= -fexceptions
437 CFLAGS-tmpfile64.c
+= -fexceptions
438 CFLAGS-tempname.c
+= -fexceptions
439 CFLAGS-psignal.c
+= -fexceptions
440 CFLAGS-vprintf.c
+= -fexceptions
441 CFLAGS-cuserid.c
+= -fexceptions
443 CFLAGS-vfprintf.c
+= -fexceptions
444 CFLAGS-fprintf.c
+= -fexceptions
445 CFLAGS-printf.c
+= -fexceptions
446 CFLAGS-vfwprintf.c
+= -fexceptions
447 CFLAGS-vfscanf.c
+= -fexceptions
448 CFLAGS-vfwscanf.c
+= -fexceptions
449 CFLAGS-fscanf.c
+= -fexceptions
450 CFLAGS-scanf.c
+= -fexceptions
451 CFLAGS-isoc99_vfscanf.c
+= -fexceptions
452 CFLAGS-isoc99_vscanf.c
+= -fexceptions
453 CFLAGS-isoc99_fscanf.c
+= -fexceptions
454 CFLAGS-isoc99_scanf.c
+= -fexceptions
455 CFLAGS-isoc23_vfscanf.c
+= -fexceptions
456 CFLAGS-isoc23_vscanf.c
+= -fexceptions
457 CFLAGS-isoc23_fscanf.c
+= -fexceptions
458 CFLAGS-isoc23_scanf.c
+= -fexceptions
460 CFLAGS-dprintf.c
+= $(config-cflags-wno-ignored-attributes
)
462 # scanf18.c and scanf19.c test a deprecated extension which is no
463 # longer visible under most conformance levels; see the source files
465 CFLAGS-scanf18.c
+= -std
=gnu89
466 CFLAGS-scanf19.c
+= -std
=gnu89
468 CFLAGS-bug3.c
+= -DOBJPFX
=\"$(objpfx
)\"
469 CFLAGS-bug4.c
+= -DOBJPFX
=\"$(objpfx
)\"
470 CFLAGS-bug5.c
+= -DOBJPFX
=\"$(objpfx
)\"
471 CFLAGS-test-fseek.c
+= -DOBJPFX
=\"$(objpfx
)\"
472 CFLAGS-test-popen.c
+= -DOBJPFX
=\"$(objpfx
)\"
473 CFLAGS-test_rdwr.c
+= -DOBJPFX
=\"$(objpfx
)\"
475 # tst-gets.c tests a deprecated function.
476 CFLAGS-tst-gets.c
+= -Wno-deprecated-declarations
478 # BZ #11319 was first fixed for regular vdprintf, then reopened because
479 # the fortified version had the same bug.
480 CFLAGS-tst-bz11319-fortify2.c
+= $(no-fortify-source
),-D_FORTIFY_SOURCE
=2
482 CFLAGS-tst-memstream-string.c
+= -fno-builtin-fprintf
484 # Some versions of GCC supported for building glibc do not support -std=c2x, so
485 # the test for that version uses -std=c11 and then _ISOC2X_SOURCE is defined in
486 # the test as needed.
487 CFLAGS-tst-scanf-binary-c11.c
+= -std
=c11
-DOBJPFX
=\"$(objpfx
)\"
488 CFLAGS-tst-scanf-binary-c2x.c
+= -std
=c11
-DOBJPFX
=\"$(objpfx
)\"
489 CFLAGS-tst-scanf-binary-gnu11.c
+= -std
=gnu11
-DOBJPFX
=\"$(objpfx
)\"
490 CFLAGS-tst-scanf-binary-gnu89.c
+= -std
=gnu89
-DOBJPFX
=\"$(objpfx
)\"
492 CPPFLAGS
+= $(libio-mtsafe
)
494 $(objpfx
)tst-setvbuf1.out
: /dev
/null
$(objpfx
)tst-setvbuf1
495 $(test-program-cmd
) > $@
2>&1; \
498 $(objpfx
)tst-setvbuf1-cmp.out
: tst-setvbuf1.expect
$(objpfx
)tst-setvbuf1.out
502 $(objpfx
)tst-printf-round
: $(libm
)
503 $(objpfx
)tst-scanf-round
: $(libm
)