ldbl-128ibm-compat: Compiler flags for stdio functions
[glibc.git] / sysdeps / ieee754 / ldbl-128ibm-compat / Makefile
blob8f6a09091a121c21cc5ec5f86ab8cc60d1c07b8b
1 ifeq ($(subdir),libio)
2 ldbl-extra-routines += fwscanf \
3 swscanf \
4 wscanf \
5 vswscanf \
6 vwscanf
7 endif
9 ifeq ($(subdir),wcsmbs)
10 ldbl-extra-routines += isoc99_fwscanf \
11 isoc99_swscanf \
12 isoc99_wscanf \
13 isoc99_vfwscanf \
14 isoc99_vswscanf \
15 isoc99_vwscanf
17 tests-internal += test-wcstold-ibm128 test-wcstold-ieee128
18 CFLAGS-test-wcstold-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
19 CFLAGS-test-wcstold-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
21 $(objpfx)test-wcstold-ieee128: gnulib-tests += $(f128-loader-link)
22 endif
24 ifeq ($(subdir),stdio-common)
25 ldbl-extra-routines += printf_size \
26 asprintf \
27 dprintf \
28 fprintf \
29 printf \
30 snprintf \
31 sprintf \
32 vasprintf \
33 vdprintf \
34 vfprintf \
35 vprintf \
36 vsnprintf \
37 vsprintf \
38 fwprintf \
39 swprintf \
40 wprintf \
41 vfwprintf \
42 vswprintf \
43 vwprintf \
44 fscanf \
45 scanf \
46 sscanf \
47 vfscanf \
48 vscanf \
49 vsscanf \
50 vfwscanf \
51 obprintf \
52 obstack_chk \
53 vobstack_chk \
54 isoc99_fscanf \
55 isoc99_scanf \
56 isoc99_sscanf \
57 isoc99_vfscanf \
58 isoc99_vscanf \
59 isoc99_vsscanf
61 # Printing long double values with IEEE binary128 format reuses part
62 # of the internal float128 implementation (__printf_fp, __printf_fphex,
63 # and __float128 variables and union members). Likewise, reading these
64 # values reuses __strtof128_internal. Thus, the compilation of the
65 # following functions, must have -mfloat128 and -mabi=ibmlongdouble
66 # passed to the compiler.
67 CFLAGS-vfprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
68 CFLAGS-vfwprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
69 CFLAGS-vfscanf-internal.c += -mfloat128 -mabi=ibmlongdouble
70 CFLAGS-vfwscanf-internal.c += -mfloat128 -mabi=ibmlongdouble
72 # Basic tests for the implementation of long double with IEEE binary128
73 # format and for the related redirections in installed headers.
74 tests-internal += test-printf-ieee128 test-printf-ibm128
75 CFLAGS-test-printf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
76 CFLAGS-test-printf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
78 tests-internal += test-wprintf-ieee128 test-wprintf-ibm128
79 CFLAGS-test-wprintf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
80 CFLAGS-test-wprintf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
82 tests-internal += test-obstack-ieee128 test-obstack-ibm128
83 CFLAGS-test-obstack-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
84 CFLAGS-test-obstack-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
86 tests-internal += test-obstack-chk-ieee128 test-obstack-chk-ibm128
87 CFLAGS-test-obstack-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
88 CFLAGS-test-obstack-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
90 tests-internal += test-scanf-ieee128 test-scanf-ibm128
91 CFLAGS-test-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
92 CFLAGS-test-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
94 $(objpfx)test-scanf-ieee128: gnulib-tests += $(f128-loader-link)
96 tests-internal += test-wscanf-ieee128 test-wscanf-ibm128
97 CFLAGS-test-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
98 CFLAGS-test-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
100 $(objpfx)test-wscanf-ieee128: gnulib-tests += $(f128-loader-link)
102 tests-internal += test-isoc99-scanf-ieee128 test-isoc99-scanf-ibm128
103 CFLAGS-test-isoc99-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c99
104 CFLAGS-test-isoc99-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c99
106 $(objpfx)test-isoc99-scanf-ieee128: gnulib-tests += $(f128-loader-link)
108 tests-internal += test-isoc99-wscanf-ieee128 test-isoc99-wscanf-ibm128
109 CFLAGS-test-isoc99-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c99
110 CFLAGS-test-isoc99-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c99
112 $(objpfx)test-isoc99-wscanf-ieee128: gnulib-tests += $(f128-loader-link)
114 ifeq ($(run-built-tests),yes)
115 tests-special += $(objpfx)test-scanf-ieee128.out
116 tests-special += $(objpfx)test-scanf-ibm128.out
118 tests-special += $(objpfx)test-wscanf-ieee128.out
119 tests-special += $(objpfx)test-wscanf-ibm128.out
121 tests-special += $(objpfx)test-isoc99-scanf-ieee128.out
122 tests-special += $(objpfx)test-isoc99-scanf-ibm128.out
124 tests-special += $(objpfx)test-isoc99-wscanf-ieee128.out
125 tests-special += $(objpfx)test-isoc99-wscanf-ibm128.out
126 endif
128 $(objpfx)test-scanf-ieee128.out: \
129 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
130 $(objpfx)test-scanf-ieee128
131 $(SHELL) $^ '$(test-program-prefix)' $@; \
132 $(evaluate-test)
134 $(objpfx)test-scanf-ibm128.out: \
135 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
136 $(objpfx)test-scanf-ibm128
137 $(SHELL) $^ '$(test-program-prefix)' $@; \
138 $(evaluate-test)
140 $(objpfx)test-wscanf-ieee128.out: \
141 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
142 $(objpfx)test-wscanf-ieee128
143 $(SHELL) $^ '$(test-program-prefix)' $@; \
144 $(evaluate-test)
146 $(objpfx)test-wscanf-ibm128.out: \
147 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
148 $(objpfx)test-wscanf-ibm128
149 $(SHELL) $^ '$(test-program-prefix)' $@; \
150 $(evaluate-test)
152 $(objpfx)test-isoc99-scanf-ieee128.out: \
153 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
154 $(objpfx)test-isoc99-scanf-ieee128
155 $(SHELL) $^ '$(test-program-prefix)' $@; \
156 $(evaluate-test)
158 $(objpfx)test-isoc99-scanf-ibm128.out: \
159 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
160 $(objpfx)test-isoc99-scanf-ibm128
161 $(SHELL) $^ '$(test-program-prefix)' $@; \
162 $(evaluate-test)
164 $(objpfx)test-isoc99-wscanf-ieee128.out: \
165 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
166 $(objpfx)test-isoc99-wscanf-ieee128
167 $(SHELL) $^ '$(test-program-prefix)' $@; \
168 $(evaluate-test)
170 $(objpfx)test-isoc99-wscanf-ibm128.out: \
171 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
172 $(objpfx)test-isoc99-wscanf-ibm128
173 $(SHELL) $^ '$(test-program-prefix)' $@; \
174 $(evaluate-test)
176 tests-internal += test-printf-size-ieee128 test-printf-size-ibm128
177 CFLAGS-test-printf-size-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
178 CFLAGS-test-printf-size-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
180 ifeq ($(run-built-tests),yes)
181 tests-special += $(objpfx)test-printf-size-ieee128.out
182 tests-special += $(objpfx)test-printf-size-ibm128.out
183 endif
185 $(objpfx)test-printf-size-ieee128.out: \
186 tst-printfsz-islongdouble.sh $(objpfx)test-printf-size-ieee128
187 $(SHELL) $^ '$(test-program-prefix)' $@; \
188 $(evaluate-test)
190 $(objpfx)test-printf-size-ibm128.out: \
191 tst-printfsz-islongdouble.sh $(objpfx)test-printf-size-ibm128
192 $(SHELL) $^ '$(test-program-prefix)' $@; \
193 $(evaluate-test)
194 endif
196 ifeq ($(subdir),debug)
197 ldbl-extra-routines += asprintf_chk \
198 dprintf_chk \
199 fprintf_chk \
200 printf_chk \
201 snprintf_chk \
202 sprintf_chk \
203 vasprintf_chk \
204 vdprintf_chk \
205 vfprintf_chk \
206 vprintf_chk \
207 vsnprintf_chk \
208 vsprintf_chk \
209 fwprintf_chk \
210 swprintf_chk \
211 wprintf_chk \
212 vfwprintf_chk \
213 vswprintf_chk \
214 vwprintf_chk
216 tests-internal += test-printf-chk-ieee128 test-printf-chk-ibm128
217 CFLAGS-test-printf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
218 CFLAGS-test-printf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
220 tests-internal += test-printf-chk-redir-ieee128 test-printf-chk-redir-ibm128
221 CFLAGS-test-printf-chk-redir-ieee128.c += -mfloat128 -mabi=ieeelongdouble \
222 -Wno-psabi -Wno-unused-result
223 CFLAGS-test-printf-chk-redir-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
224 -Wno-unused-result
226 tests-internal += test-wprintf-chk-ieee128 test-wprintf-chk-ibm128
227 CFLAGS-test-wprintf-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
228 CFLAGS-test-wprintf-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
230 tests-internal += test-wprintf-chk-redir-ieee128 test-wprintf-chk-redir-ibm128
231 CFLAGS-test-wprintf-chk-redir-ieee128.c += -mfloat128 -mabi=ieeelongdouble \
232 -Wno-psabi -Wno-unused-result
233 CFLAGS-test-wprintf-chk-redir-ibm128.c += -mabi=ibmlongdouble -Wno-psabi \
234 -Wno-unused-result
235 endif
237 ifeq ($(subdir),argp)
238 ldbl-extra-routines += argp-help
240 $(objpfx)tst-ieee128-argp.c: tst-ldbl-argp.c
241 cp $< $@
243 $(objpfx)tst-ibm128-argp.c: tst-ldbl-argp.c
244 cp $< $@
246 tests-internal += tst-ieee128-argp tst-ibm128-argp
247 CFLAGS-tst-ieee128-argp.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
248 CFLAGS-tst-ibm128-argp.c += -mabi=ibmlongdouble -Wno-psabi
249 endif
251 ifeq ($(subdir),misc)
252 ldbl-extra-routines += err \
253 error \
254 syslog \
255 qefgcvt \
256 qefgcvt_r
258 CFLAGS-ieee128-qefgcvt.c += -mabi=ieeelongdouble -Wno-psabi -mno-gnu-attribute
259 CFLAGS-ieee128-qefgcvt_r.c += -mabi=ieeelongdouble -Wno-psabi -mno-gnu-attribute
261 tests-internal += tst-ibm128-warn tst-ieee128-warn
262 tests-internal += tst-ibm128-error tst-ieee128-error
263 tests-internal += tst-ibm128-efgcvt tst-ieee128-efgcvt
265 $(objpfx)tst-ieee128-efgcvt: gnulib-tests += $(f128-loader-link)
267 $(objpfx)tst-ibm128-%.c: tst-ldbl-%.c
268 cp $< $@
270 $(objpfx)tst-ieee128-%.c: tst-ldbl-%.c
271 cp $< $@
273 CFLAGS-tst-ibm128-warn.c += -mabi=ibmlongdouble -Wno-psabi
274 CFLAGS-tst-ibm128-error.c += -mabi=ibmlongdouble -Wno-psabi
275 CFLAGS-tst-ibm128-efgcvt.c += -mabi=ibmlongdouble -Wno-psabi
277 CFLAGS-tst-ieee128-warn.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
278 CFLAGS-tst-ieee128-error.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
279 CFLAGS-tst-ieee128-efgcvt.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
281 tests-container += test-syslog-ieee128 test-syslog-ibm128
282 CFLAGS-test-syslog-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
283 CFLAGS-test-syslog-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
285 tests-container += test-syslog-chk-ieee128 test-syslog-chk-ibm128
286 CFLAGS-test-syslog-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
287 CFLAGS-test-syslog-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
288 endif
290 ifeq ($(subdir),stdlib)
291 ldbl-extra-routines += strfmon strfmon_l
293 # Printing long double values with IEEE binary128 format reuses part
294 # of the internal float128 implementation (__printf_fp, __printf_fphex,
295 # and __float128 variables and union members). Thus, the compilation of
296 # the following files, must have -mfloat128 passed to the compiler.
297 # Also, guarantee that they are compiled in IBM long double mode.
298 CFLAGS-strfmon.c += -mfloat128 -mabi=ibmlongdouble
299 CFLAGS-strfmon_l.c += -mfloat128 -mabi=ibmlongdouble
301 tests-internal += test-strfmon-ibm128 test-strfmon-ieee128
302 CFLAGS-test-strfmon-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
303 CFLAGS-test-strfmon-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
304 $(objpfx)tst-strfmon-ibm128.out: $(gen-locales)
305 $(objpfx)tst-strfmon-ieee128.out: $(gen-locales)
307 tests-internal += test-strfrom-ibm128 test-strfrom-ieee128
308 CFLAGS-test-strfrom-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
309 CFLAGS-test-strfrom-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
311 $(objpfx)test-strfrom-ieee128: gnulib-tests += $(f128-loader-link)
312 endif
314 # Add IEEE binary128 files as make targets.
315 routines += $(foreach r,$(ldbl-extra-routines),ieee128-$(r))
317 # On powerpc64le, the routines responsible for converting between long
318 # double and string (e.g.: printf, scanf, strtold, strfroml) default to
319 # IBM long double mode. When support for TS 18661-3 was added, several
320 # internal functions were modified so that they could also handle
321 # floating-point variables with IEEE binary128 format, but as an
322 # additional type, _Float128.
324 # The following rule ensures that the string conversion routines will
325 # always be built in IBM long double mode, with additional support for
326 # IEEE binary128, through the use of -mabi=ibmlongdouble and -mfloat128.
327 ldbl-ibm128-files := $(objpfx)test-%-ibm128^ \
328 $(objpfx)iovdprintf^ \
329 $(objpfx)iovsprintf^ \
330 $(objpfx)iovsscanf^ \
331 $(objpfx)iovswscanf^ \
332 $(objpfx)iovfscanf^ \
333 $(objpfx)iovfwscanf^ \
334 $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)^) \
335 $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)-internal^)
336 obj-suf-foreach = $(foreach suf,$(all-object-suffixes),$(subst ^,$(suf),$(1)))
337 $(call obj-suf-foreach,$(ldbl-ibm128-files)): \
338 sysdep-CFLAGS += -mabi=ibmlongdouble