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 \
199 tst-memstream-string \
226 tst-vfprintf-mbs-prec \
227 tst-vfprintf-user-type \
228 tst-vfprintf-width-prec \
229 tst-vfprintf-width-prec-alloc \
230 tst-vfprintf-width-i18n \
239 errlist-data-aux-shared.S \
241 siglist-aux-shared.S \
246 tst-grouping_iterator \
249 test-srcs
= tst-unbputc tst-printf tst-printfsz-islongdouble
251 ifeq ($(run-built-tests
),yes
)
253 $(objpfx
)tst-printf-bz18872-mem.out \
254 $(objpfx
)tst-printf-bz25691-mem.out \
255 $(objpfx
)tst-printf-fp-free-mem.out \
256 $(objpfx
)tst-printf-fp-leak-mem.out \
257 $(objpfx
)tst-printf.out \
258 $(objpfx
)tst-printfsz-islongdouble.out \
259 $(objpfx
)tst-setvbuf1-cmp.out \
260 $(objpfx
)tst-unbputc.out \
261 $(objpfx
)tst-vfprintf-width-prec-mem.out \
265 tst-printf-bz18872-mem.out \
266 tst-printf-bz18872.c \
267 tst-printf-bz18872.mtrace \
268 tst-printf-bz25691-mem.out \
269 tst-printf-bz25691.mtrace \
270 tst-printf-fp-free-mem.out \
271 tst-printf-fp-free.mtrace \
272 tst-printf-fp-leak-mem.out \
273 tst-printf-fp-leak.mtrace \
274 tst-vfprintf-width-prec-mem.out \
275 tst-vfprintf-width-prec.mtrace \
277 endif # $(run-built-tests)
279 tests-special
+= $(objpfx
)tst-errno-manual.out
283 # The errlist.c is built in two phases because compiler might reorder the
284 # compat_symbol directive prior the object itself and on binutils older
285 # than 2.29 it might generate object sizes different than the expected ones.
286 $(objpfx
)errlist-data-aux-shared.S
: errlist-data-gen.c
287 $(make-target-directory
)
288 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
290 $(objpfx
)errlist-data-aux.S
: errlist-data-gen.c
291 $(make-target-directory
)
292 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
295 -include $(objpfx
)errlist-data-aux.S.d
$(objpfx
)errlist-data-aux-shared.S.d
298 $(objpfx
)errlist-data.os
: $(objpfx
)errlist-data-aux-shared.S
299 $(addprefix $(objpfx
)errlist-data
, $(object-suffixes-noshared
)): \
300 $(objpfx
)errlist-data-aux.S
302 $(objpfx
)siglist-aux-shared.S
: siglist-gen.c
303 $(make-target-directory
)
304 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
306 $(objpfx
)siglist-aux.S
: siglist-gen.c
307 $(make-target-directory
)
308 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
311 -include $(objpfx
)siglist-aux.S.d
$(objpfx
)siglist-aux-shared.S.d
314 $(objpfx
)siglist.os
: $(objpfx
)siglist-aux-shared.S
315 $(addprefix $(objpfx
)siglist
, $(object-suffixes-noshared
)): \
316 $(objpfx
)siglist-aux.S
318 ifeq ($(run-built-tests
),yes
)
328 include ..
/gen-locales.mk
330 $(objpfx
)bug14.out
: $(gen-locales
)
331 $(objpfx
)scanf13.out
: $(gen-locales
)
332 $(objpfx
)test-vfprintf.out
: $(gen-locales
)
333 $(objpfx
)tst-grouping.out
: $(gen-locales
)
334 $(objpfx
)tst-grouping2.out
: $(gen-locales
)
335 $(objpfx
)tst-grouping_iterator.out
: $(gen-locales
)
336 $(objpfx
)tst-sprintf.out
: $(gen-locales
)
337 $(objpfx
)tst-sscanf.out
: $(gen-locales
)
338 $(objpfx
)tst-swprintf.out
: $(gen-locales
)
339 $(objpfx
)tst-vfprintf-mbs-prec.out
: $(gen-locales
)
340 $(objpfx
)tst-vfprintf-width-i18n.out
: $(gen-locales
)
343 tst-printf-bz18872-ENV
= MALLOC_TRACE
=$(objpfx
)tst-printf-bz18872.mtrace \
344 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
345 tst-vfprintf-width-prec-ENV
= \
346 MALLOC_TRACE
=$(objpfx
)tst-vfprintf-width-prec.mtrace \
347 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
348 tst-printf-bz25691-ENV
= \
349 MALLOC_TRACE
=$(objpfx
)tst-printf-bz25691.mtrace \
350 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
351 tst-printf-fp-free-ENV
= \
352 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-free.mtrace \
353 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
354 tst-printf-fp-leak-ENV
= \
355 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-leak.mtrace \
356 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
358 $(objpfx
)tst-unbputc.out
: tst-unbputc.sh
$(objpfx
)tst-unbputc
359 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
362 $(objpfx
)tst-printf.out
: tst-printf.sh
$(objpfx
)tst-printf
363 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
366 $(objpfx
)tst-printfsz-islongdouble.out
: \
367 tst-printfsz-islongdouble.sh
$(objpfx
)tst-printfsz-islongdouble
368 $(SHELL
) $^
'$(test-program-prefix)' $@
; \
371 # We generate this source because it requires a printf invocation with
373 $(objpfx
)tst-printf-bz18872.c
: tst-printf-bz18872.sh
374 rm -f
$@
&& $(BASH
) $^
> $@.new
&& mv
$@.new
$@
376 $(objpfx
)tst-
%-mem.out
: $(objpfx
)tst-
%.out
377 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-
$*.mtrace
> $@
; \
380 errlist-h
= $(firstword $(wildcard $(addsuffix /errlist.h
,$(sysdirs
) .
)))
382 $(objpfx
)tst-errno-manual.out
: tst-errno-manual.py \
384 $(..
)manual
/errno.texi
385 $(PYTHON
) tst-errno-manual.py
-m
$(..
)manual
/errno.texi \
386 -e
$(errlist-h
) > $@
; \
389 CFLAGS-vfprintf.c
+= -Wno-uninitialized
390 CFLAGS-vfwprintf.c
+= -Wno-uninitialized
392 CFLAGS-tmpfile.c
+= -fexceptions
393 CFLAGS-tmpfile64.c
+= -fexceptions
394 CFLAGS-tempname.c
+= -fexceptions
395 CFLAGS-psignal.c
+= -fexceptions
396 CFLAGS-vprintf.c
+= -fexceptions
397 CFLAGS-cuserid.c
+= -fexceptions
399 CFLAGS-vfprintf.c
+= -fexceptions
400 CFLAGS-fprintf.c
+= -fexceptions
401 CFLAGS-printf.c
+= -fexceptions
402 CFLAGS-vfwprintf.c
+= -fexceptions
403 CFLAGS-vfscanf.c
+= -fexceptions
404 CFLAGS-vfwscanf.c
+= -fexceptions
405 CFLAGS-fscanf.c
+= -fexceptions
406 CFLAGS-scanf.c
+= -fexceptions
407 CFLAGS-isoc99_vfscanf.c
+= -fexceptions
408 CFLAGS-isoc99_vscanf.c
+= -fexceptions
409 CFLAGS-isoc99_fscanf.c
+= -fexceptions
410 CFLAGS-isoc99_scanf.c
+= -fexceptions
412 CFLAGS-dprintf.c
+= $(config-cflags-wno-ignored-attributes
)
414 # scanf14a.c and scanf16a.c test a deprecated extension which is no
415 # longer visible under most conformance levels; see the source files
417 CFLAGS-scanf14a.c
+= -std
=gnu89
418 CFLAGS-scanf16a.c
+= -std
=gnu89
420 CFLAGS-bug3.c
+= -DOBJPFX
=\"$(objpfx
)\"
421 CFLAGS-bug4.c
+= -DOBJPFX
=\"$(objpfx
)\"
422 CFLAGS-bug5.c
+= -DOBJPFX
=\"$(objpfx
)\"
423 CFLAGS-test-fseek.c
+= -DOBJPFX
=\"$(objpfx
)\"
424 CFLAGS-test-popen.c
+= -DOBJPFX
=\"$(objpfx
)\"
425 CFLAGS-test_rdwr.c
+= -DOBJPFX
=\"$(objpfx
)\"
427 # tst-gets.c tests a deprecated function.
428 CFLAGS-tst-gets.c
+= -Wno-deprecated-declarations
430 # BZ #11319 was first fixed for regular vdprintf, then reopened because
431 # the fortified version had the same bug.
432 CFLAGS-tst-bz11319-fortify2.c
+= -D_FORTIFY_SOURCE
=2
434 CFLAGS-tst-memstream-string.c
+= -fno-builtin-fprintf
436 CPPFLAGS
+= $(libio-mtsafe
)
438 $(objpfx
)tst-setvbuf1.out
: /dev
/null
$(objpfx
)tst-setvbuf1
439 $(test-program-cmd
) > $@
2>&1; \
442 $(objpfx
)tst-setvbuf1-cmp.out
: tst-setvbuf1.expect
$(objpfx
)tst-setvbuf1.out
446 $(objpfx
)tst-printf-round
: $(libm
)
447 $(objpfx
)tst-scanf-round
: $(libm
)