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
56 printf_buffer_as_file \
60 printf_buffer_putc_1 \
61 printf_buffer_puts_1 \
62 printf_buffer_to_file \
66 printf_function_invoke \
88 translated_number_width \
98 wprintf_buffer_as_file \
100 wprintf_buffer_flush \
101 wprintf_buffer_pad_1 \
102 wprintf_buffer_putc_1 \
103 wprintf_buffer_puts_1 \
104 wprintf_buffer_to_file \
105 wprintf_buffer_write \
106 wprintf_function_invoke \
181 tst-bz11319-fortify2 \
200 tst-memstream-string \
228 tst-vfprintf-mbs-prec \
229 tst-vfprintf-user-type \
230 tst-vfprintf-width-prec \
231 tst-vfprintf-width-prec-alloc \
232 tst-vfprintf-width-i18n \
241 errlist-data-aux-shared.S \
243 siglist-aux-shared.S \
248 tst-grouping_iterator \
251 test-srcs
= tst-unbputc tst-printf tst-printfsz-islongdouble
253 ifeq ($(run-built-tests
),yes
)
255 $(objpfx
)tst-printf-bz18872-mem.out \
256 $(objpfx
)tst-printf-bz25691-mem.out \
257 $(objpfx
)tst-printf-fp-free-mem.out \
258 $(objpfx
)tst-printf-fp-leak-mem.out \
259 $(objpfx
)tst-printf.out \
260 $(objpfx
)tst-printfsz-islongdouble.out \
261 $(objpfx
)tst-setvbuf1-cmp.out \
262 $(objpfx
)tst-unbputc.out \
263 $(objpfx
)tst-vfprintf-width-prec-mem.out \
267 tst-printf-bz18872-mem.out \
268 tst-printf-bz18872.c \
269 tst-printf-bz18872.mtrace \
270 tst-printf-bz25691-mem.out \
271 tst-printf-bz25691.mtrace \
272 tst-printf-fp-free-mem.out \
273 tst-printf-fp-free.mtrace \
274 tst-printf-fp-leak-mem.out \
275 tst-printf-fp-leak.mtrace \
276 tst-vfprintf-width-prec-mem.out \
277 tst-vfprintf-width-prec.mtrace \
279 endif # $(run-built-tests)
281 tests-special
+= $(objpfx
)tst-errno-manual.out
285 # The errlist.c is built in two phases because compiler might reorder the
286 # compat_symbol directive prior the object itself and on binutils older
287 # than 2.29 it might generate object sizes different than the expected ones.
288 $(objpfx
)errlist-data-aux-shared.S
: errlist-data-gen.c
289 $(make-target-directory
)
290 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
292 $(objpfx
)errlist-data-aux.S
: errlist-data-gen.c
293 $(make-target-directory
)
294 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
297 -include $(objpfx
)errlist-data-aux.S.d
$(objpfx
)errlist-data-aux-shared.S.d
300 $(objpfx
)errlist-data.os
: $(objpfx
)errlist-data-aux-shared.S
301 $(addprefix $(objpfx
)errlist-data
, $(object-suffixes-noshared
)): \
302 $(objpfx
)errlist-data-aux.S
304 $(objpfx
)siglist-aux-shared.S
: siglist-gen.c
305 $(make-target-directory
)
306 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
308 $(objpfx
)siglist-aux.S
: siglist-gen.c
309 $(make-target-directory
)
310 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
313 -include $(objpfx
)siglist-aux.S.d
$(objpfx
)siglist-aux-shared.S.d
316 $(objpfx
)siglist.os
: $(objpfx
)siglist-aux-shared.S
317 $(addprefix $(objpfx
)siglist
, $(object-suffixes-noshared
)): \
318 $(objpfx
)siglist-aux.S
320 ifeq ($(run-built-tests
),yes
)
330 include ..
/gen-locales.mk
332 $(objpfx
)bug14.out
: $(gen-locales
)
333 $(objpfx
)scanf13.out
: $(gen-locales
)
334 $(objpfx
)test-vfprintf.out
: $(gen-locales
)
335 $(objpfx
)tst-grouping.out
: $(gen-locales
)
336 $(objpfx
)tst-grouping2.out
: $(gen-locales
)
337 $(objpfx
)tst-grouping_iterator.out
: $(gen-locales
)
338 $(objpfx
)tst-sprintf.out
: $(gen-locales
)
339 $(objpfx
)tst-sscanf.out
: $(gen-locales
)
340 $(objpfx
)tst-swprintf.out
: $(gen-locales
)
341 $(objpfx
)tst-vfprintf-mbs-prec.out
: $(gen-locales
)
342 $(objpfx
)tst-vfprintf-width-i18n.out
: $(gen-locales
)
345 tst-printf-bz18872-ENV
= MALLOC_TRACE
=$(objpfx
)tst-printf-bz18872.mtrace \
346 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
347 tst-vfprintf-width-prec-ENV
= \
348 MALLOC_TRACE
=$(objpfx
)tst-vfprintf-width-prec.mtrace \
349 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
350 tst-printf-bz25691-ENV
= \
351 MALLOC_TRACE
=$(objpfx
)tst-printf-bz25691.mtrace \
352 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
353 tst-printf-fp-free-ENV
= \
354 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-free.mtrace \
355 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
356 tst-printf-fp-leak-ENV
= \
357 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-leak.mtrace \
358 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
360 $(objpfx
)tst-unbputc.out
: tst-unbputc.sh
$(objpfx
)tst-unbputc
361 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
364 $(objpfx
)tst-printf.out
: tst-printf.sh
$(objpfx
)tst-printf
365 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
368 $(objpfx
)tst-printfsz-islongdouble.out
: \
369 tst-printfsz-islongdouble.sh
$(objpfx
)tst-printfsz-islongdouble
370 $(SHELL
) $^
'$(test-program-prefix)' $@
; \
373 # We generate this source because it requires a printf invocation with
375 $(objpfx
)tst-printf-bz18872.c
: tst-printf-bz18872.sh
376 rm -f
$@
&& $(BASH
) $^
> $@.new
&& mv
$@.new
$@
378 $(objpfx
)tst-
%-mem.out
: $(objpfx
)tst-
%.out
379 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-
$*.mtrace
> $@
; \
382 errlist-h
= $(firstword $(wildcard $(addsuffix /errlist.h
,$(sysdirs
) .
)))
384 $(objpfx
)tst-errno-manual.out
: tst-errno-manual.py \
386 $(..
)manual
/errno.texi
387 $(PYTHON
) tst-errno-manual.py
-m
$(..
)manual
/errno.texi \
388 -e
$(errlist-h
) > $@
; \
391 CFLAGS-vfprintf.c
+= -Wno-uninitialized
392 CFLAGS-vfwprintf.c
+= -Wno-uninitialized
394 CFLAGS-tmpfile.c
+= -fexceptions
395 CFLAGS-tmpfile64.c
+= -fexceptions
396 CFLAGS-tempname.c
+= -fexceptions
397 CFLAGS-psignal.c
+= -fexceptions
398 CFLAGS-vprintf.c
+= -fexceptions
399 CFLAGS-cuserid.c
+= -fexceptions
401 CFLAGS-vfprintf.c
+= -fexceptions
402 CFLAGS-fprintf.c
+= -fexceptions
403 CFLAGS-printf.c
+= -fexceptions
404 CFLAGS-vfwprintf.c
+= -fexceptions
405 CFLAGS-vfscanf.c
+= -fexceptions
406 CFLAGS-vfwscanf.c
+= -fexceptions
407 CFLAGS-fscanf.c
+= -fexceptions
408 CFLAGS-scanf.c
+= -fexceptions
409 CFLAGS-isoc99_vfscanf.c
+= -fexceptions
410 CFLAGS-isoc99_vscanf.c
+= -fexceptions
411 CFLAGS-isoc99_fscanf.c
+= -fexceptions
412 CFLAGS-isoc99_scanf.c
+= -fexceptions
414 CFLAGS-dprintf.c
+= $(config-cflags-wno-ignored-attributes
)
416 # scanf14a.c and scanf16a.c test a deprecated extension which is no
417 # longer visible under most conformance levels; see the source files
419 CFLAGS-scanf14a.c
+= -std
=gnu89
420 CFLAGS-scanf16a.c
+= -std
=gnu89
422 CFLAGS-bug3.c
+= -DOBJPFX
=\"$(objpfx
)\"
423 CFLAGS-bug4.c
+= -DOBJPFX
=\"$(objpfx
)\"
424 CFLAGS-bug5.c
+= -DOBJPFX
=\"$(objpfx
)\"
425 CFLAGS-test-fseek.c
+= -DOBJPFX
=\"$(objpfx
)\"
426 CFLAGS-test-popen.c
+= -DOBJPFX
=\"$(objpfx
)\"
427 CFLAGS-test_rdwr.c
+= -DOBJPFX
=\"$(objpfx
)\"
429 # tst-gets.c tests a deprecated function.
430 CFLAGS-tst-gets.c
+= -Wno-deprecated-declarations
432 # BZ #11319 was first fixed for regular vdprintf, then reopened because
433 # the fortified version had the same bug.
434 CFLAGS-tst-bz11319-fortify2.c
+= -D_FORTIFY_SOURCE
=2
436 CFLAGS-tst-memstream-string.c
+= -fno-builtin-fprintf
438 CPPFLAGS
+= $(libio-mtsafe
)
440 $(objpfx
)tst-setvbuf1.out
: /dev
/null
$(objpfx
)tst-setvbuf1
441 $(test-program-cmd
) > $@
2>&1; \
444 $(objpfx
)tst-setvbuf1-cmp.out
: tst-setvbuf1.expect
$(objpfx
)tst-setvbuf1.out
448 $(objpfx
)tst-printf-round
: $(libm
)
449 $(objpfx
)tst-scanf-round
: $(libm
)