Add --enable-static-pie configure option to build static PIE [BZ #19574]
[glibc.git] / stdio-common / Makefile
blob7d4ce0b3717609827d74ad95c4e48100e90ec179
1 # Copyright (C) 1991-2017 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 stdio-common.
21 subdir := stdio-common
23 include ../Makeconfig
25 headers := stdio_ext.h printf.h bits/printf-ldbl.h bits/stdio_lim.h
27 routines := \
28 ctermid cuserid \
29 _itoa _itowa itoa-digits itoa-udigits itowa-digits \
30 vfprintf vprintf printf_fp reg-printf printf-prs printf_fphex \
31 reg-modifier reg-type \
32 printf_size fprintf printf snprintf sprintf asprintf dprintf \
33 vfwprintf vfscanf vfwscanf \
34 fscanf scanf sscanf \
35 perror psignal \
36 tmpfile tmpfile64 tmpnam tmpnam_r tempnam tempname \
37 getline getw putw \
38 remove rename renameat \
39 flockfile ftrylockfile funlockfile \
40 isoc99_scanf isoc99_vscanf isoc99_fscanf isoc99_vfscanf isoc99_sscanf \
41 isoc99_vsscanf \
42 psiginfo gentempfd
44 aux := errlist siglist printf-parsemb printf-parsewc fxprintf
46 tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
47 temptest tst-fileno test-fwrite tst-ungetc tst-ferror \
48 xbug errnobug \
49 bug1 bug2 bug3 bug4 bug5 bug6 bug7 bug8 bug9 bug10 bug11 bug12 bug13 \
50 tfformat tiformat tllformat tstdiomisc tst-printfsz tst-wc-printf \
51 scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
52 scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf tst-sscanf \
53 tst-swprintf tst-fseek tst-fmemopen test-vfprintf tst-gets \
54 tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 \
55 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
56 tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
57 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \
58 scanf16 scanf17 tst-setvbuf1 tst-grouping bug23 bug24 \
59 bug-vfprintf-nargs tst-long-dbl-fphex tst-fphex-wide tst-sprintf3 \
60 bug25 tst-printf-round bug23-2 bug23-3 bug23-4 bug26 tst-fmemopen3 \
61 tst-printf-bz18872 tst-vfprintf-width-prec tst-fmemopen4 \
62 tst-vfprintf-user-type \
63 tst-vfprintf-mbs-prec \
65 test-srcs = tst-unbputc tst-printf
67 ifeq ($(run-built-tests),yes)
68 tests-special += $(objpfx)tst-unbputc.out $(objpfx)tst-printf.out \
69 $(objpfx)tst-printf-bz18872-mem.out \
70 $(objpfx)tst-setvbuf1-cmp.out \
71 $(objpfx)tst-vfprintf-width-prec-mem.out
72 generated += tst-printf-bz18872.c tst-printf-bz18872.mtrace \
73 tst-printf-bz18872-mem.out \
74 tst-vfprintf-width-prec.mtrace tst-vfprintf-width-prec-mem.out
75 endif
77 include ../Rules
79 ifeq ($(run-built-tests),yes)
80 LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ISO-8859-1 ja_JP.EUC-JP
81 include ../gen-locales.mk
83 $(objpfx)bug14.out: $(gen-locales)
84 $(objpfx)scanf13.out: $(gen-locales)
85 $(objpfx)test-vfprintf.out: $(gen-locales)
86 $(objpfx)tst-grouping.out: $(gen-locales)
87 $(objpfx)tst-sprintf.out: $(gen-locales)
88 $(objpfx)tst-sscanf.out: $(gen-locales)
89 $(objpfx)tst-swprintf.out: $(gen-locales)
90 $(objpfx)tst-vfprintf-mbs-prec.out: $(gen-locales)
91 endif
93 tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace
94 tst-vfprintf-width-prec-ENV = \
95 MALLOC_TRACE=$(objpfx)tst-vfprintf-width-prec.mtrace
97 $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
98 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' > $@; \
99 $(evaluate-test)
101 $(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
102 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' > $@; \
103 $(evaluate-test)
105 # We generate this source because it requires a printf invocation with
106 # 10K arguments.
107 $(objpfx)tst-printf-bz18872.c: tst-printf-bz18872.sh
108 rm -f $@ && $(BASH) $^ > $@.new && mv $@.new $@
110 $(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
111 $(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
112 $(evaluate-test)
114 CFLAGS-vfprintf.c += -Wno-uninitialized
115 CFLAGS-vfwprintf.c += -Wno-uninitialized
117 CFLAGS-tmpfile.c += -fexceptions
118 CFLAGS-tmpfile64.c += -fexceptions
119 CFLAGS-tempname.c += -fexceptions
120 CFLAGS-psignal.c += -fexceptions
121 CFLAGS-vprintf.c += -fexceptions
122 CFLAGS-cuserid.c += -fexceptions
124 CFLAGS-vfprintf.c += -fexceptions
125 CFLAGS-fprintf.c += -fexceptions
126 CFLAGS-printf.c += -fexceptions
127 CFLAGS-vfwprintf.c += -fexceptions
128 CFLAGS-vfscanf.c += -fexceptions
129 CFLAGS-vfwscanf.c += -fexceptions
130 CFLAGS-fscanf.c += -fexceptions
131 CFLAGS-scanf.c += -fexceptions
132 CFLAGS-isoc99_vfscanf.c += -fexceptions
133 CFLAGS-isoc99_vscanf.c += -fexceptions
134 CFLAGS-isoc99_fscanf.c += -fexceptions
135 CFLAGS-isoc99_scanf.c += -fexceptions
136 CFLAGS-errlist.c += $(fno-unit-at-a-time)
137 CFLAGS-siglist.c += $(fno-unit-at-a-time)
139 # The following is a hack since we must compile scanf1{5,7}.c without any
140 # GNU extension. The latter are needed, though, when internal headers
141 # are used. So made sure we see the installed headers first.
142 CFLAGS-scanf15.c += -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
143 -I../wctype
144 CFLAGS-scanf17.c += -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
145 -I../wctype
147 # tst-gets.c tests a deprecated function.
148 CFLAGS-tst-gets.c += -Wno-deprecated-declarations
150 CPPFLAGS += $(libio-mtsafe)
152 $(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
153 $(test-program-cmd) > $@ 2>&1; \
154 $(evaluate-test)
156 $(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
157 cmp $^ > $@; \
158 $(evaluate-test)
160 $(objpfx)tst-printf-round: $(libm)