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 \
201 tst-memstream-string \
229 tst-vfprintf-mbs-prec \
230 tst-vfprintf-user-type \
231 tst-vfprintf-width-prec \
232 tst-vfprintf-width-prec-alloc \
233 tst-vfprintf-width-i18n \
245 errlist-data-aux-shared.S \
247 siglist-aux-shared.S \
252 tst-grouping_iterator \
255 test-srcs
= tst-unbputc tst-printf tst-printfsz-islongdouble
257 ifeq ($(run-built-tests
),yes
)
259 $(objpfx
)tst-printf-bz18872-mem.out \
260 $(objpfx
)tst-printf-bz25691-mem.out \
261 $(objpfx
)tst-printf-fp-free-mem.out \
262 $(objpfx
)tst-printf-fp-leak-mem.out \
263 $(objpfx
)tst-printf.out \
264 $(objpfx
)tst-printfsz-islongdouble.out \
265 $(objpfx
)tst-setvbuf1-cmp.out \
266 $(objpfx
)tst-unbputc.out \
267 $(objpfx
)tst-vfprintf-width-prec-mem.out \
271 tst-printf-bz18872-mem.out \
272 tst-printf-bz18872.c \
273 tst-printf-bz18872.mtrace \
274 tst-printf-bz25691-mem.out \
275 tst-printf-bz25691.mtrace \
276 tst-printf-fp-free-mem.out \
277 tst-printf-fp-free.mtrace \
278 tst-printf-fp-leak-mem.out \
279 tst-printf-fp-leak.mtrace \
280 tst-vfprintf-width-prec-mem.out \
281 tst-vfprintf-width-prec.mtrace \
283 endif # $(run-built-tests)
285 tests-special
+= $(objpfx
)tst-errno-manual.out
289 # The errlist.c is built in two phases because compiler might reorder the
290 # compat_symbol directive prior the object itself and on binutils older
291 # than 2.29 it might generate object sizes different than the expected ones.
292 $(objpfx
)errlist-data-aux-shared.S
: errlist-data-gen.c
293 $(make-target-directory
)
294 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
296 $(objpfx
)errlist-data-aux.S
: errlist-data-gen.c
297 $(make-target-directory
)
298 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
301 -include $(objpfx
)errlist-data-aux.S.d
$(objpfx
)errlist-data-aux-shared.S.d
304 $(objpfx
)errlist-data.os
: $(objpfx
)errlist-data-aux-shared.S
305 $(addprefix $(objpfx
)errlist-data
, $(object-suffixes-noshared
)): \
306 $(objpfx
)errlist-data-aux.S
308 $(objpfx
)siglist-aux-shared.S
: siglist-gen.c
309 $(make-target-directory
)
310 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
312 $(objpfx
)siglist-aux.S
: siglist-gen.c
313 $(make-target-directory
)
314 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
317 -include $(objpfx
)siglist-aux.S.d
$(objpfx
)siglist-aux-shared.S.d
320 $(objpfx
)siglist.os
: $(objpfx
)siglist-aux-shared.S
321 $(addprefix $(objpfx
)siglist
, $(object-suffixes-noshared
)): \
322 $(objpfx
)siglist-aux.S
324 ifeq ($(run-built-tests
),yes
)
334 include ..
/gen-locales.mk
336 $(objpfx
)bug14.out
: $(gen-locales
)
337 $(objpfx
)scanf13.out
: $(gen-locales
)
338 $(objpfx
)test-vfprintf.out
: $(gen-locales
)
339 $(objpfx
)tst-grouping.out
: $(gen-locales
)
340 $(objpfx
)tst-grouping2.out
: $(gen-locales
)
341 $(objpfx
)tst-grouping_iterator.out
: $(gen-locales
)
342 $(objpfx
)tst-sprintf.out
: $(gen-locales
)
343 $(objpfx
)tst-sscanf.out
: $(gen-locales
)
344 $(objpfx
)tst-swprintf.out
: $(gen-locales
)
345 $(objpfx
)tst-vfprintf-mbs-prec.out
: $(gen-locales
)
346 $(objpfx
)tst-vfprintf-width-i18n.out
: $(gen-locales
)
347 $(objpfx
)tst-grouping3.out
: $(gen-locales
)
350 tst-printf-bz18872-ENV
= MALLOC_TRACE
=$(objpfx
)tst-printf-bz18872.mtrace \
351 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
352 tst-vfprintf-width-prec-ENV
= \
353 MALLOC_TRACE
=$(objpfx
)tst-vfprintf-width-prec.mtrace \
354 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
355 tst-printf-bz25691-ENV
= \
356 MALLOC_TRACE
=$(objpfx
)tst-printf-bz25691.mtrace \
357 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
358 tst-printf-fp-free-ENV
= \
359 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-free.mtrace \
360 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
361 tst-printf-fp-leak-ENV
= \
362 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-leak.mtrace \
363 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
365 $(objpfx
)tst-unbputc.out
: tst-unbputc.sh
$(objpfx
)tst-unbputc
366 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
369 $(objpfx
)tst-printf.out
: tst-printf.sh
$(objpfx
)tst-printf
370 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
373 $(objpfx
)tst-printfsz-islongdouble.out
: \
374 tst-printfsz-islongdouble.sh
$(objpfx
)tst-printfsz-islongdouble
375 $(SHELL
) $^
'$(test-program-prefix)' $@
; \
378 # We generate this source because it requires a printf invocation with
380 $(objpfx
)tst-printf-bz18872.c
: tst-printf-bz18872.sh
381 rm -f
$@
&& $(BASH
) $^
> $@.new
&& mv
$@.new
$@
383 $(objpfx
)tst-
%-mem.out
: $(objpfx
)tst-
%.out
384 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-
$*.mtrace
> $@
; \
387 errlist-h
= $(firstword $(wildcard $(addsuffix /errlist.h
,$(sysdirs
) .
)))
389 $(objpfx
)tst-errno-manual.out
: tst-errno-manual.py \
391 $(..
)manual
/errno.texi
392 $(PYTHON
) tst-errno-manual.py
-m
$(..
)manual
/errno.texi \
393 -e
$(errlist-h
) > $@
; \
396 CFLAGS-vfprintf.c
+= -Wno-uninitialized
397 CFLAGS-vfwprintf.c
+= -Wno-uninitialized
399 CFLAGS-tmpfile.c
+= -fexceptions
400 CFLAGS-tmpfile64.c
+= -fexceptions
401 CFLAGS-tempname.c
+= -fexceptions
402 CFLAGS-psignal.c
+= -fexceptions
403 CFLAGS-vprintf.c
+= -fexceptions
404 CFLAGS-cuserid.c
+= -fexceptions
406 CFLAGS-vfprintf.c
+= -fexceptions
407 CFLAGS-fprintf.c
+= -fexceptions
408 CFLAGS-printf.c
+= -fexceptions
409 CFLAGS-vfwprintf.c
+= -fexceptions
410 CFLAGS-vfscanf.c
+= -fexceptions
411 CFLAGS-vfwscanf.c
+= -fexceptions
412 CFLAGS-fscanf.c
+= -fexceptions
413 CFLAGS-scanf.c
+= -fexceptions
414 CFLAGS-isoc99_vfscanf.c
+= -fexceptions
415 CFLAGS-isoc99_vscanf.c
+= -fexceptions
416 CFLAGS-isoc99_fscanf.c
+= -fexceptions
417 CFLAGS-isoc99_scanf.c
+= -fexceptions
419 CFLAGS-dprintf.c
+= $(config-cflags-wno-ignored-attributes
)
421 # scanf14a.c and scanf16a.c test a deprecated extension which is no
422 # longer visible under most conformance levels; see the source files
424 CFLAGS-scanf14a.c
+= -std
=gnu89
425 CFLAGS-scanf16a.c
+= -std
=gnu89
427 CFLAGS-bug3.c
+= -DOBJPFX
=\"$(objpfx
)\"
428 CFLAGS-bug4.c
+= -DOBJPFX
=\"$(objpfx
)\"
429 CFLAGS-bug5.c
+= -DOBJPFX
=\"$(objpfx
)\"
430 CFLAGS-test-fseek.c
+= -DOBJPFX
=\"$(objpfx
)\"
431 CFLAGS-test-popen.c
+= -DOBJPFX
=\"$(objpfx
)\"
432 CFLAGS-test_rdwr.c
+= -DOBJPFX
=\"$(objpfx
)\"
434 # tst-gets.c tests a deprecated function.
435 CFLAGS-tst-gets.c
+= -Wno-deprecated-declarations
437 # BZ #11319 was first fixed for regular vdprintf, then reopened because
438 # the fortified version had the same bug.
439 CFLAGS-tst-bz11319-fortify2.c
+= -D_FORTIFY_SOURCE
=2
441 CFLAGS-tst-memstream-string.c
+= -fno-builtin-fprintf
443 CPPFLAGS
+= $(libio-mtsafe
)
445 $(objpfx
)tst-setvbuf1.out
: /dev
/null
$(objpfx
)tst-setvbuf1
446 $(test-program-cmd
) > $@
2>&1; \
449 $(objpfx
)tst-setvbuf1-cmp.out
: tst-setvbuf1.expect
$(objpfx
)tst-setvbuf1.out
453 $(objpfx
)tst-printf-round
: $(libm
)
454 $(objpfx
)tst-scanf-round
: $(libm
)