Update.
[platform/upstream/glibc.git] / libio / Makefile
1 # Copyright (C) 1995,96,97,98,99,2000,2001,2002 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, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
18
19 #
20 #       Specific makefile for libio.
21 #
22 subdir  := libio
23
24 headers := stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.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                                        \
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 tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc   \
50         tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-fopenloc          \
51         tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf           \
52         tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2
53 test-srcs = test-freopen
54
55 all: # Make this the default target; it will be defined in Rules.
56
57 include ../Makeconfig
58
59 ifeq ($(versioning),yes)
60 routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
61             oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos     \
62             oldiofsetpos64
63 endif
64
65 ifneq (,$(filter %REENTRANT, $(defines)))
66 routines += clearerr_u feof_u ferror_u fputc_u getc_u getchar_u               \
67             iofflush_u putc_u putchar_u peekc iofread_u iofwrite_u iofgets_u  \
68             iofputs_u
69
70 CPPFLAGS += -D_IO_MTSAFE_IO
71 endif
72
73 # Support for exception handling.
74 CFLAGS-genops.c = $(exceptions)
75 CFLAGS-wgenops.c = $(exceptions)
76 CFLAGS-fileops.c = $(exceptions)
77 CFLAGS-wfileops.c = $(exceptions)
78 # XXX Do we need filedoalloc and wfiledoalloc?  Others?
79
80 CFLAGS-tst_putwc.c = -DOBJPFX=\"$(objpfx)\"
81
82 tst_wprintf2-ARGS = "Some Text"
83
84 tst-widetext-ENV = LOCPATH=$(common-objpfx)localedata LANGUAGE=C
85 tst-fopenloc-ENV = LOCPATH=$(common-objpfx)localedata \
86                    MALLOC_TRACE=$(objpfx)tst-fopenloc.mtrace
87 tst-fgetws-ENV = LOCPATH=$(common-objpfx)localedata
88 tst-ungetwc1-ENV = LOCPATH=$(common-objpfx)localedata
89 tst-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
90 bug-ungetwc2-ENV = LOCPATH=$(common-objpfx)localedata
91 tst-swscanf-ENV = LOCPATH=$(common-objpfx)localedata
92
93 generated = tst-fopenloc.mtrace tst-fopenloc.check
94
95 aux     := fileops genops stdfiles stdio strops
96
97 ifeq ($(versioning),yes)
98 aux     += oldfileops oldstdfiles
99 endif
100
101 shared-only-routines = oldiofopen oldiofdopen oldiofclose oldfileops    \
102                        oldstdfiles oldiopopen oldpclose oldtmpfile      \
103                        oldiofgetpos oldiofgetpos64 oldiofsetpos         \
104                        oldiofsetpos64
105
106 distribute := iolibio.h libioP.h strfile.h Banner test-freopen.sh \
107               fd_to_filename.h
108
109 include ../Rules
110
111 ifeq (no,$(cross-compiling))
112 tests: $(objpfx)test-freopen.out $(objpfx)tst-fopenloc.check
113 endif
114
115 $(objpfx)test-freopen.out: test-freopen.sh $(objpfx)test-freopen
116         $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' \
117         $(common-objpfx)libio/
118
119 $(objpfx)tst-fopenloc.check: $(objpfx)tst-fopenloc.out
120         cmp ../iconvdata/testdata/ISO-8859-1..UTF8 $(objpfx)tst-fopenloc.out \
121           > $@
122         $(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace >> $@