ldbl-128ibm-compat: enforce ibm128 on compat tests
[glibc.git] / sysdeps / ieee754 / ldbl-128ibm-compat / Makefile
blobd5c3655e69022369534cc7ad2062ed740d16fb67
1 ifeq ($(subdir),libio)
2 ldbl-extra-routines += fwscanf \
3 fwprintf \
4 obprintf \
5 swscanf \
6 swprintf \
7 wscanf \
8 vasprintf \
9 vdprintf \
10 vscanf \
11 vsprintf \
12 vsnprintf \
13 vsscanf \
14 vswprintf \
15 vswscanf \
16 vwprintf \
17 vwscanf \
18 wprintf
19 endif
21 ifeq ($(subdir),wcsmbs)
22 ldbl-extra-routines += isoc99_fwscanf \
23 isoc99_swscanf \
24 isoc99_wscanf \
25 isoc99_vfwscanf \
26 isoc99_vswscanf \
27 isoc99_vwscanf
29 tests-internal += test-wcstold-ibm128 test-wcstold-ieee128
30 CFLAGS-test-wcstold-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
31 CFLAGS-test-wcstold-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
33 $(objpfx)test-wcstold-ieee128: gnulib-tests += $(f128-loader-link)
34 endif
36 ifeq ($(subdir),stdio-common)
37 ldbl-extra-routines += printf_size \
38 asprintf \
39 dprintf \
40 fprintf \
41 printf \
42 snprintf \
43 sprintf \
44 vfprintf \
45 vprintf \
46 vfwprintf \
47 fscanf \
48 scanf \
49 sscanf \
50 vfscanf \
51 vfwscanf \
52 isoc99_fscanf \
53 isoc99_scanf \
54 isoc99_sscanf \
55 isoc99_vfscanf \
56 isoc99_vscanf \
57 isoc99_vsscanf
59 # Printing long double values with IEEE binary128 format reuses part
60 # of the internal float128 implementation (__printf_fp, __printf_fphex,
61 # and __float128 variables and union members). Likewise, reading these
62 # values reuses __strtof128_internal. Thus, the compilation of the
63 # following functions, must have -mfloat128 and -mabi=ibmlongdouble
64 # passed to the compiler.
65 CFLAGS-vfprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
66 CFLAGS-vfwprintf-internal.c += -mfloat128 -mabi=ibmlongdouble
67 CFLAGS-vfscanf-internal.c += -mfloat128 -mabi=ibmlongdouble
68 CFLAGS-vfwscanf-internal.c += -mfloat128 -mabi=ibmlongdouble
70 # Basic tests for the implementation of long double with IEEE binary128
71 # format and for the related redirections in installed headers.
72 tests-internal += test-printf-ieee128 test-printf-ibm128
73 CFLAGS-test-printf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
74 CFLAGS-test-printf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
76 tests-internal += test-wprintf-ieee128 test-wprintf-ibm128
77 CFLAGS-test-wprintf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
78 CFLAGS-test-wprintf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
80 tests-internal += test-obstack-ieee128 test-obstack-ibm128
81 CFLAGS-test-obstack-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
82 CFLAGS-test-obstack-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
84 tests-internal += test-obstack-chk-ieee128 test-obstack-chk-ibm128
85 CFLAGS-test-obstack-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
86 CFLAGS-test-obstack-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
88 tests-internal += test-scanf-ieee128 test-scanf-ibm128
89 CFLAGS-test-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
90 CFLAGS-test-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
92 $(objpfx)test-scanf-ieee128: gnulib-tests += $(f128-loader-link)
94 tests-internal += test-wscanf-ieee128 test-wscanf-ibm128
95 CFLAGS-test-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
96 CFLAGS-test-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c89 -D_GNU_SOURCE
98 $(objpfx)test-wscanf-ieee128: gnulib-tests += $(f128-loader-link)
100 tests-internal += test-isoc99-scanf-ieee128 test-isoc99-scanf-ibm128
101 CFLAGS-test-isoc99-scanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c99
102 CFLAGS-test-isoc99-scanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c99
104 $(objpfx)test-isoc99-scanf-ieee128: gnulib-tests += $(f128-loader-link)
106 tests-internal += test-isoc99-wscanf-ieee128 test-isoc99-wscanf-ibm128
107 CFLAGS-test-isoc99-wscanf-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi -std=c99
108 CFLAGS-test-isoc99-wscanf-ibm128.c += -mabi=ibmlongdouble -Wno-psabi -std=c99
110 $(objpfx)test-isoc99-wscanf-ieee128: gnulib-tests += $(f128-loader-link)
112 ifeq ($(run-built-tests),yes)
113 tests-special += $(objpfx)test-scanf-ieee128.out
114 tests-special += $(objpfx)test-scanf-ibm128.out
116 tests-special += $(objpfx)test-wscanf-ieee128.out
117 tests-special += $(objpfx)test-wscanf-ibm128.out
119 tests-special += $(objpfx)test-isoc99-scanf-ieee128.out
120 tests-special += $(objpfx)test-isoc99-scanf-ibm128.out
122 tests-special += $(objpfx)test-isoc99-wscanf-ieee128.out
123 tests-special += $(objpfx)test-isoc99-wscanf-ibm128.out
124 endif
126 $(objpfx)test-scanf-ieee128.out: \
127 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
128 $(objpfx)test-scanf-ieee128
129 $(SHELL) $^ '$(test-program-prefix)' $@; \
130 $(evaluate-test)
132 $(objpfx)test-scanf-ibm128.out: \
133 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
134 $(objpfx)test-scanf-ibm128
135 $(SHELL) $^ '$(test-program-prefix)' $@; \
136 $(evaluate-test)
138 $(objpfx)test-wscanf-ieee128.out: \
139 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
140 $(objpfx)test-wscanf-ieee128
141 $(SHELL) $^ '$(test-program-prefix)' $@; \
142 $(evaluate-test)
144 $(objpfx)test-wscanf-ibm128.out: \
145 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
146 $(objpfx)test-wscanf-ibm128
147 $(SHELL) $^ '$(test-program-prefix)' $@; \
148 $(evaluate-test)
150 $(objpfx)test-isoc99-scanf-ieee128.out: \
151 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
152 $(objpfx)test-isoc99-scanf-ieee128
153 $(SHELL) $^ '$(test-program-prefix)' $@; \
154 $(evaluate-test)
156 $(objpfx)test-isoc99-scanf-ibm128.out: \
157 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
158 $(objpfx)test-isoc99-scanf-ibm128
159 $(SHELL) $^ '$(test-program-prefix)' $@; \
160 $(evaluate-test)
162 $(objpfx)test-isoc99-wscanf-ieee128.out: \
163 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
164 $(objpfx)test-isoc99-wscanf-ieee128
165 $(SHELL) $^ '$(test-program-prefix)' $@; \
166 $(evaluate-test)
168 $(objpfx)test-isoc99-wscanf-ibm128.out: \
169 ../sysdeps/ieee754/ldbl-128ibm-compat/test-scanf-ldbl-compat.sh \
170 $(objpfx)test-isoc99-wscanf-ibm128
171 $(SHELL) $^ '$(test-program-prefix)' $@; \
172 $(evaluate-test)
174 tests-internal += test-printf-size-ieee128 test-printf-size-ibm128
175 CFLAGS-test-printf-size-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
176 CFLAGS-test-printf-size-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
178 ifeq ($(run-built-tests),yes)
179 tests-special += $(objpfx)test-printf-size-ieee128.out
180 tests-special += $(objpfx)test-printf-size-ibm128.out
181 endif
183 $(objpfx)test-printf-size-ieee128.out: \
184 tst-printfsz-islongdouble.sh $(objpfx)test-printf-size-ieee128
185 $(SHELL) $^ '$(test-program-prefix)' $@; \
186 $(evaluate-test)
188 $(objpfx)test-printf-size-ibm128.out: \
189 tst-printfsz-islongdouble.sh $(objpfx)test-printf-size-ibm128
190 $(SHELL) $^ '$(test-program-prefix)' $@; \
191 $(evaluate-test)
192 endif
194 ifeq ($(subdir),debug)
195 ldbl-extra-routines += asprintf_chk \
196 dprintf_chk \
197 fprintf_chk \
198 printf_chk \
199 snprintf_chk \
200 sprintf_chk \
201 vasprintf_chk \
202 vdprintf_chk \
203 vfprintf_chk \
204 vprintf_chk \
205 vsnprintf_chk \
206 vsprintf_chk \
207 fwprintf_chk \
208 swprintf_chk \
209 wprintf_chk \
210 vfwprintf_chk \
211 vswprintf_chk \
212 vwprintf_chk \
213 obstack_chk \
214 vobstack_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 # Remove -mlong-double-128 because it does not work correctly with
262 # -mabi=ibmlongdoule in some GCC versions, e.g. GCC 7.
263 $(foreach o,$(all-object-suffixes),$(objpfx)ieee128-qefgcvt$(o)): \
264 sysdep-CFLAGS := $(filter-out -mlong-double-128, $(sysdep-CFLAGS))
265 $(foreach o,$(all-object-suffixes),$(objpfx)ieee128-qefgcvt_r$(o)): \
266 sysdep-CFLAGS := $(filter-out -mlong-double-128, $(sysdep-CFLAGS))
268 tests-internal += tst-ibm128-warn tst-ieee128-warn
269 tests-internal += tst-ibm128-error tst-ieee128-error
270 tests-internal += tst-ibm128-efgcvt tst-ieee128-efgcvt
272 $(objpfx)tst-ieee128-efgcvt: gnulib-tests += $(f128-loader-link)
274 $(objpfx)tst-ibm128-%.c: tst-ldbl-%.c
275 cp $< $@
277 $(objpfx)tst-ieee128-%.c: tst-ldbl-%.c
278 cp $< $@
280 CFLAGS-tst-ibm128-warn.c += -mabi=ibmlongdouble -Wno-psabi
281 CFLAGS-tst-ibm128-error.c += -mabi=ibmlongdouble -Wno-psabi
282 CFLAGS-tst-ibm128-efgcvt.c += -mabi=ibmlongdouble -Wno-psabi
284 CFLAGS-tst-ieee128-warn.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
285 CFLAGS-tst-ieee128-error.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
286 CFLAGS-tst-ieee128-efgcvt.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
288 tests-container += test-syslog-ieee128 test-syslog-ibm128
289 CFLAGS-test-syslog-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
290 CFLAGS-test-syslog-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
292 tests-container += test-syslog-chk-ieee128 test-syslog-chk-ibm128
293 CFLAGS-test-syslog-chk-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
294 CFLAGS-test-syslog-chk-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
295 endif
297 ifeq ($(subdir),stdlib)
298 ldbl-extra-routines += strfmon strfmon_l
300 # Printing long double values with IEEE binary128 format reuses part
301 # of the internal float128 implementation (__printf_fp, __printf_fphex,
302 # and __float128 variables and union members). Thus, the compilation of
303 # the following files, must have -mfloat128 passed to the compiler.
304 # Also, guarantee that they are compiled in IBM long double mode.
305 CFLAGS-strfmon.c += -mfloat128 -mabi=ibmlongdouble
306 CFLAGS-strfmon_l.c += -mfloat128 -mabi=ibmlongdouble
308 tests-internal += test-strfmon-ibm128 test-strfmon-ieee128
309 CFLAGS-test-strfmon-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
310 CFLAGS-test-strfmon-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
311 $(objpfx)tst-strfmon-ibm128.out: $(gen-locales)
312 $(objpfx)tst-strfmon-ieee128.out: $(gen-locales)
314 tests-internal += test-strfrom-ibm128 test-strfrom-ieee128
315 CFLAGS-test-strfrom-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
316 CFLAGS-test-strfrom-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
318 $(objpfx)test-strfrom-ieee128: gnulib-tests += $(f128-loader-link)
319 endif
321 ifeq ($(subdir),math)
322 # The totalorder{,mag} compatibility tests were added prior to this
323 # support. Thus, they can only correctly be used with ibm128.
324 CFLAGS-test-ldouble-compat_totalorder.c += -mabi=ibmlongdouble
325 CFLAGS-test-ldouble-compat_totalordermag.c += -mabi=ibmlongdouble
326 CFLAGS-test-ildouble-compat_totalorder.c += -mabi=ibmlongdouble
327 CFLAGS-test-ildouble-compat_totalordermag.c += -mabi=ibmlongdouble
328 endif
330 # Add IEEE binary128 files as make targets.
331 routines += $(foreach r,$(ldbl-extra-routines),ieee128-$(r))
333 # On powerpc64le, the routines responsible for converting between long
334 # double and string (e.g.: printf, scanf, strtold, strfroml) default to
335 # IBM long double mode. When support for TS 18661-3 was added, several
336 # internal functions were modified so that they could also handle
337 # floating-point variables with IEEE binary128 format, but as an
338 # additional type, _Float128.
340 # The following rule ensures that the string conversion routines will
341 # always be built in IBM long double mode, with additional support for
342 # IEEE binary128, through the use of -mabi=ibmlongdouble and -mfloat128.
343 ldbl-ibm128-files := $(objpfx)test-%-ibm128^ \
344 $(objpfx)iovdprintf^ \
345 $(objpfx)iovsprintf^ \
346 $(objpfx)iovsscanf^ \
347 $(objpfx)iovswscanf^ \
348 $(objpfx)iovfscanf^ \
349 $(objpfx)iovfwscanf^ \
350 $(objpfx)mpn2ldbl^ \
351 $(objpfx)ldbl2mpn^ \
352 $(objpfx)strtold_nan^ \
353 $(objpfx)strtold_l^ \
354 $(objpfx)strtold^ \
355 $(objpfx)strfroml^ \
356 $(objpfx)wcstold_nan^ \
357 $(objpfx)wcstold_l^ \
358 $(objpfx)wcstold^ \
359 $(objpfx)printf_fphex^ \
360 $(objpfx)printf_fp^ \
361 $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)^) \
362 $(foreach r,$(ldbl-extra-routines),$(objpfx)$(r)-internal^)
363 obj-suf-foreach = $(foreach suf,$(all-object-suffixes),$(subst ^,$(suf),$(1)))
365 # Remove -mlong-double-128 because it does not work correctly with
366 # -mabi=ibmlongdoule in some GCC versions, e.g. GCC 7.
367 $(call obj-suf-foreach,$(ldbl-ibm128-files)): \
368 sysdep-CFLAGS := $(filter-out -mlong-double-128, $(sysdep-CFLAGS))
370 # Explicitly add -mabi=ibm-long-double to required files.
371 $(call obj-suf-foreach,$(ldbl-ibm128-files)): \
372 sysdep-CFLAGS += -mabi=ibmlongdouble