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
161 tst-bz11319-fortify2 \
178 tst-memstream-string \
205 tst-vfprintf-mbs-prec \
206 tst-vfprintf-user-type \
207 tst-vfprintf-width-prec \
208 tst-vfprintf-width-prec-alloc \
209 tst-vfprintf-width-i18n \
218 errlist-data-aux-shared.S \
220 siglist-aux-shared.S \
224 test-srcs
= tst-unbputc tst-printf tst-printfsz-islongdouble
226 ifeq ($(run-built-tests
),yes
)
228 $(objpfx
)tst-printf-bz18872-mem.out \
229 $(objpfx
)tst-printf-bz25691-mem.out \
230 $(objpfx
)tst-printf-fp-free-mem.out \
231 $(objpfx
)tst-printf-fp-leak-mem.out \
232 $(objpfx
)tst-printf.out \
233 $(objpfx
)tst-printfsz-islongdouble.out \
234 $(objpfx
)tst-setvbuf1-cmp.out \
235 $(objpfx
)tst-unbputc.out \
236 $(objpfx
)tst-vfprintf-width-prec-mem.out \
240 tst-printf-bz18872-mem.out \
241 tst-printf-bz18872.c \
242 tst-printf-bz18872.mtrace \
243 tst-printf-bz25691-mem.out \
244 tst-printf-bz25691.mtrace \
245 tst-printf-fp-free-mem.out \
246 tst-printf-fp-free.mtrace \
247 tst-printf-fp-leak-mem.out \
248 tst-printf-fp-leak.mtrace \
249 tst-vfprintf-width-prec-mem.out \
250 tst-vfprintf-width-prec.mtrace \
252 endif # $(run-built-tests)
254 tests-special
+= $(objpfx
)tst-errno-manual.out
258 # The errlist.c is built in two phases because compiler might reorder the
259 # compat_symbol directive prior the object itself and on binutils older
260 # than 2.29 it might generate object sizes different than the expected ones.
261 $(objpfx
)errlist-data-aux-shared.S
: errlist-data-gen.c
262 $(make-target-directory
)
263 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
265 $(objpfx
)errlist-data-aux.S
: errlist-data-gen.c
266 $(make-target-directory
)
267 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
269 $(objpfx
)errlist-data.os
: $(objpfx
)errlist-data-aux-shared.S
270 $(objpfx
)errlist-data.o
: $(objpfx
)errlist-data-aux.S
272 $(objpfx
)siglist-aux-shared.S
: siglist-gen.c
273 $(make-target-directory
)
274 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
276 $(objpfx
)siglist-aux.S
: siglist-gen.c
277 $(make-target-directory
)
278 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
280 $(objpfx
)siglist.os
: $(objpfx
)siglist-aux-shared.S
281 $(objpfx
)siglist.o
: $(objpfx
)siglist-aux.S
283 ifeq ($(run-built-tests
),yes
)
292 include ..
/gen-locales.mk
294 $(objpfx
)bug14.out
: $(gen-locales
)
295 $(objpfx
)scanf13.out
: $(gen-locales
)
296 $(objpfx
)test-vfprintf.out
: $(gen-locales
)
297 $(objpfx
)tst-grouping.out
: $(gen-locales
)
298 $(objpfx
)tst-sprintf.out
: $(gen-locales
)
299 $(objpfx
)tst-sscanf.out
: $(gen-locales
)
300 $(objpfx
)tst-swprintf.out
: $(gen-locales
)
301 $(objpfx
)tst-vfprintf-mbs-prec.out
: $(gen-locales
)
302 $(objpfx
)tst-vfprintf-width-i18n.out
: $(gen-locales
)
305 tst-printf-bz18872-ENV
= MALLOC_TRACE
=$(objpfx
)tst-printf-bz18872.mtrace \
306 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
307 tst-vfprintf-width-prec-ENV
= \
308 MALLOC_TRACE
=$(objpfx
)tst-vfprintf-width-prec.mtrace \
309 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
310 tst-printf-bz25691-ENV
= \
311 MALLOC_TRACE
=$(objpfx
)tst-printf-bz25691.mtrace \
312 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
313 tst-printf-fp-free-ENV
= \
314 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-free.mtrace \
315 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
316 tst-printf-fp-leak-ENV
= \
317 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-leak.mtrace \
318 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
320 $(objpfx
)tst-unbputc.out
: tst-unbputc.sh
$(objpfx
)tst-unbputc
321 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
324 $(objpfx
)tst-printf.out
: tst-printf.sh
$(objpfx
)tst-printf
325 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
328 $(objpfx
)tst-printfsz-islongdouble.out
: \
329 tst-printfsz-islongdouble.sh
$(objpfx
)tst-printfsz-islongdouble
330 $(SHELL
) $^
'$(test-program-prefix)' $@
; \
333 # We generate this source because it requires a printf invocation with
335 $(objpfx
)tst-printf-bz18872.c
: tst-printf-bz18872.sh
336 rm -f
$@
&& $(BASH
) $^
> $@.new
&& mv
$@.new
$@
338 $(objpfx
)tst-
%-mem.out
: $(objpfx
)tst-
%.out
339 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-
$*.mtrace
> $@
; \
342 errlist-h
= $(firstword $(wildcard $(addsuffix /errlist.h
,$(sysdirs
) .
)))
344 $(objpfx
)tst-errno-manual.out
: tst-errno-manual.py \
346 $(..
)manual
/errno.texi
347 $(PYTHON
) tst-errno-manual.py
-m
$(..
)manual
/errno.texi \
348 -e
$(errlist-h
) > $@
; \
351 CFLAGS-vfprintf.c
+= -Wno-uninitialized
352 CFLAGS-vfwprintf.c
+= -Wno-uninitialized
354 CFLAGS-tmpfile.c
+= -fexceptions
355 CFLAGS-tmpfile64.c
+= -fexceptions
356 CFLAGS-tempname.c
+= -fexceptions
357 CFLAGS-psignal.c
+= -fexceptions
358 CFLAGS-vprintf.c
+= -fexceptions
359 CFLAGS-cuserid.c
+= -fexceptions
361 CFLAGS-vfprintf.c
+= -fexceptions
362 CFLAGS-fprintf.c
+= -fexceptions
363 CFLAGS-printf.c
+= -fexceptions
364 CFLAGS-vfwprintf.c
+= -fexceptions
365 CFLAGS-vfscanf.c
+= -fexceptions
366 CFLAGS-vfwscanf.c
+= -fexceptions
367 CFLAGS-fscanf.c
+= -fexceptions
368 CFLAGS-scanf.c
+= -fexceptions
369 CFLAGS-isoc99_vfscanf.c
+= -fexceptions
370 CFLAGS-isoc99_vscanf.c
+= -fexceptions
371 CFLAGS-isoc99_fscanf.c
+= -fexceptions
372 CFLAGS-isoc99_scanf.c
+= -fexceptions
374 # scanf14a.c and scanf16a.c test a deprecated extension which is no
375 # longer visible under most conformance levels; see the source files
377 CFLAGS-scanf14a.c
+= -std
=gnu89
378 CFLAGS-scanf16a.c
+= -std
=gnu89
380 CFLAGS-bug3.c
+= -DOBJPFX
=\"$(objpfx
)\"
381 CFLAGS-bug4.c
+= -DOBJPFX
=\"$(objpfx
)\"
382 CFLAGS-bug5.c
+= -DOBJPFX
=\"$(objpfx
)\"
383 CFLAGS-test-fseek.c
+= -DOBJPFX
=\"$(objpfx
)\"
384 CFLAGS-test-popen.c
+= -DOBJPFX
=\"$(objpfx
)\"
385 CFLAGS-test_rdwr.c
+= -DOBJPFX
=\"$(objpfx
)\"
387 # tst-gets.c tests a deprecated function.
388 CFLAGS-tst-gets.c
+= -Wno-deprecated-declarations
390 # BZ #11319 was first fixed for regular vdprintf, then reopened because
391 # the fortified version had the same bug.
392 CFLAGS-tst-bz11319-fortify2.c
+= -D_FORTIFY_SOURCE
=2
394 CFLAGS-tst-memstream-string.c
+= -fno-builtin-fprintf
396 CPPFLAGS
+= $(libio-mtsafe
)
398 $(objpfx
)tst-setvbuf1.out
: /dev
/null
$(objpfx
)tst-setvbuf1
399 $(test-program-cmd
) > $@
2>&1; \
402 $(objpfx
)tst-setvbuf1-cmp.out
: tst-setvbuf1.expect
$(objpfx
)tst-setvbuf1.out
406 $(objpfx
)tst-printf-round
: $(libm
)
407 $(objpfx
)tst-scanf-round
: $(libm
)