Run tst-fopenloc if $(build-shared) is yes
[glibc.git] / libio / Makefile
blob090e1941e395a8f5b50e696fae0247f6234297ae
1 # Copyright (C) 1995-2004,2006-2009,2011,2012 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.
21 subdir := libio
23 headers := stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.h \
24 bits/sys_errlist.h bits/stdio2.h bits/stdio-ldbl.h bits/libio-ldbl.h
26 routines := \
27 filedoalloc iofclose iofdopen iofflush iofgetpos iofgets iofopen \
28 iofopncook iofputs iofread iofsetpos ioftell wfiledoalloc \
29 iofwrite iogetdelim iogetline iogets iopadn iopopen ioputs \
30 ioseekoff ioseekpos iosetbuffer iosetvbuf ioungetc \
31 iovsprintf iovsscanf \
32 iofgetpos64 iofopen64 iofsetpos64 \
33 fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
34 iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u \
35 putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf \
36 wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops \
37 wstrops wfileops iofwide fwide wmemstream \
39 clearerr feof ferror fileno fputc freopen fseek getc getchar \
40 memstream pclose putc putchar rewind setbuf setlinebuf vasprintf \
41 iovdprintf vscanf vsnprintf obprintf fcloseall fseeko ftello \
42 freopen64 fseeko64 ftello64 \
44 __fbufsize __freading __fwriting __freadable __fwritable __flbf \
45 __fpurge __fpending __fsetlocking \
47 libc_fatal fmemopen
49 include ../Makeconfig
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 bug-fclose1
63 ifeq (yes,$(build-shared))
64 # Add test-fopenloc only if shared library is enabled since it depends on
65 # shared localedata objects.
66 tests += tst-fopenloc
67 endif
68 test-srcs = test-freopen
70 all: # Make this the default target; it will be defined in Rules.
72 ifeq ($(versioning),yes)
73 routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
74 oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos \
75 oldiofsetpos64
76 endif
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 \
81 iofputs_u
82 endif
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-widetext-ENV = LOCPATH=$(common-objpfx)localedata LANGUAGE=C
152 tst-fopenloc-ENV = LOCPATH=$(common-objpfx)localedata \
153 MALLOC_TRACE=$(objpfx)tst-fopenloc.mtrace
154 tst-fgetws-ENV = LOCPATH=$(common-objpfx)localedata
155 tst-ungetwc1-ENV = LOCPATH=$(common-objpfx)localedata
156 tst-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
157 bug-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
158 tst-swscanf-ENV = LOCPATH=$(common-objpfx)localedata
159 bug-ftell-ENV = LOCPATH=$(common-objpfx)localedata
160 tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata
162 generated = tst-fopenloc.mtrace tst-fopenloc.check
164 aux := fileops genops stdfiles stdio strops
166 ifeq ($(versioning),yes)
167 aux += oldfileops oldstdfiles
168 endif
170 shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops \
171 oldstdfiles oldiopopen oldpclose oldtmpfile \
172 oldiofgetpos oldiofgetpos64 oldiofsetpos \
173 oldiofsetpos64
175 include ../Rules
177 ifeq (no,$(cross-compiling))
178 tests: $(objpfx)test-freopen.out
179 ifeq (yes,$(build-shared))
180 # Run tst-fopenloc.check only if shared library is enabled since it
181 # depends on tst-fopenloc.out.
182 tests: $(objpfx)tst-fopenloc.check
183 endif
184 endif
186 $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
187 $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' \
188 $(common-objpfx)libio/
190 $(objpfx)tst-fopenloc.check: $(objpfx)tst-fopenloc.out
191 cmp ../iconvdata/testdata/ISO-8859-1..UTF8 $(objpfx)tst-fopenloc.out \
192 > $@
193 $(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace >> $@