wcsmbs: Re-flow and sort routines, tests variables in Makefile
[glibc.git] / wcsmbs / Makefile
blob4aa43252d7c5deae9861780b3200cf1c2753acdd
1 # Copyright (C) 1995-2023 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 # <https://www.gnu.org/licenses/>.
19 # Sub-makefile for wcsmbs portion of the library.
21 subdir := wcsmbs
23 include ../Makeconfig
25 headers := wchar.h bits/wchar.h bits/wchar2.h bits/wchar2-decl.h \
26 bits/wchar-ldbl.h uchar.h bits/types/__mbstate_t.h \
27 bits/types/mbstate_t.h bits/types/wint_t.h
29 routines := \
30 btowc \
31 c16rtomb \
32 c32rtomb \
33 c8rtomb \
34 isoc23_fwscanf \
35 isoc23_swscanf \
36 isoc23_vfwscanf \
37 isoc23_vswscanf \
38 isoc23_vwscanf \
39 isoc23_wscanf \
40 isoc99_fwscanf \
41 isoc99_swscanf \
42 isoc99_vfwscanf \
43 isoc99_vswscanf \
44 isoc99_vwscanf \
45 isoc99_wscanf \
46 mbrlen \
47 mbrtoc16 \
48 mbrtoc32 \
49 mbrtoc8 \
50 mbrtowc \
51 mbsinit \
52 mbsnrtowcs \
53 mbsrtowcs \
54 mbsrtowcs_l \
55 wcpcpy \
56 wcpncpy \
57 wcrtomb \
58 wcscasecmp \
59 wcscasecmp_l \
60 wcscat \
61 wcschr \
62 wcschrnul \
63 wcscmp \
64 wcscoll \
65 wcscoll_l \
66 wcscpy \
67 wcscspn \
68 wcsdup \
69 wcslen \
70 wcsmbsload \
71 wcsncase \
72 wcsncase_l \
73 wcsncat \
74 wcsncmp \
75 wcsncpy \
76 wcsnlen \
77 wcsnrtombs \
78 wcspbrk \
79 wcsrchr \
80 wcsrtombs \
81 wcsspn \
82 wcsstr \
83 wcstod \
84 wcstod_l \
85 wcstod_nan \
86 wcstof \
87 wcstof_l \
88 wcstof_nan \
89 wcstok \
90 wcstol \
91 wcstol_l \
92 wcstold \
93 wcstold_l \
94 wcstold_nan \
95 wcstoll \
96 wcstoll_l \
97 wcstoul \
98 wcstoul_l \
99 wcstoull \
100 wcstoull_l \
101 wcswidth \
102 wcsxfrm \
103 wcsxfrm_l \
104 wctob \
105 wcwidth \
106 wmemchr \
107 wmemcmp \
108 wmemcpy \
109 wmemmove \
110 wmempcpy \
111 wmemset \
112 # routines
114 tests := \
115 test-c8rtomb \
116 test-char-types \
117 test-mbrtoc8 \
118 test-wcpcpy \
119 test-wcpncpy \
120 test-wcscat \
121 test-wcschr \
122 test-wcschrnul \
123 test-wcscmp \
124 test-wcscpy \
125 test-wcscspn \
126 test-wcslen \
127 test-wcsncat \
128 test-wcsncmp \
129 test-wcsncpy \
130 test-wcsnlen \
131 test-wcspbrk \
132 test-wcsrchr \
133 test-wcsspn \
134 test-wmemchr \
135 test-wmemcmp \
136 test-wmemset \
137 tst-btowc \
138 tst-c16-surrogate \
139 tst-c16c32-1 \
140 tst-c32-state \
141 tst-fgetwc-after-eof \
142 tst-mbrtowc \
143 tst-mbrtowc2 \
144 tst-mbsrtowcs \
145 tst-mbstowcs \
146 tst-wchar-h \
147 tst-wcpncpy \
148 tst-wcrtomb \
149 tst-wcsnlen \
150 tst-wcstod-nan-locale \
151 tst-wcstod-nan-sign \
152 tst-wcstod-round \
153 tst-wcstof \
154 tst-wcstol-binary-c11 \
155 tst-wcstol-binary-c2x \
156 tst-wcstol-binary-gnu11 \
157 tst-wcstol-binary-gnu2x \
158 tst-wcstol-locale \
159 tst-wprintf-binary \
160 tst-wscanf-binary-c11 \
161 tst-wscanf-binary-c2x \
162 tst-wscanf-binary-gnu11 \
163 tst-wscanf-binary-gnu89 \
164 wcsatcliff \
165 wcsmbs-tst1 \
166 # tests
168 include ../Rules
170 ifeq ($(run-built-tests),yes)
171 LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 hr_HR.ISO-8859-2 \
172 ja_JP.EUC-JP zh_TW.EUC-TW tr_TR.UTF-8 tr_TR.ISO-8859-9 zh_HK.BIG5-HKSCS
173 include ../gen-locales.mk
175 $(objpfx)tst-btowc.out: $(gen-locales)
176 $(objpfx)tst-c16c32-1.out: $(gen-locales)
177 $(objpfx)tst-mbrtowc.out: $(gen-locales)
178 $(objpfx)tst-mbrtowc2.out: $(gen-locales)
179 $(objpfx)tst-wcrtomb.out: $(gen-locales)
180 $(objpfx)wcsmbs-tst1.out: $(gen-locales)
181 $(objpfx)tst-wcstol-locale.out: $(gen-locales)
182 $(objpfx)tst-wcstod-nan-locale.out: $(gen-locales)
183 $(objpfx)tst-c16-surrogate.out: $(gen-locales)
184 $(objpfx)tst-c32-state.out: $(gen-locales)
185 $(objpfx)test-c8rtomb.out: $(gen-locales)
186 $(objpfx)test-mbrtoc8.out: $(gen-locales)
187 endif
189 $(objpfx)tst-wcstod-round: $(libm)
191 CFLAGS-wcwidth.c += -I../wctype
192 CFLAGS-wcswidth.c += -I../wctype
194 strtox-CFLAGS = -I../include
195 CFLAGS-wcstol.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
196 CFLAGS-wcstoul.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
197 CFLAGS-wcstoll.c += $(strtox-CFLAGS)
198 CFLAGS-wcstoull.c += $(strtox-CFLAGS)
199 CFLAGS-wcstod.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
200 CFLAGS-wcstold.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
201 CFLAGS-wcstof128.c += $(strtox-CFLAGS)
202 CFLAGS-wcstof.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
203 CFLAGS-wcstol_l.c += $(strtox-CFLAGS)
204 CFLAGS-wcstoul_l.c += $(strtox-CFLAGS)
205 CFLAGS-wcstoll_l.c += $(strtox-CFLAGS)
206 CFLAGS-wcstoull_l.c += $(strtox-CFLAGS)
207 CFLAGS-wcstod_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
208 CFLAGS-wcstold_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
209 CFLAGS-wcstof128_l.c += $(strtox-CFLAGS)
210 CFLAGS-wcstof_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
211 CPPFLAGS-tst-wchar-h.c += -D_FORTIFY_SOURCE=2
213 CFLAGS-wcschr.c += $(config-cflags-wno-ignored-attributes)
214 CFLAGS-wmemchr.c += $(config-cflags-wno-ignored-attributes)
215 CFLAGS-wmemset.c += $(config-cflags-wno-ignored-attributes)
216 CFLAGS-mbrtowc.c += $(config-cflags-wno-ignored-attributes)
217 CFLAGS-wcrtomb.c += $(config-cflags-wno-ignored-attributes)
218 CFLAGS-wcstoll.c += $(config-cflags-wno-ignored-attributes)
219 CFLAGS-wcstoull.c += $(config-cflags-wno-ignored-attributes)
221 CFLAGS-isoc99_wscanf.c += -fexceptions
222 CFLAGS-isoc99_fwscanf.c += -fexceptions
223 CFLAGS-isoc99_vwscanf.c += -fexceptions
224 CFLAGS-isoc99_vfwscanf.c += -fexceptions
225 CFLAGS-isoc23_wscanf.c += -fexceptions
226 CFLAGS-isoc23_fwscanf.c += -fexceptions
227 CFLAGS-isoc23_vwscanf.c += -fexceptions
228 CFLAGS-isoc23_vfwscanf.c += -fexceptions
230 CPPFLAGS += $(libio-mtsafe)
232 # We need to find the default version of strtold_l in stdlib.
233 CPPFLAGS-wcstold_l.c += -I../stdlib
235 $(objpfx)tst-wcstod-nan-locale: $(libm)
236 $(objpfx)tst-wcstod-nan-sign: $(libm)
238 # Some versions of GCC supported for building glibc do not support -std=c2x
239 # or -std=gnu2x, so the tests for those versions use -std=c11 and -std=gnu11
240 # and then _ISOC2X_SOURCE is defined in the test as needed.
241 CFLAGS-tst-wcstol-binary-c11.c += -std=c11
242 CFLAGS-tst-wcstol-binary-c2x.c += -std=c11
243 CFLAGS-tst-wcstol-binary-gnu11.c += -std=gnu11
244 CFLAGS-tst-wcstol-binary-gnu2x.c += -std=gnu11
245 CFLAGS-tst-wscanf-binary-c11.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
246 CFLAGS-tst-wscanf-binary-c2x.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
247 CFLAGS-tst-wscanf-binary-gnu11.c += -std=gnu11 -DOBJPFX=\"$(objpfx)\"
248 CFLAGS-tst-wscanf-binary-gnu89.c += -std=gnu89 -DOBJPFX=\"$(objpfx)\"