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
25 headers
:= stdio_ext.h printf.h bits
/printf-ldbl.h bits
/stdio_lim.h
62 printf_buffer_as_file \
66 printf_buffer_putc_1 \
67 printf_buffer_puts_1 \
68 printf_buffer_to_file \
72 printf_function_invoke \
94 translated_number_width \
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 \
187 tst-bz11319-fortify2 \
207 tst-memstream-string \
223 tst-scanf-binary-c11 \
224 tst-scanf-binary-c2x \
225 tst-scanf-binary-gnu11 \
226 tst-scanf-binary-gnu89 \
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 \
255 errlist-data-aux-shared.S \
257 siglist-aux-shared.S \
262 tst-grouping_iterator \
265 test-srcs
= tst-unbputc tst-printf tst-printfsz-islongdouble
267 ifeq ($(run-built-tests
),yes
)
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 \
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 \
293 endif # $(run-built-tests)
295 tests-special
+= $(objpfx
)tst-errno-manual.out
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
311 -include $(objpfx
)errlist-data-aux.S.d
$(objpfx
)errlist-data-aux-shared.S.d
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
327 -include $(objpfx
)siglist-aux.S.d
$(objpfx
)siglist-aux-shared.S.d
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
)
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
)
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)'; \
379 $(objpfx
)tst-printf.out
: tst-printf.sh
$(objpfx
)tst-printf
380 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
383 $(objpfx
)tst-printfsz-islongdouble.out
: \
384 tst-printfsz-islongdouble.sh
$(objpfx
)tst-printfsz-islongdouble
385 $(SHELL
) $^
'$(test-program-prefix)' $@
; \
388 # We generate this source because it requires a printf invocation with
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
> $@
; \
397 errlist-h
= $(firstword $(wildcard $(addsuffix /errlist.h
,$(sysdirs
) .
)))
399 $(objpfx
)tst-errno-manual.out
: tst-errno-manual.py \
401 $(..
)manual
/errno.texi
402 $(PYTHON
) tst-errno-manual.py
-m
$(..
)manual
/errno.texi \
403 -e
$(errlist-h
) > $@
; \
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
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; \
471 $(objpfx
)tst-setvbuf1-cmp.out
: tst-setvbuf1.expect
$(objpfx
)tst-setvbuf1.out
475 $(objpfx
)tst-printf-round
: $(libm
)
476 $(objpfx
)tst-scanf-round
: $(libm
)