Add comments about non-Linux use of bits/mman-linux.h.
[glibc.git] / libio / Makefile
blob69c25c0c3d2242ac2a281a63f1f557c531837b5b
1 # Copyright (C) 1995-2014 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 include ../Makeconfig
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
28 routines := \
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 \
49 libc_fatal fmemopen
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 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
71 ifeq ($(build-shared),yes)
72 routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
73 oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos \
74 oldiofsetpos64
75 endif
77 ifeq (yes,$(libc-reentrant))
78 routines += clearerr_u feof_u ferror_u fputc_u getc_u getchar_u \
79 iofflush_u putc_u putchar_u peekc iofread_u iofwrite_u iofgets_u \
80 iofputs_u
81 endif
83 CPPFLAGS += $(libio-mtsafe)
85 # Support for exception handling.
86 CFLAGS-fileops.c = $(exceptions)
87 CFLAGS-fputc.c = $(exceptions)
88 CFLAGS-fputwc.c = $(exceptions)
89 CFLAGS-freopen64.c = $(exceptions)
90 CFLAGS-freopen.c = $(exceptions)
91 CFLAGS-fseek.c = $(exceptions)
92 CFLAGS-fseeko64.c = $(exceptions)
93 CFLAGS-fseeko.c = $(exceptions)
94 CFLAGS-ftello64.c = $(exceptions)
95 CFLAGS-ftello.c = $(exceptions)
96 CFLAGS-fwide.c = $(exceptions)
97 CFLAGS-genops.c = $(exceptions)
98 CFLAGS-getc.c = $(exceptions)
99 CFLAGS-getchar.c = $(exceptions)
100 CFLAGS-getwc.c = $(exceptions)
101 CFLAGS-getwchar.c = $(exceptions)
102 CFLAGS-iofclose.c = $(exceptions)
103 CFLAGS-iofflush.c = $(exceptions)
104 CFLAGS-iofgetpos64.c = $(exceptions)
105 CFLAGS-iofgetpos.c = $(exceptions)
106 CFLAGS-iofgets.c = $(exceptions)
107 CFLAGS-iofgetws.c = $(exceptions)
108 CFLAGS-iofputs.c = $(exceptions)
109 CFLAGS-iofputws.c = $(exceptions)
110 CFLAGS-iofread.c = $(exceptions)
111 CFLAGS-iofsetpos64.c = $(exceptions)
112 CFLAGS-iofsetpos.c = $(exceptions)
113 CFLAGS-ioftell.c = $(exceptions)
114 CFLAGS-iofwrite.c = $(exceptions)
115 CFLAGS-iogetdelim.c = $(exceptions)
116 CFLAGS-iogetline.c = $(exceptions)
117 CFLAGS-iogets.c = $(exceptions)
118 CFLAGS-iogetwline.c = $(exceptions)
119 CFLAGS-ioputs.c = $(exceptions)
120 CFLAGS-ioseekoff.c = $(exceptions)
121 CFLAGS-ioseekpos.c = $(exceptions)
122 CFLAGS-iosetbuffer.c = $(exceptions)
123 CFLAGS-iosetvbuf.c = $(exceptions)
124 CFLAGS-ioungetc.c = $(exceptions)
125 CFLAGS-ioungetwc.c = $(exceptions)
126 CFLAGS-oldfileops.c = $(exceptions)
127 CFLAGS-oldiofclose.c = $(exceptions)
128 CFLAGS-oldiofgetpos64.c = $(exceptions)
129 CFLAGS-oldiofgetpos.c = $(exceptions)
130 CFLAGS-oldiofsetpos64.c = $(exceptions)
131 CFLAGS-oldiofsetpos.c = $(exceptions)
132 CFLAGS-peekc.c = $(exceptions)
133 CFLAGS-putc.c = $(exceptions)
134 CFLAGS-putchar.c = $(exceptions)
135 CFLAGS-putwc.c = $(exceptions)
136 CFLAGS-putwchar.c = $(exceptions)
137 CFLAGS-rewind.c = $(exceptions)
138 CFLAGS-wfileops.c = $(exceptions)
139 CFLAGS-wgenops.c = $(exceptions)
140 CFLAGS-oldiofopen.c = $(exceptions)
141 CFLAGS-iofopen.c = $(exceptions)
142 CFLAGS-iofopen64.c = $(exceptions)
143 CFLAGS-oldtmpfile.c = $(exceptions)
144 # XXX Do we need filedoalloc and wfiledoalloc? Others?
146 CFLAGS-tst_putwc.c = -DOBJPFX=\"$(objpfx)\"
148 tst_wprintf2-ARGS = "Some Text"
150 tst-widetext-ENV = LOCPATH=$(common-objpfx)localedata LANGUAGE=C
151 tst-fopenloc-ENV = LOCPATH=$(common-objpfx)localedata \
152 MALLOC_TRACE=$(objpfx)tst-fopenloc.mtrace
153 tst-fgetws-ENV = LOCPATH=$(common-objpfx)localedata
154 tst-ungetwc1-ENV = LOCPATH=$(common-objpfx)localedata
155 tst-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
156 bug-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
157 tst-swscanf-ENV = LOCPATH=$(common-objpfx)localedata
158 bug-ftell-ENV = LOCPATH=$(common-objpfx)localedata
159 tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata
160 tst-fseek-ENV = LOCPATH=$(common-objpfx)localedata
162 generated += tst-fopenloc.mtrace tst-fopenloc.check
164 aux := fileops genops stdfiles stdio strops
166 ifeq ($(build-shared),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 ifeq ($(run-built-tests),yes)
176 tests-special += $(objpfx)test-freopen.out
177 ifeq (yes,$(build-shared))
178 # Run tst-fopenloc-cmp.out and tst-openloc-mem.out only if shared
179 # library is enabled since they depend on tst-fopenloc.out.
180 tests-special += $(objpfx)tst-fopenloc-cmp.out $(objpfx)tst-fopenloc-mem.out
181 endif
182 endif
184 include ../Rules
186 $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
187 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
188 $(common-objpfx)libio/; \
189 $(evaluate-test)
191 $(objpfx)tst-fopenloc-cmp.out: ../iconvdata/testdata/ISO-8859-1..UTF8 \
192 $(objpfx)tst-fopenloc.out
193 cmp $^ > $@; \
194 $(evaluate-test)
196 $(objpfx)tst-fopenloc-mem.out: $(objpfx)tst-fopenloc.out
197 $(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace > $@; \
198 $(evaluate-test)