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 \
179 tst-memstream-string \
206 tst-vfprintf-mbs-prec \
207 tst-vfprintf-user-type \
208 tst-vfprintf-width-prec \
209 tst-vfprintf-width-prec-alloc \
210 tst-vfprintf-width-i18n \
219 errlist-data-aux-shared.S \
221 siglist-aux-shared.S \
225 test-srcs
= tst-unbputc tst-printf tst-printfsz-islongdouble
227 ifeq ($(run-built-tests
),yes
)
229 $(objpfx
)tst-printf-bz18872-mem.out \
230 $(objpfx
)tst-printf-bz25691-mem.out \
231 $(objpfx
)tst-printf-fp-free-mem.out \
232 $(objpfx
)tst-printf-fp-leak-mem.out \
233 $(objpfx
)tst-printf.out \
234 $(objpfx
)tst-printfsz-islongdouble.out \
235 $(objpfx
)tst-setvbuf1-cmp.out \
236 $(objpfx
)tst-unbputc.out \
237 $(objpfx
)tst-vfprintf-width-prec-mem.out \
241 tst-printf-bz18872-mem.out \
242 tst-printf-bz18872.c \
243 tst-printf-bz18872.mtrace \
244 tst-printf-bz25691-mem.out \
245 tst-printf-bz25691.mtrace \
246 tst-printf-fp-free-mem.out \
247 tst-printf-fp-free.mtrace \
248 tst-printf-fp-leak-mem.out \
249 tst-printf-fp-leak.mtrace \
250 tst-vfprintf-width-prec-mem.out \
251 tst-vfprintf-width-prec.mtrace \
253 endif # $(run-built-tests)
255 tests-special
+= $(objpfx
)tst-errno-manual.out
259 # The errlist.c is built in two phases because compiler might reorder the
260 # compat_symbol directive prior the object itself and on binutils older
261 # than 2.29 it might generate object sizes different than the expected ones.
262 $(objpfx
)errlist-data-aux-shared.S
: errlist-data-gen.c
263 $(make-target-directory
)
264 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
266 $(objpfx
)errlist-data-aux.S
: errlist-data-gen.c
267 $(make-target-directory
)
268 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
271 -include $(objpfx
)errlist-data-aux.S.d
$(objpfx
)errlist-data-aux-shared.S.d
274 $(objpfx
)errlist-data.os
: $(objpfx
)errlist-data-aux-shared.S
275 $(objpfx
)errlist-data.o
: $(objpfx
)errlist-data-aux.S
277 $(objpfx
)siglist-aux-shared.S
: siglist-gen.c
278 $(make-target-directory
)
279 $(compile-command.c
) $(pic-cppflags
) $(pic-ccflag
) $(no-stack-protector
) -S
281 $(objpfx
)siglist-aux.S
: siglist-gen.c
282 $(make-target-directory
)
283 $(compile-command.c
) $(pie-default
) $(no-stack-protector
) -S
286 -include $(objpfx
)siglist-aux.S.d
$(objpfx
)siglist-aux-shared.S.d
289 $(objpfx
)siglist.os
: $(objpfx
)siglist-aux-shared.S
290 $(objpfx
)siglist.o
: $(objpfx
)siglist-aux.S
292 ifeq ($(run-built-tests
),yes
)
301 include ..
/gen-locales.mk
303 $(objpfx
)bug14.out
: $(gen-locales
)
304 $(objpfx
)scanf13.out
: $(gen-locales
)
305 $(objpfx
)test-vfprintf.out
: $(gen-locales
)
306 $(objpfx
)tst-grouping.out
: $(gen-locales
)
307 $(objpfx
)tst-grouping2.out
: $(gen-locales
)
308 $(objpfx
)tst-sprintf.out
: $(gen-locales
)
309 $(objpfx
)tst-sscanf.out
: $(gen-locales
)
310 $(objpfx
)tst-swprintf.out
: $(gen-locales
)
311 $(objpfx
)tst-vfprintf-mbs-prec.out
: $(gen-locales
)
312 $(objpfx
)tst-vfprintf-width-i18n.out
: $(gen-locales
)
315 tst-printf-bz18872-ENV
= MALLOC_TRACE
=$(objpfx
)tst-printf-bz18872.mtrace \
316 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
317 tst-vfprintf-width-prec-ENV
= \
318 MALLOC_TRACE
=$(objpfx
)tst-vfprintf-width-prec.mtrace \
319 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
320 tst-printf-bz25691-ENV
= \
321 MALLOC_TRACE
=$(objpfx
)tst-printf-bz25691.mtrace \
322 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
323 tst-printf-fp-free-ENV
= \
324 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-free.mtrace \
325 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
326 tst-printf-fp-leak-ENV
= \
327 MALLOC_TRACE
=$(objpfx
)tst-printf-fp-leak.mtrace \
328 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
330 $(objpfx
)tst-unbputc.out
: tst-unbputc.sh
$(objpfx
)tst-unbputc
331 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
334 $(objpfx
)tst-printf.out
: tst-printf.sh
$(objpfx
)tst-printf
335 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)'; \
338 $(objpfx
)tst-printfsz-islongdouble.out
: \
339 tst-printfsz-islongdouble.sh
$(objpfx
)tst-printfsz-islongdouble
340 $(SHELL
) $^
'$(test-program-prefix)' $@
; \
343 # We generate this source because it requires a printf invocation with
345 $(objpfx
)tst-printf-bz18872.c
: tst-printf-bz18872.sh
346 rm -f
$@
&& $(BASH
) $^
> $@.new
&& mv
$@.new
$@
348 $(objpfx
)tst-
%-mem.out
: $(objpfx
)tst-
%.out
349 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-
$*.mtrace
> $@
; \
352 errlist-h
= $(firstword $(wildcard $(addsuffix /errlist.h
,$(sysdirs
) .
)))
354 $(objpfx
)tst-errno-manual.out
: tst-errno-manual.py \
356 $(..
)manual
/errno.texi
357 $(PYTHON
) tst-errno-manual.py
-m
$(..
)manual
/errno.texi \
358 -e
$(errlist-h
) > $@
; \
361 CFLAGS-vfprintf.c
+= -Wno-uninitialized
362 CFLAGS-vfwprintf.c
+= -Wno-uninitialized
364 CFLAGS-tmpfile.c
+= -fexceptions
365 CFLAGS-tmpfile64.c
+= -fexceptions
366 CFLAGS-tempname.c
+= -fexceptions
367 CFLAGS-psignal.c
+= -fexceptions
368 CFLAGS-vprintf.c
+= -fexceptions
369 CFLAGS-cuserid.c
+= -fexceptions
371 CFLAGS-vfprintf.c
+= -fexceptions
372 CFLAGS-fprintf.c
+= -fexceptions
373 CFLAGS-printf.c
+= -fexceptions
374 CFLAGS-vfwprintf.c
+= -fexceptions
375 CFLAGS-vfscanf.c
+= -fexceptions
376 CFLAGS-vfwscanf.c
+= -fexceptions
377 CFLAGS-fscanf.c
+= -fexceptions
378 CFLAGS-scanf.c
+= -fexceptions
379 CFLAGS-isoc99_vfscanf.c
+= -fexceptions
380 CFLAGS-isoc99_vscanf.c
+= -fexceptions
381 CFLAGS-isoc99_fscanf.c
+= -fexceptions
382 CFLAGS-isoc99_scanf.c
+= -fexceptions
384 # scanf14a.c and scanf16a.c test a deprecated extension which is no
385 # longer visible under most conformance levels; see the source files
387 CFLAGS-scanf14a.c
+= -std
=gnu89
388 CFLAGS-scanf16a.c
+= -std
=gnu89
390 CFLAGS-bug3.c
+= -DOBJPFX
=\"$(objpfx
)\"
391 CFLAGS-bug4.c
+= -DOBJPFX
=\"$(objpfx
)\"
392 CFLAGS-bug5.c
+= -DOBJPFX
=\"$(objpfx
)\"
393 CFLAGS-test-fseek.c
+= -DOBJPFX
=\"$(objpfx
)\"
394 CFLAGS-test-popen.c
+= -DOBJPFX
=\"$(objpfx
)\"
395 CFLAGS-test_rdwr.c
+= -DOBJPFX
=\"$(objpfx
)\"
397 # tst-gets.c tests a deprecated function.
398 CFLAGS-tst-gets.c
+= -Wno-deprecated-declarations
400 # BZ #11319 was first fixed for regular vdprintf, then reopened because
401 # the fortified version had the same bug.
402 CFLAGS-tst-bz11319-fortify2.c
+= -D_FORTIFY_SOURCE
=2
404 CFLAGS-tst-memstream-string.c
+= -fno-builtin-fprintf
406 CPPFLAGS
+= $(libio-mtsafe
)
408 $(objpfx
)tst-setvbuf1.out
: /dev
/null
$(objpfx
)tst-setvbuf1
409 $(test-program-cmd
) > $@
2>&1; \
412 $(objpfx
)tst-setvbuf1-cmp.out
: tst-setvbuf1.expect
$(objpfx
)tst-setvbuf1.out
416 $(objpfx
)tst-printf-round
: $(libm
)
417 $(objpfx
)tst-scanf-round
: $(libm
)