1 # Copyright (C) 1995-2015 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 bits/stdio-lock.h \
26 bits/sys_errlist.h bits/stdio2.h bits/stdio-ldbl.h bits/libio-ldbl.h
29 filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
30 iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
31 iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
32 ioseekoff ioseekpos iosetbuffer iosetvbuf ioungetc \
33 iovsprintf iovsscanf \
34 iofgetpos64 iofopen64 iofsetpos64 \
35 fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
36 iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
37 putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf \
38 wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops \
39 wstrops wfileops iofwide fwide wmemstream \
41 clearerr feof ferror fileno fputc freopen fseek getc getchar \
42 memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
43 iovdprintf vscanf vsnprintf obprintf fcloseall fseeko ftello \
44 freopen64 fseeko64 ftello64 \
46 __fbufsize __freading __fwriting __freadable __fwritable __flbf \
47 __fpurge __fpending __fsetlocking \
51 tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
52 tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
53 tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
54 tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2 tst-atime tst-eof \
55 tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
56 tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
57 tst-mmap2-eofsync tst-mmap-offend bug-fopena+ bug-wfflush \
58 bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
59 tst-memstream1 tst-memstream2 \
60 tst-wmemstream1 tst-wmemstream2 \
61 bug-memstream1 bug-wmemstream1 \
62 tst-setvbuf1 tst-popen1 tst-fgetwc bug-wsetpos tst-fseek \
63 tst-fwrite-error tst-ftell-partial-wide tst-ftell-active-handler \
64 tst-ftell-append tst-fputws
65 ifeq (yes,$(build-shared))
66 # Add test-fopenloc only if shared library is enabled since it depends on
67 # shared localedata objects.
70 test-srcs = test-freopen
72 ifeq ($(build-shared),yes)
73 routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
74 oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos \
78 ifeq (yes,$(libc-reentrant))
79 routines += clearerr_u feof_u ferror_u fputc_u getc_u getchar_u \
80 iofflush_u putc_u putchar_u peekc iofread_u iofwrite_u iofgets_u \
84 CPPFLAGS += $(libio-mtsafe)
86 # Support for exception handling.
87 CFLAGS-fileops.c = $(exceptions)
88 CFLAGS-fputc.c = $(exceptions)
89 CFLAGS-fputwc.c = $(exceptions)
90 CFLAGS-freopen64.c = $(exceptions)
91 CFLAGS-freopen.c = $(exceptions)
92 CFLAGS-fseek.c = $(exceptions)
93 CFLAGS-fseeko64.c = $(exceptions)
94 CFLAGS-fseeko.c = $(exceptions)
95 CFLAGS-ftello64.c = $(exceptions)
96 CFLAGS-ftello.c = $(exceptions)
97 CFLAGS-fwide.c = $(exceptions)
98 CFLAGS-genops.c = $(exceptions)
99 CFLAGS-getc.c = $(exceptions)
100 CFLAGS-getchar.c = $(exceptions)
101 CFLAGS-getwc.c = $(exceptions)
102 CFLAGS-getwchar.c = $(exceptions)
103 CFLAGS-iofclose.c = $(exceptions)
104 CFLAGS-iofflush.c = $(exceptions)
105 CFLAGS-iofgetpos64.c = $(exceptions)
106 CFLAGS-iofgetpos.c = $(exceptions)
107 CFLAGS-iofgets.c = $(exceptions)
108 CFLAGS-iofgetws.c = $(exceptions)
109 CFLAGS-iofputs.c = $(exceptions)
110 CFLAGS-iofputws.c = $(exceptions)
111 CFLAGS-iofread.c = $(exceptions)
112 CFLAGS-iofsetpos64.c = $(exceptions)
113 CFLAGS-iofsetpos.c = $(exceptions)
114 CFLAGS-ioftell.c = $(exceptions)
115 CFLAGS-iofwrite.c = $(exceptions)
116 CFLAGS-iogetdelim.c = $(exceptions)
117 CFLAGS-iogetline.c = $(exceptions)
118 CFLAGS-iogets.c = $(exceptions)
119 CFLAGS-iogetwline.c = $(exceptions)
120 CFLAGS-ioputs.c = $(exceptions)
121 CFLAGS-ioseekoff.c = $(exceptions)
122 CFLAGS-ioseekpos.c = $(exceptions)
123 CFLAGS-iosetbuffer.c = $(exceptions)
124 CFLAGS-iosetvbuf.c = $(exceptions)
125 CFLAGS-ioungetc.c = $(exceptions)
126 CFLAGS-ioungetwc.c = $(exceptions)
127 CFLAGS-oldfileops.c = $(exceptions)
128 CFLAGS-oldiofclose.c = $(exceptions)
129 CFLAGS-oldiofgetpos64.c = $(exceptions)
130 CFLAGS-oldiofgetpos.c = $(exceptions)
131 CFLAGS-oldiofsetpos64.c = $(exceptions)
132 CFLAGS-oldiofsetpos.c = $(exceptions)
133 CFLAGS-peekc.c = $(exceptions)
134 CFLAGS-putc.c = $(exceptions)
135 CFLAGS-putchar.c = $(exceptions)
136 CFLAGS-putwc.c = $(exceptions)
137 CFLAGS-putwchar.c = $(exceptions)
138 CFLAGS-rewind.c = $(exceptions)
139 CFLAGS-wfileops.c = $(exceptions)
140 CFLAGS-wgenops.c = $(exceptions)
141 CFLAGS-oldiofopen.c = $(exceptions)
142 CFLAGS-iofopen.c = $(exceptions)
143 CFLAGS-iofopen64.c = $(exceptions)
144 CFLAGS-oldtmpfile.c = $(exceptions)
145 # XXX Do we need filedoalloc and wfiledoalloc? Others?
147 CFLAGS-tst_putwc.c = -DOBJPFX=\"$(objpfx)\"
149 tst_wprintf2-ARGS = "Some Text"
151 tst-fopenloc-ENV = MALLOC_TRACE=$(objpfx)tst-fopenloc.mtrace
153 generated += tst-fopenloc.mtrace tst-fopenloc.check
155 aux := fileops genops stdfiles stdio strops
157 ifeq ($(build-shared),yes)
158 aux += oldfileops oldstdfiles
161 shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \
162 oldstdfiles oldiopopen oldpclose oldtmpfile \
163 oldiofgetpos oldiofgetpos64 oldiofsetpos \
166 ifeq ($(run-built-tests),yes)
167 tests-special += $(objpfx)test-freopen.out
168 ifeq (yes,$(build-shared))
169 # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
170 # library is enabled since they depend on tst-fopenloc.out.
171 tests-special += $(objpfx)tst-fopenloc-cmp.out $(objpfx)tst-fopenloc-mem.out
177 $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
178 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
179 $(common-objpfx)libio/; \
182 $(objpfx)tst-fopenloc-cmp.out: ../iconvdata/testdata/ISO-8859-1..UTF8 \
183 $(objpfx)tst-fopenloc.out
187 $(objpfx)tst-fopenloc-mem.out: $(objpfx)tst-fopenloc.out
188 $(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace > $@; \