1 # Copyright (C) 1991-2022 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 \
96 wprintf_buffer_as_file \
98 wprintf_buffer_flush \
99 wprintf_buffer_pad_1 \
100 wprintf_buffer_putc_1 \
101 wprintf_buffer_puts_1 \
102 wprintf_buffer_to_file \
103 wprintf_buffer_write \
178 tst-bz11319-fortify2 \
196 tst-memstream-string \
223 tst-vfprintf-mbs-prec \
224 tst-vfprintf-user-type \
225 tst-vfprintf-width-prec \
226 tst-vfprintf-width-prec-alloc \
227 tst-vfprintf-width-i18n \
236 errlist-data-aux-shared.S \
238 siglist-aux-shared.S \
243 tst-grouping_iterator \
246 test-srcs
= tst-unbputc tst-printf tst-printfsz-islongdouble
248 ifeq ($(run-built-tests
),yes
)
250 $(objpfx
)tst-printf-bz18872-mem.out \
251 $(objpfx
)tst-printf-bz25691-mem.out \
252 $(objpfx
)tst-printf-fp-free-mem.out \
253 $(objpfx
)tst-printf-fp-leak-mem.out \
254 $(objpfx
)tst-printf.out \
255 $(objpfx
)tst-printfsz-islongdouble.out \
256 $(objpfx
)tst-setvbuf1-cmp.out \
257 $(objpfx
)tst-unbputc.out \
258 $(objpfx
)tst-vfprintf-width-prec-mem.out \
262 tst-printf-bz18872-mem.out \
263 tst-printf-bz18872.c \
264 tst-printf-bz18872.mtrace \
265 tst-printf-bz25691-mem.out \
266 tst-printf-bz25691.mtrace \
267 tst-printf-fp-free-mem.out \
268 tst-printf-fp-free.mtrace \
269 tst-printf-fp-leak-mem.out \
270 tst-printf-fp-leak.mtrace \
271 tst-vfprintf-width-prec-mem.out \
272 tst-vfprintf-width-prec.mtrace \
274 endif # $(run-built-tests)
276 tests-special
+= $(objpfx
)tst-errno-manual.out
280 # The errlist.c is built in two phases because compiler might reorder the
281 # compat_symbol directive prior the object itself and on binutils older
282 # than 2.29 it might generate object sizes different than the expected ones.
283 $(objpfx
)errlist-data-aux-shared.S
: errlist-data-gen.c
284 $(make-target-directory
)
285 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
287 $(objpfx
)errlist-data-aux.S
: errlist-data-gen.c
288 $(make-target-directory
)
289 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
292 -include $(objpfx
)errlist-data-aux.S.d
$(objpfx
)errlist-data-aux-shared.S.d
295 $(objpfx
)errlist-data.os
: $(objpfx
)errlist-data-aux-shared.S
296 $(addprefix $(objpfx
)errlist-data
, $(object-suffixes-noshared
)): \
297 $(objpfx
)errlist-data-aux.S
299 $(objpfx
)siglist-aux-shared.S
: siglist-gen.c
300 $(make-target-directory
)
301 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
303 $(objpfx
)siglist-aux.S
: siglist-gen.c
304 $(make-target-directory
)
305 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
308 -include $(objpfx
)siglist-aux.S.d
$(objpfx
)siglist-aux-shared.S.d
311 $(objpfx
)siglist.os
: $(objpfx
)siglist-aux-shared.S
312 $(addprefix $(objpfx
)siglist
, $(object-suffixes-noshared
)): \
313 $(objpfx
)siglist-aux.S
315 ifeq ($(run-built-tests
),yes
)
325 include ..
/gen-locales.mk
327 $(objpfx
)bug14.out
: $(gen-locales
)
328 $(objpfx
)scanf13.out
: $(gen-locales
)
329 $(objpfx
)test-vfprintf.out
: $(gen-locales
)
330 $(objpfx
)tst-grouping.out
: $(gen-locales
)
331 $(objpfx
)tst-grouping2.out
: $(gen-locales
)
332 $(objpfx
)tst-grouping_iterator.out
: $(gen-locales
)
333 $(objpfx
)tst-sprintf.out
: $(gen-locales
)
334 $(objpfx
)tst-sscanf.out
: $(gen-locales
)
335 $(objpfx
)tst-swprintf.out
: $(gen-locales
)
336 $(objpfx
)tst-vfprintf-mbs-prec.out
: $(gen-locales
)
337 $(objpfx
)tst-vfprintf-width-i18n.out
: $(gen-locales
)
340 tst-printf-bz18872-ENV
= MALLOC_TRACE
=$(objpfx
)tst-printf-bz18872.mtrace \
341 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
342 tst-vfprintf-width-prec-ENV
= \
343 MALLOC_TRACE
=$(objpfx
)tst-vfprintf-width-prec.mtrace \
344 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
345 tst-printf-bz25691-ENV
= \
346 MALLOC_TRACE
=$(objpfx
)tst-printf-bz25691.mtrace \
347 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
348 tst-printf-fp-free-ENV
= \
349 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-free.mtrace \
350 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
351 tst-printf-fp-leak-ENV
= \
352 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-leak.mtrace \
353 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
355 $(objpfx
)tst-unbputc.out
: tst-unbputc.sh
$(objpfx
)tst-unbputc
356 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
359 $(objpfx
)tst-printf.out
: tst-printf.sh
$(objpfx
)tst-printf
360 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
363 $(objpfx
)tst-printfsz-islongdouble.out
: \
364 tst-printfsz-islongdouble.sh
$(objpfx
)tst-printfsz-islongdouble
365 $(SHELL
) $^
'$(test-program-prefix)' $@
; \
368 # We generate this source because it requires a printf invocation with
370 $(objpfx
)tst-printf-bz18872.c
: tst-printf-bz18872.sh
371 rm -f
$@
&& $(BASH
) $^
> $@.new
&& mv
$@.new
$@
373 $(objpfx
)tst-
%-mem.out
: $(objpfx
)tst-
%.out
374 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-
$*.mtrace
> $@
; \
377 errlist-h
= $(firstword $(wildcard $(addsuffix /errlist.h
,$(sysdirs
) .
)))
379 $(objpfx
)tst-errno-manual.out
: tst-errno-manual.py \
381 $(..
)manual
/errno.texi
382 $(PYTHON
) tst-errno-manual.py
-m
$(..
)manual
/errno.texi \
383 -e
$(errlist-h
) > $@
; \
386 CFLAGS-vfprintf.c
+= -Wno-uninitialized
387 CFLAGS-vfwprintf.c
+= -Wno-uninitialized
389 CFLAGS-tmpfile.c
+= -fexceptions
390 CFLAGS-tmpfile64.c
+= -fexceptions
391 CFLAGS-tempname.c
+= -fexceptions
392 CFLAGS-psignal.c
+= -fexceptions
393 CFLAGS-vprintf.c
+= -fexceptions
394 CFLAGS-cuserid.c
+= -fexceptions
396 CFLAGS-vfprintf.c
+= -fexceptions
397 CFLAGS-fprintf.c
+= -fexceptions
398 CFLAGS-printf.c
+= -fexceptions
399 CFLAGS-vfwprintf.c
+= -fexceptions
400 CFLAGS-vfscanf.c
+= -fexceptions
401 CFLAGS-vfwscanf.c
+= -fexceptions
402 CFLAGS-fscanf.c
+= -fexceptions
403 CFLAGS-scanf.c
+= -fexceptions
404 CFLAGS-isoc99_vfscanf.c
+= -fexceptions
405 CFLAGS-isoc99_vscanf.c
+= -fexceptions
406 CFLAGS-isoc99_fscanf.c
+= -fexceptions
407 CFLAGS-isoc99_scanf.c
+= -fexceptions
409 CFLAGS-dprintf.c
+= $(config-cflags-wno-ignored-attributes
)
411 # scanf14a.c and scanf16a.c test a deprecated extension which is no
412 # longer visible under most conformance levels; see the source files
414 CFLAGS-scanf14a.c
+= -std
=gnu89
415 CFLAGS-scanf16a.c
+= -std
=gnu89
417 CFLAGS-bug3.c
+= -DOBJPFX
=\"$(objpfx
)\"
418 CFLAGS-bug4.c
+= -DOBJPFX
=\"$(objpfx
)\"
419 CFLAGS-bug5.c
+= -DOBJPFX
=\"$(objpfx
)\"
420 CFLAGS-test-fseek.c
+= -DOBJPFX
=\"$(objpfx
)\"
421 CFLAGS-test-popen.c
+= -DOBJPFX
=\"$(objpfx
)\"
422 CFLAGS-test_rdwr.c
+= -DOBJPFX
=\"$(objpfx
)\"
424 # tst-gets.c tests a deprecated function.
425 CFLAGS-tst-gets.c
+= -Wno-deprecated-declarations
427 # BZ #11319 was first fixed for regular vdprintf, then reopened because
428 # the fortified version had the same bug.
429 CFLAGS-tst-bz11319-fortify2.c
+= -D_FORTIFY_SOURCE
=2
431 CFLAGS-tst-memstream-string.c
+= -fno-builtin-fprintf
433 CPPFLAGS
+= $(libio-mtsafe
)
435 $(objpfx
)tst-setvbuf1.out
: /dev
/null
$(objpfx
)tst-setvbuf1
436 $(test-program-cmd
) > $@
2>&1; \
439 $(objpfx
)tst-setvbuf1-cmp.out
: tst-setvbuf1.expect
$(objpfx
)tst-setvbuf1.out
443 $(objpfx
)tst-printf-round
: $(libm
)
444 $(objpfx
)tst-scanf-round
: $(libm
)