Add --enable-hardcoded-path-in-tests configure option
[platform/upstream/glibc.git] / libio / Makefile
1 # Copyright (C) 1995-2013 Free Software Foundation, Inc.
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
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.
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
12 # Lesser General Public License for more details.
13
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/>.
17
18 #
19 #       Specific makefile for libio.
20 #
21 subdir  := libio
22
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
25
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                             \
38                                                                               \
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                                           \
43                                                                               \
44         __fbufsize __freading __fwriting __freadable __fwritable __flbf       \
45         __fpurge __fpending __fsetlocking                                     \
46                                                                               \
47         libc_fatal fmemopen
48
49 include ../Makeconfig
50
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
64 ifeq (yes,$(build-shared))
65 # Add test-fopenloc only if shared library is enabled since it depends on
66 # shared localedata objects.
67 tests += tst-fopenloc
68 endif
69 test-srcs = test-freopen
70
71 all: # Make this the default target; it will be defined in Rules.
72
73 ifeq ($(versioning),yes)
74 routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
75             oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos     \
76             oldiofsetpos64
77 endif
78
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  \
82             iofputs_u
83 endif
84
85 CPPFLAGS += $(libio-mtsafe)
86
87 # Support for exception handling.
88 CFLAGS-fileops.c = $(exceptions)
89 CFLAGS-fputc.c = $(exceptions)
90 CFLAGS-fputwc.c = $(exceptions)
91 CFLAGS-freopen64.c = $(exceptions)
92 CFLAGS-freopen.c = $(exceptions)
93 CFLAGS-fseek.c = $(exceptions)
94 CFLAGS-fseeko64.c = $(exceptions)
95 CFLAGS-fseeko.c = $(exceptions)
96 CFLAGS-ftello64.c = $(exceptions)
97 CFLAGS-ftello.c = $(exceptions)
98 CFLAGS-fwide.c = $(exceptions)
99 CFLAGS-genops.c = $(exceptions)
100 CFLAGS-getc.c = $(exceptions)
101 CFLAGS-getchar.c = $(exceptions)
102 CFLAGS-getwc.c = $(exceptions)
103 CFLAGS-getwchar.c = $(exceptions)
104 CFLAGS-iofclose.c = $(exceptions)
105 CFLAGS-iofflush.c = $(exceptions)
106 CFLAGS-iofgetpos64.c = $(exceptions)
107 CFLAGS-iofgetpos.c = $(exceptions)
108 CFLAGS-iofgets.c = $(exceptions)
109 CFLAGS-iofgetws.c = $(exceptions)
110 CFLAGS-iofputs.c = $(exceptions)
111 CFLAGS-iofputws.c = $(exceptions)
112 CFLAGS-iofread.c = $(exceptions)
113 CFLAGS-iofsetpos64.c = $(exceptions)
114 CFLAGS-iofsetpos.c = $(exceptions)
115 CFLAGS-ioftell.c = $(exceptions)
116 CFLAGS-iofwrite.c = $(exceptions)
117 CFLAGS-iogetdelim.c = $(exceptions)
118 CFLAGS-iogetline.c = $(exceptions)
119 CFLAGS-iogets.c = $(exceptions)
120 CFLAGS-iogetwline.c = $(exceptions)
121 CFLAGS-ioputs.c = $(exceptions)
122 CFLAGS-ioseekoff.c = $(exceptions)
123 CFLAGS-ioseekpos.c = $(exceptions)
124 CFLAGS-iosetbuffer.c = $(exceptions)
125 CFLAGS-iosetvbuf.c = $(exceptions)
126 CFLAGS-ioungetc.c = $(exceptions)
127 CFLAGS-ioungetwc.c = $(exceptions)
128 CFLAGS-oldfileops.c = $(exceptions)
129 CFLAGS-oldiofclose.c = $(exceptions)
130 CFLAGS-oldiofgetpos64.c = $(exceptions)
131 CFLAGS-oldiofgetpos.c = $(exceptions)
132 CFLAGS-oldiofsetpos64.c = $(exceptions)
133 CFLAGS-oldiofsetpos.c = $(exceptions)
134 CFLAGS-peekc.c = $(exceptions)
135 CFLAGS-putc.c = $(exceptions)
136 CFLAGS-putchar.c = $(exceptions)
137 CFLAGS-putwc.c = $(exceptions)
138 CFLAGS-putwchar.c = $(exceptions)
139 CFLAGS-rewind.c = $(exceptions)
140 CFLAGS-wfileops.c = $(exceptions)
141 CFLAGS-wgenops.c = $(exceptions)
142 CFLAGS-oldiofopen.c = $(exceptions)
143 CFLAGS-iofopen.c = $(exceptions)
144 CFLAGS-iofopen64.c = $(exceptions)
145 CFLAGS-oldtmpfile.c = $(exceptions)
146 # XXX Do we need filedoalloc and wfiledoalloc?  Others?
147
148 CFLAGS-tst_putwc.c = -DOBJPFX=\"$(objpfx)\"
149
150 tst_wprintf2-ARGS = "Some Text"
151
152 tst-widetext-ENV = LOCPATH=$(common-objpfx)localedata LANGUAGE=C
153 tst-fopenloc-ENV = LOCPATH=$(common-objpfx)localedata \
154                    MALLOC_TRACE=$(objpfx)tst-fopenloc.mtrace
155 tst-fgetws-ENV = LOCPATH=$(common-objpfx)localedata
156 tst-ungetwc1-ENV = LOCPATH=$(common-objpfx)localedata
157 tst-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
158 bug-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
159 tst-swscanf-ENV = LOCPATH=$(common-objpfx)localedata
160 bug-ftell-ENV = LOCPATH=$(common-objpfx)localedata
161 tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata
162 tst-fseek-ENV = LOCPATH=$(common-objpfx)localedata
163
164 generated = tst-fopenloc.mtrace tst-fopenloc.check
165
166 aux     := fileops genops stdfiles stdio strops
167
168 ifeq ($(versioning),yes)
169 aux     += oldfileops oldstdfiles
170 endif
171
172 shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops    \
173                        oldstdfiles oldiopopen oldpclose oldtmpfile      \
174                        oldiofgetpos oldiofgetpos64 oldiofsetpos         \
175                        oldiofsetpos64
176
177 include ../Rules
178
179 ifeq ($(run-built-tests),yes)
180 tests: $(objpfx)test-freopen.out
181 ifeq (yes,$(build-shared))
182 # Run tst-fopenloc.check only if shared library is enabled since it
183 # depends on tst-fopenloc.out.
184 tests: $(objpfx)tst-fopenloc.check
185 endif
186 endif
187
188 $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
189         $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'   \
190         $(common-objpfx)libio/
191
192 $(objpfx)tst-fopenloc.check: $(objpfx)tst-fopenloc.out
193         cmp ../iconvdata/testdata/ISO-8859-1..UTF8 $(objpfx)tst-fopenloc.out \
194           > $@
195         $(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace >> $@