1 # Copyright (C) 1995-2017 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 # <http://www.gnu.org/licenses/>.
19 # Specific makefile for libio.
25 headers
:= stdio.h libio.h _G_config.h bits
/stdio.h \
26 bits
/sys_errlist.h bits
/stdio2.h bits
/stdio-ldbl.h bits
/libio-ldbl.h \
27 bits
/types
/FILE.h bits
/types
/__FILE.h
30 filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
31 iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
32 iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
33 ioseekoff ioseekpos iosetbuffer iosetvbuf ioungetc \
34 iovsprintf iovsscanf \
35 iofgetpos64 iofopen64 iofsetpos64 \
36 fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
37 iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
38 putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf \
39 wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops \
40 wstrops wfileops iofwide fwide wmemstream \
42 clearerr feof ferror fileno fputc freopen fseek getc getchar \
43 memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
44 iovdprintf vscanf vsnprintf obprintf fcloseall fseeko ftello \
45 freopen64 fseeko64 ftello64 \
47 __fbufsize __freading __fwriting __freadable __fwritable __flbf \
48 __fpurge __fpending __fsetlocking \
50 libc_fatal fmemopen oldfmemopen vtables
52 tests
= tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
53 tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
54 tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
55 tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2 tst-atime tst-eof \
56 tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
57 tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
58 tst-mmap2-eofsync tst-mmap-offend bug-fopena
+ bug-wfflush \
59 bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
60 tst-memstream1 tst-memstream2 tst-memstream3 \
61 tst-wmemstream1 tst-wmemstream2 tst-wmemstream3 \
62 bug-memstream1 bug-wmemstream1 \
63 tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
64 tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
65 tst-ftell-append tst-fputws
66 ifeq (yes
,$(build-shared
))
67 # Add test-fopenloc only if shared library is enabled since it depends on
68 # shared localedata objects.
71 test-srcs
= test-freopen
73 ifeq ($(build-shared
),yes
)
74 routines
+= oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
75 oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos \
79 ifeq (yes
,$(libc-reentrant
))
80 routines
+= clearerr_u feof_u ferror_u fputc_u getc_u getchar_u \
81 iofflush_u putc_u putchar_u peekc iofread_u iofwrite_u iofgets_u \
85 CPPFLAGS
+= $(libio-mtsafe
)
87 # Support for exception handling.
88 CFLAGS-fileops.c
= -fexceptions
89 CFLAGS-fputc.c
= -fexceptions
90 CFLAGS-fputwc.c
= -fexceptions
91 CFLAGS-freopen64.c
= -fexceptions
92 CFLAGS-freopen.c
= -fexceptions
93 CFLAGS-fseek.c
= -fexceptions
94 CFLAGS-fseeko64.c
= -fexceptions
95 CFLAGS-fseeko.c
= -fexceptions
96 CFLAGS-ftello64.c
= -fexceptions
97 CFLAGS-ftello.c
= -fexceptions
98 CFLAGS-fwide.c
= -fexceptions
99 CFLAGS-genops.c
= -fexceptions
100 CFLAGS-getc.c
= -fexceptions
101 CFLAGS-getchar.c
= -fexceptions
102 CFLAGS-getwc.c
= -fexceptions
103 CFLAGS-getwchar.c
= -fexceptions
104 CFLAGS-iofclose.c
= -fexceptions
105 CFLAGS-iofflush.c
= -fexceptions
106 CFLAGS-iofgetpos64.c
= -fexceptions
107 CFLAGS-iofgetpos.c
= -fexceptions
108 CFLAGS-iofgets.c
= -fexceptions
109 CFLAGS-iofgetws.c
= -fexceptions
110 CFLAGS-iofputs.c
= -fexceptions
111 CFLAGS-iofputws.c
= -fexceptions
112 CFLAGS-iofread.c
= -fexceptions
113 CFLAGS-iofsetpos64.c
= -fexceptions
114 CFLAGS-iofsetpos.c
= -fexceptions
115 CFLAGS-ioftell.c
= -fexceptions
116 CFLAGS-iofwrite.c
= -fexceptions
117 CFLAGS-iogetdelim.c
= -fexceptions
118 CFLAGS-iogetline.c
= -fexceptions
119 CFLAGS-iogets.c
= -fexceptions
120 CFLAGS-iogetwline.c
= -fexceptions
121 CFLAGS-ioputs.c
= -fexceptions
122 CFLAGS-ioseekoff.c
= -fexceptions
123 CFLAGS-ioseekpos.c
= -fexceptions
124 CFLAGS-iosetbuffer.c
= -fexceptions
125 CFLAGS-iosetvbuf.c
= -fexceptions
126 CFLAGS-ioungetc.c
= -fexceptions
127 CFLAGS-ioungetwc.c
= -fexceptions
128 CFLAGS-oldfileops.c
= -fexceptions
129 CFLAGS-oldiofclose.c
= -fexceptions
130 CFLAGS-oldiofgetpos64.c
= -fexceptions
131 CFLAGS-oldiofgetpos.c
= -fexceptions
132 CFLAGS-oldiofsetpos64.c
= -fexceptions
133 CFLAGS-oldiofsetpos.c
= -fexceptions
134 CFLAGS-peekc.c
= -fexceptions
135 CFLAGS-putc.c
= -fexceptions
136 CFLAGS-putchar.c
= -fexceptions
137 CFLAGS-putwc.c
= -fexceptions
138 CFLAGS-putwchar.c
= -fexceptions
139 CFLAGS-rewind.c
= -fexceptions
140 CFLAGS-wfileops.c
= -fexceptions
141 CFLAGS-wgenops.c
= -fexceptions
142 CFLAGS-oldiofopen.c
= -fexceptions
143 CFLAGS-iofopen.c
= -fexceptions
144 CFLAGS-iofopen64.c
= -fexceptions
145 CFLAGS-oldtmpfile.c
= -fexceptions
146 # XXX Do we need filedoalloc and wfiledoalloc? Others?
148 CFLAGS-tst_putwc.c
= -DOBJPFX
=\"$(objpfx
)\"
150 tst_wprintf2-ARGS
= "Some Text"
152 test-fmemopen-ENV
= MALLOC_TRACE
=$(objpfx
)test-fmemopen.mtrace
153 tst-fopenloc-ENV
= MALLOC_TRACE
=$(objpfx
)tst-fopenloc.mtrace
155 generated
+= test-fmemopen.mtrace test-fmemopen.
check
156 generated
+= tst-fopenloc.mtrace tst-fopenloc.
check
158 aux
:= fileops genops stdfiles stdio strops
160 ifeq ($(build-shared
),yes
)
161 aux
+= oldfileops oldstdfiles
164 shared-only-routines
= oldiofopen oldiofdopen oldiofclose oldfileops \
165 oldstdfiles oldiopopen oldpclose oldtmpfile \
166 oldiofgetpos oldiofgetpos64 oldiofsetpos \
169 ifeq ($(run-built-tests
),yes
)
170 tests-special
+= $(objpfx
)test-freopen.out
$(objpfx
)test-fmemopen-mem.out
171 ifeq (yes
,$(build-shared
))
172 # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
173 # library is enabled since they depend on tst-fopenloc.out.
174 tests-special
+= $(objpfx
)tst-fopenloc-cmp.out
$(objpfx
)tst-fopenloc-mem.out
180 ifeq ($(run-built-tests
),yes
)
181 LOCALES
:= de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \
182 ja_JP.EUC-JP ja_JP.UTF-8
183 include ..
/gen-locales.mk
185 $(objpfx
)bug-ftell.out
: $(gen-locales
)
186 $(objpfx
)bug-ungetwc1.out
: $(gen-locales
)
187 $(objpfx
)bug-ungetwc2.out
: $(gen-locales
)
188 $(objpfx
)tst-fgetwc.out
: $(gen-locales
)
189 $(objpfx
)tst-fgetws.out
: $(gen-locales
)
190 $(objpfx
)tst-fopenloc.out
: $(gen-locales
)
191 $(objpfx
)tst-fputws.out
: $(gen-locales
)
192 $(objpfx
)tst-fseek.out
: $(gen-locales
)
193 $(objpfx
)tst-ftell-active-handler.out
: $(gen-locales
)
194 $(objpfx
)tst-ftell-append.out
: $(gen-locales
)
195 $(objpfx
)tst-ftell-partial-wide.out
: $(gen-locales
)
196 $(objpfx
)tst-setvbuf1.out
: $(gen-locales
)
197 $(objpfx
)tst-swscanf.out
: $(gen-locales
)
198 $(objpfx
)tst-ungetwc1.out
: $(gen-locales
)
199 $(objpfx
)tst-ungetwc2.out
: $(gen-locales
)
200 $(objpfx
)tst-widetext.out
: $(gen-locales
)
201 $(objpfx
)tst_wprintf2.out
: $(gen-locales
)
204 $(objpfx
)test-freopen.out
: test-freopen.sh
$(objpfx
)test-freopen
205 $(SHELL
) $< $(common-objpfx
) '$(test-program-prefix)' \
206 $(common-objpfx
)libio
/ > $@
; \
209 $(objpfx
)tst-fopenloc-cmp.out
: ..
/iconvdata
/testdata
/ISO-8859-1..UTF8 \
210 $(objpfx
)tst-fopenloc.out
214 $(objpfx
)test-fmemopen-mem.out
: $(objpfx
)test-fmemopen.out
215 $(common-objpfx
)malloc
/mtrace
$(objpfx
)test-fmemopen.mtrace
> $@
; \
218 $(objpfx
)tst-fopenloc-mem.out
: $(objpfx
)tst-fopenloc.out
219 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-fopenloc.mtrace
> $@
; \