Make unistd.h pre-c((-safe.
[glibc.git] / stdio-common / Makefile
blob9cbf14385c41da87cb864a6e03d538d6272b21bb
1 # Copyright (C) 1991-2006, 2007, 2008, 2009 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, write to the Free
16 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 # 02111-1307 USA.
20 # Specific makefile for stdio-common.
22 subdir := stdio-common
24 headers := stdio_ext.h printf.h bits/printf-ldbl.h
26 routines := \
27 ctermid cuserid \
28 _itoa _itowa itoa-digits itoa-udigits itowa-digits \
29 vfprintf vprintf printf_fp reg-printf printf-prs printf_fphex \
30 reg-modifier reg-type \
31 printf_size fprintf printf snprintf sprintf asprintf dprintf \
32 vfwprintf vfscanf vfwscanf \
33 fscanf scanf sscanf \
34 perror psignal \
35 tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
36 getline getw putw \
37 remove rename renameat \
38 flockfile ftrylockfile funlockfile \
39 isoc99_scanf isoc99_vscanf isoc99_fscanf isoc99_vfscanf isoc99_sscanf \
40 isoc99_vsscanf \
41 psiginfo
43 install-others = $(inst_includedir)/bits/stdio_lim.h
45 include ../Makeconfig
47 aux := errlist siglist printf-parsemb printf-parsewc fxprintf
48 distribute := _itoa.h _itowa.h _i18n_number.h \
49 printf-parse.h stdio_lim.h.in tst-unbputc.sh tst-printf.sh
51 tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
52 temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
53 xbug errnobug \
54 bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 bug13 \
55 tfformat tiformat tllformat tstdiomisc tst-printfsz tst-wc-printf \
56 scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
57 scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
58 tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
59 tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
60 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
61 tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
62 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
63 scanf16 scanf17 tst-setvbuf1
65 test-srcs = tst-unbputc tst-printf
67 include ../Rules
69 $(inst_includedir)/bits/stdio_lim.h: $(common-objpfx)bits/stdio_lim.h $(+force)
70 $(do-install)
72 ifeq ($(cross-compiling),no)
73 .PHONY: do-tst-unbputc do-tst-printf
74 tests: do-tst-unbputc do-tst-printf
76 do-tst-unbputc: $(objpfx)tst-unbputc.out
77 $(objpfx)tst-unbputc.out: $(objpfx)tst-unbputc tst-unbputc.sh
78 $(SHELL) -e tst-unbputc.sh $(common-objpfx) '$(run-program-prefix)'
80 do-tst-printf: $(objpfx)tst-printf.out
81 $(objpfx)tst-printf.out: $(objpfx)tst-printf tst-printf.sh
82 $(SHELL) -e tst-printf.sh $(common-objpfx) '$(run-program-prefix)'
83 endif
85 CFLAGS-vfprintf.c = -Wno-uninitialized
86 CFLAGS-vfwprintf.c = -Wno-uninitialized
87 CFLAGS-tst-printf.c = -Wno-format
88 CFLAGS-tstdiomisc.c = -Wno-format
89 CFLAGS-scanf4.c = -Wno-format
90 CFLAGS-scanf7.c = -Wno-format
91 CFLAGS-tst-printfsz.c = -Wno-format
93 CFLAGS-tmpfile.c = -fexceptions
94 CFLAGS-tmpfile64.c = -fexceptions
95 CFLAGS-tempname.c = -fexceptions
96 CFLAGS-psignal.c = -fexceptions
97 CFLAGS-vprintf.c = -fexceptions
98 CFLAGS-cuserid.c = -fexceptions
100 CFLAGS-vfprintf.c += $(exceptions)
101 CFLAGS-fprintf.c += $(exceptions)
102 CFLAGS-printf.c += $(exceptions)
103 CFLAGS-vfwprintf.c += $(exceptions)
104 CFLAGS-vfscanf.c += $(exceptions)
105 CFLAGS-vfwscanf.c += $(exceptions)
106 CFLAGS-fscanf.c += $(exceptions)
107 CFLAGS-scanf.c += $(exceptions)
108 CFLAGS-isoc99_vfscanf.c += $(exceptions)
109 CFLAGS-isoc99_vscanf.c += $(exceptions)
110 CFLAGS-isoc99_fscanf.c += $(exceptions)
111 CFLAGS-isoc99_scanf.c += $(exceptions)
112 CFLAGS-errlist.c = $(fno-unit-at-a-time)
113 CFLAGS-siglist.c = $(fno-unit-at-a-time)
115 # The following is a hack since we must compile scanf1{5,7}.c without any
116 # GNU extension. The latter are needed, though, when internal headers
117 # are used. So made sure we see the installed headers first.
118 CFLAGS-scanf15.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
119 -I../wctype
120 CFLAGS-scanf17.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
121 -I../wctype
123 # We know the test has a format string problem.
124 CFLAGS-tst-sprintf.c = -Wno-format
125 tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
126 tst-swprintf-ENV = LOCPATH=$(common-objpfx)localedata
127 test-vfprintf-ENV = LOCPATH=$(common-objpfx)localedata
128 scanf13-ENV = LOCPATH=$(common-objpfx)localedata
129 bug14-ENV = LOCPATH=$(common-objpfx)localedata
130 bug15-ENV = LOCPATH=$(common-objpfx)localedata
132 ifneq (,$(filter %REENTRANT, $(defines)))
133 CPPFLAGS += -D_IO_MTSAFE_IO
134 endif
136 $(objpfx)tst-setvbuf1.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1
137 $(built-program-cmd) > $@ 2>&1
138 cmp tst-setvbuf1.expect $@