]> git.ipfire.org Git - thirdparty/glibc.git/blame - stdio-common/Makefile
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / stdio-common / Makefile
CommitLineData
2b778ceb 1# Copyright (C) 1991-2021 Free Software Foundation, Inc.
deab9dea
RM
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
deab9dea
RM
8
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
41bdb6e2 12# Lesser General Public License for more details.
deab9dea 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6 15# License along with the GNU C Library; if not, see
5a82c748 16# <https://www.gnu.org/licenses/>.
deab9dea
RM
17
18#
19# Specific makefile for stdio-common.
20#
21subdir := stdio-common
22
a5f891ac
JM
23include ../Makeconfig
24
4962050e 25headers := stdio_ext.h printf.h bits/printf-ldbl.h bits/stdio_lim.h
deab9dea
RM
26
27routines := \
28 ctermid cuserid \
cb7c4a27 29 _itoa _itowa itoa-digits itoa-udigits itowa-digits \
af6f3906 30 vfprintf vprintf printf_fp reg-printf printf-prs printf_fphex \
9d26efa9 31 reg-modifier reg-type \
3e5f5557 32 printf_size fprintf printf snprintf sprintf asprintf dprintf \
934b77ac 33 vfwprintf vfscanf vfwscanf \
deab9dea
RM
34 fscanf scanf sscanf \
35 perror psignal \
dfd2257a 36 tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
deab9dea 37 getline getw putw \
d6da5cb6 38 remove rename renameat renameat2 \
874aa523
UD
39 flockfile ftrylockfile funlockfile \
40 isoc99_scanf isoc99_vscanf isoc99_fscanf isoc99_vfscanf isoc99_sscanf \
1f04d005 41 isoc99_vsscanf \
349718d4 42 psiginfo gentempfd \
698fb75b
ZW
43 vfscanf-internal vfwscanf-internal iovfscanf iovfwscanf \
44 vfprintf-internal vfwprintf-internal
fafaa44e 45
10ffcd52 46aux := errlist siglist printf-parsemb printf-parsewc fxprintf
deab9dea 47
95b04192 48tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
c131718c 49 temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
deab9dea 50 xbug errnobug \
1e9f6e98 51 bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 bug13 \
b1195070 52 tfformat tiformat tllformat tstdiomisc tst-printfsz tst-wc-printf \
60876a75 53 scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
8a207204 54 scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
30bce7b6 55 tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
5fefb436 56 tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 \
cae6ebb2 57 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
0923a2c8 58 tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
ad8a5511 59 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
7c1f4834 60 scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
b0bc23a1 61 bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
560b0446 62 bug25 tst-printf-round bug23-2 bug23-3 bug23-4 bug26 tst-fmemopen3 \
e2390be8
FW
63 tst-printf-bz18872 tst-vfprintf-width-prec tst-fmemopen4 \
64 tst-vfprintf-user-type \
c11cfe8d 65 tst-vfprintf-mbs-prec \
646c2833 66 tst-scanf-round \
4e2f43f8 67 tst-renameat2 tst-bz11319 tst-bz11319-fortify2 \
03992356 68 scanf14a scanf16a \
6caddd34 69 tst-printf-bz25691 \
ede56038 70 tst-vfprintf-width-prec-alloc \
90663e9c 71 tst-printf-fp-free \
cef95fdc
AZ
72 tst-printf-fp-leak \
73 test-strerr
03992356 74
deab9dea 75
b7b88cea 76test-srcs = tst-unbputc tst-printf tst-printfsz-islongdouble
6f98fd7e 77
f214606a
JM
78ifeq ($(run-built-tests),yes)
79tests-special += $(objpfx)tst-unbputc.out $(objpfx)tst-printf.out \
560b0446 80 $(objpfx)tst-printf-bz18872-mem.out \
fdcf1c94 81 $(objpfx)tst-setvbuf1-cmp.out \
b7b88cea 82 $(objpfx)tst-vfprintf-width-prec-mem.out \
910a835d 83 $(objpfx)tst-printfsz-islongdouble.out \
ede56038 84 $(objpfx)tst-printf-bz25691-mem.out \
90663e9c
JM
85 $(objpfx)tst-printf-fp-free-mem.out \
86 $(objpfx)tst-printf-fp-leak-mem.out
560b0446 87generated += tst-printf-bz18872.c tst-printf-bz18872.mtrace \
fdcf1c94 88 tst-printf-bz18872-mem.out \
910a835d 89 tst-vfprintf-width-prec.mtrace tst-vfprintf-width-prec-mem.out \
ede56038 90 tst-printf-bz25691.mtrace tst-printf-bz25691-mem.out \
90663e9c
JM
91 tst-printf-fp-free.mtrace tst-printf-fp-free-mem.out \
92 tst-printf-fp-leak.mtrace tst-printf-fp-leak-mem.out
f214606a
JM
93endif
94
f13d2601
AZ
95tests-special += $(objpfx)tst-errno-manual.out
96
deab9dea 97include ../Rules
0793d348 98
f881f6ff
AS
99ifeq ($(run-built-tests),yes)
100LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ISO-8859-1 ja_JP.EUC-JP
101include ../gen-locales.mk
102
103$(objpfx)bug14.out: $(gen-locales)
104$(objpfx)scanf13.out: $(gen-locales)
105$(objpfx)test-vfprintf.out: $(gen-locales)
106$(objpfx)tst-grouping.out: $(gen-locales)
107$(objpfx)tst-sprintf.out: $(gen-locales)
108$(objpfx)tst-sscanf.out: $(gen-locales)
109$(objpfx)tst-swprintf.out: $(gen-locales)
84d8c5bc 110$(objpfx)tst-vfprintf-mbs-prec.out: $(gen-locales)
f881f6ff
AS
111endif
112
560b0446 113tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace
fdcf1c94
FW
114tst-vfprintf-width-prec-ENV = \
115 MALLOC_TRACE=$(objpfx)tst-vfprintf-width-prec.mtrace
910a835d
AZ
116tst-printf-bz25691-ENV = \
117 MALLOC_TRACE=$(objpfx)tst-printf-bz25691.mtrace
ede56038
JM
118tst-printf-fp-free-ENV = \
119 MALLOC_TRACE=$(objpfx)tst-printf-fp-free.mtrace
90663e9c
JM
120tst-printf-fp-leak-ENV = \
121 MALLOC_TRACE=$(objpfx)tst-printf-fp-leak.mtrace
560b0446 122
57c69bef 123$(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
8f8052c2 124 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
f0881698 125 $(evaluate-test)
6f98fd7e 126
57c69bef 127$(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
8f8052c2 128 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
f0881698 129 $(evaluate-test)
560b0446 130
b7b88cea
GG
131$(objpfx)tst-printfsz-islongdouble.out: \
132 tst-printfsz-islongdouble.sh $(objpfx)tst-printfsz-islongdouble
133 $(SHELL) $^ '$(test-program-prefix)' $@; \
134 $(evaluate-test)
135
560b0446
PP
136# We generate this source because it requires a printf invocation with
137# 10K arguments.
138$(objpfx)tst-printf-bz18872.c: tst-printf-bz18872.sh
139 rm -f $@ && $(BASH) $^ > $@.new && mv $@.new $@
140
fdcf1c94
FW
141$(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
142 $(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
560b0446 143 $(evaluate-test)
95b04192 144
f13d2601
AZ
145errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .)))
146
147$(objpfx)tst-errno-manual.out: tst-errno-manual.py \
148 $(errlist-h) \
149 $(..)manual/errno.texi
150 $(PYTHON) tst-errno-manual.py -m $(..)manual/errno.texi \
151 -e $(errlist-h) > $@; \
152 $(evaluate-test)
153
36975e8e
L
154CFLAGS-vfprintf.c += -Wno-uninitialized
155CFLAGS-vfwprintf.c += -Wno-uninitialized
ec4b0518 156
36975e8e
L
157CFLAGS-tmpfile.c += -fexceptions
158CFLAGS-tmpfile64.c += -fexceptions
159CFLAGS-tempname.c += -fexceptions
160CFLAGS-psignal.c += -fexceptions
161CFLAGS-vprintf.c += -fexceptions
162CFLAGS-cuserid.c += -fexceptions
874aa523 163
56ab3869
JM
164CFLAGS-vfprintf.c += -fexceptions
165CFLAGS-fprintf.c += -fexceptions
166CFLAGS-printf.c += -fexceptions
167CFLAGS-vfwprintf.c += -fexceptions
168CFLAGS-vfscanf.c += -fexceptions
169CFLAGS-vfwscanf.c += -fexceptions
170CFLAGS-fscanf.c += -fexceptions
171CFLAGS-scanf.c += -fexceptions
172CFLAGS-isoc99_vfscanf.c += -fexceptions
173CFLAGS-isoc99_vscanf.c += -fexceptions
174CFLAGS-isoc99_fscanf.c += -fexceptions
175CFLAGS-isoc99_scanf.c += -fexceptions
36975e8e
L
176CFLAGS-errlist.c += $(fno-unit-at-a-time)
177CFLAGS-siglist.c += $(fno-unit-at-a-time)
73299943 178
03992356
ZW
179# scanf14a.c and scanf16a.c test a deprecated extension which is no
180# longer visible under most conformance levels; see the source files
181# for more detail.
182CFLAGS-scanf14a.c += -std=gnu89
183CFLAGS-scanf16a.c += -std=gnu89
874aa523 184
27f10a09
JM
185CFLAGS-bug3.c += -DOBJPFX=\"$(objpfx)\"
186CFLAGS-bug4.c += -DOBJPFX=\"$(objpfx)\"
187CFLAGS-bug5.c += -DOBJPFX=\"$(objpfx)\"
188CFLAGS-test-fseek.c += -DOBJPFX=\"$(objpfx)\"
189CFLAGS-test-popen.c += -DOBJPFX=\"$(objpfx)\"
190CFLAGS-test_rdwr.c += -DOBJPFX=\"$(objpfx)\"
191
7caa5054
ZW
192# tst-gets.c tests a deprecated function.
193CFLAGS-tst-gets.c += -Wno-deprecated-declarations
194
4e2f43f8
ZW
195# BZ #11319 was first fixed for regular vdprintf, then reopened because
196# the fortified version had the same bug.
197CFLAGS-tst-bz11319-fortify2.c += -D_FORTIFY_SOURCE=2
198
c75ccd4c 199CPPFLAGS += $(libio-mtsafe)
75684bd7 200
6e89caf1 201$(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
f0881698
JM
202 $(test-program-cmd) > $@ 2>&1; \
203 $(evaluate-test)
6e89caf1
JM
204
205$(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
f0881698
JM
206 cmp $^ > $@; \
207 $(evaluate-test)
784761be 208
79520f4b 209$(objpfx)tst-printf-round: $(libm)
646c2833 210$(objpfx)tst-scanf-round: $(libm)