Makefile 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. # Copyright (C) 1995-2026 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3. # The GNU C Library is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU Lesser General Public
  5. # License as published by the Free Software Foundation; either
  6. # version 2.1 of the License, or (at your option) any later version.
  7. # The GNU C Library is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. # Lesser General Public License for more details.
  11. # You should have received a copy of the GNU Lesser General Public
  12. # License along with the GNU C Library; if not, see
  13. # <https://www.gnu.org/licenses/>.
  14. #
  15. # Sub-makefile for wcsmbs portion of the library.
  16. #
  17. subdir := wcsmbs
  18. include ../Makeconfig
  19. headers := \
  20. bits/types/__mbstate_t.h \
  21. bits/types/mbstate_t.h \
  22. bits/types/wint_t.h \
  23. bits/wchar-ldbl.h \
  24. bits/wchar.h \
  25. bits/wchar2-decl.h \
  26. bits/wchar2.h \
  27. uchar.h \
  28. wchar.h \
  29. # headers
  30. routines := \
  31. btowc \
  32. c16rtomb \
  33. c32rtomb \
  34. c8rtomb \
  35. isoc23_fwscanf \
  36. isoc23_swscanf \
  37. isoc23_vfwscanf \
  38. isoc23_vswscanf \
  39. isoc23_vwscanf \
  40. isoc23_wscanf \
  41. isoc99_fwscanf \
  42. isoc99_swscanf \
  43. isoc99_vfwscanf \
  44. isoc99_vswscanf \
  45. isoc99_vwscanf \
  46. isoc99_wscanf \
  47. mbrlen \
  48. mbrtoc8 \
  49. mbrtoc16 \
  50. mbrtoc32 \
  51. mbrtowc \
  52. mbsinit \
  53. mbsnrtowcs \
  54. mbsrtowcs \
  55. mbsrtowcs_l \
  56. wcpcpy \
  57. wcpncpy \
  58. wcrtomb \
  59. wcscasecmp \
  60. wcscasecmp_l \
  61. wcscat \
  62. wcschr \
  63. wcschrnul \
  64. wcscmp \
  65. wcscoll \
  66. wcscoll_l \
  67. wcscpy \
  68. wcscspn \
  69. wcsdup \
  70. wcslcat \
  71. wcslcpy \
  72. wcslen \
  73. wcsmbsload \
  74. wcsncase \
  75. wcsncase_l \
  76. wcsncat \
  77. wcsncmp \
  78. wcsncpy \
  79. wcsnlen \
  80. wcsnrtombs \
  81. wcspbrk \
  82. wcsrchr \
  83. wcsrtombs \
  84. wcsspn \
  85. wcsstr \
  86. wcstod \
  87. wcstod_l \
  88. wcstod_nan \
  89. wcstof \
  90. wcstof_l \
  91. wcstof_nan \
  92. wcstok \
  93. wcstol \
  94. wcstol_l \
  95. wcstold \
  96. wcstold_l \
  97. wcstold_nan \
  98. wcstoll \
  99. wcstoll_l \
  100. wcstoul \
  101. wcstoul_l \
  102. wcstoull \
  103. wcstoull_l \
  104. wcswidth \
  105. wcsxfrm \
  106. wcsxfrm_l \
  107. wctob \
  108. wcwidth \
  109. wmemchr \
  110. wmemcmp \
  111. wmemcpy \
  112. wmemmove \
  113. wmempcpy \
  114. wmemset \
  115. # routines
  116. # Exclude fortified routines from being built with _FORTIFY_SOURCE
  117. routines_no_fortify += \
  118. mbsnrtowcs \
  119. mbsrtowcs \
  120. wcpcpy \
  121. wcpncpy \
  122. wcrtomb \
  123. wcscat \
  124. wcscpy \
  125. wcslcat \
  126. wcslcpy \
  127. wcsncat \
  128. wcsncpy \
  129. wcsnrtombs \
  130. wcsrtombs \
  131. wmemcpy \
  132. wmemmove \
  133. wmempcpy \
  134. wmemset \
  135. # routines_no_fortify
  136. tests := \
  137. test-c8rtomb \
  138. test-char-types \
  139. test-mbrtoc8 \
  140. test-wcpcpy \
  141. test-wcpncpy \
  142. test-wcscat \
  143. test-wcschr \
  144. test-wcschrnul \
  145. test-wcscmp \
  146. test-wcscpy \
  147. test-wcscspn \
  148. test-wcsdup \
  149. test-wcslen \
  150. test-wcsncat \
  151. test-wcsncmp \
  152. test-wcsncpy \
  153. test-wcsnlen \
  154. test-wcsnlen-nonarray \
  155. test-wcspbrk \
  156. test-wcsrchr \
  157. test-wcsspn \
  158. test-wcsstr \
  159. test-wmemchr \
  160. test-wmemcmp \
  161. test-wmemset \
  162. tst-btowc \
  163. tst-c16-surrogate \
  164. tst-c16c32-1 \
  165. tst-c32-state \
  166. tst-const \
  167. tst-fgetwc-after-eof \
  168. tst-mbrtowc \
  169. tst-mbrtowc2 \
  170. tst-mbsrtowcs \
  171. tst-mbstowcs \
  172. tst-wchar-h \
  173. tst-wcpncpy \
  174. tst-wcrtomb \
  175. tst-wcslcat \
  176. tst-wcslcat2 \
  177. tst-wcslcpy \
  178. tst-wcslcpy2 \
  179. tst-wcsnlen \
  180. tst-wcstod-nan-locale \
  181. tst-wcstod-nan-sign \
  182. tst-wcstod-round \
  183. tst-wcstof \
  184. tst-wcstol-binary-c11 \
  185. tst-wcstol-binary-c23 \
  186. tst-wcstol-binary-gnu11 \
  187. tst-wcstol-binary-gnu23 \
  188. tst-wcstol-locale \
  189. tst-wprintf-binary \
  190. tst-wprintf-intn \
  191. tst-wscanf-binary-c11 \
  192. tst-wscanf-binary-c23 \
  193. tst-wscanf-binary-gnu11 \
  194. tst-wscanf-binary-gnu89 \
  195. tst-wscanf-intn \
  196. tst-wscanf-to_inpunct \
  197. wcsatcliff \
  198. wcsmbs-tst1 \
  199. # tests
  200. # This test runs for a long time.
  201. xtests += test-wcsncmp-nonarray
  202. include ../Rules
  203. ifeq ($(run-built-tests),yes)
  204. LOCALES := \
  205. de_DE.ISO-8859-1 \
  206. de_DE.UTF-8 \
  207. en_US.ANSI_X3.4-1968 \
  208. fa_IR.UTF-8 \
  209. hr_HR.ISO-8859-2 \
  210. ja_JP.EUC-JP \
  211. tr_TR.ISO-8859-9 \
  212. tr_TR.UTF-8 \
  213. zh_HK.BIG5-HKSCS \
  214. zh_TW.EUC-TW \
  215. # LOCALES
  216. include ../gen-locales.mk
  217. $(objpfx)tst-btowc.out: $(gen-locales)
  218. $(objpfx)tst-c16c32-1.out: $(gen-locales)
  219. $(objpfx)tst-mbrtowc.out: $(gen-locales)
  220. $(objpfx)tst-mbrtowc2.out: $(gen-locales)
  221. $(objpfx)tst-wcrtomb.out: $(gen-locales)
  222. $(objpfx)wcsmbs-tst1.out: $(gen-locales)
  223. $(objpfx)tst-wcstol-locale.out: $(gen-locales)
  224. $(objpfx)tst-wcstod-nan-locale.out: $(gen-locales)
  225. $(objpfx)tst-c16-surrogate.out: $(gen-locales)
  226. $(objpfx)tst-c32-state.out: $(gen-locales)
  227. $(objpfx)test-c8rtomb.out: $(gen-locales)
  228. $(objpfx)test-mbrtoc8.out: $(gen-locales)
  229. $(objpfx)tst-wscanf-to_inpunct.out: $(gen-locales)
  230. endif
  231. $(objpfx)tst-wcstod-round: $(libm)
  232. CFLAGS-wcwidth.c += -I../wctype
  233. CFLAGS-wcswidth.c += -I../wctype
  234. strtox-CFLAGS = -I../include
  235. CFLAGS-wcstol.c += $(strtox-CFLAGS)
  236. CFLAGS-wcstoul.c += $(strtox-CFLAGS)
  237. CFLAGS-wcstoll.c += $(strtox-CFLAGS)
  238. CFLAGS-wcstoull.c += $(strtox-CFLAGS)
  239. CFLAGS-wcstod.c += $(strtox-CFLAGS)
  240. CFLAGS-wcstold.c += $(strtox-CFLAGS)
  241. CFLAGS-wcstof128.c += $(strtox-CFLAGS)
  242. CFLAGS-wcstof.c += $(strtox-CFLAGS)
  243. CFLAGS-wcstol_l.c += $(strtox-CFLAGS)
  244. CFLAGS-wcstoul_l.c += $(strtox-CFLAGS)
  245. CFLAGS-wcstoll_l.c += $(strtox-CFLAGS)
  246. CFLAGS-wcstoull_l.c += $(strtox-CFLAGS)
  247. CFLAGS-wcstod_l.c += $(strtox-CFLAGS)
  248. CFLAGS-wcstold_l.c += $(strtox-CFLAGS)
  249. CFLAGS-wcstof128_l.c += $(strtox-CFLAGS)
  250. CFLAGS-wcstof_l.c += $(strtox-CFLAGS)
  251. CPPFLAGS-tst-wchar-h.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2
  252. CFLAGS-isoc99_wscanf.c += -fexceptions
  253. CFLAGS-isoc99_fwscanf.c += -fexceptions
  254. CFLAGS-isoc99_vwscanf.c += -fexceptions
  255. CFLAGS-isoc99_vfwscanf.c += -fexceptions
  256. CFLAGS-isoc23_wscanf.c += -fexceptions
  257. CFLAGS-isoc23_fwscanf.c += -fexceptions
  258. CFLAGS-isoc23_vwscanf.c += -fexceptions
  259. CFLAGS-isoc23_vfwscanf.c += -fexceptions
  260. CPPFLAGS += $(libio-mtsafe)
  261. # We need to find the default version of strtold_l in stdlib.
  262. CPPFLAGS-wcstold_l.c += -I../stdlib
  263. $(objpfx)tst-wcstod-nan-locale: $(libm)
  264. $(objpfx)tst-wcstod-nan-sign: $(libm)
  265. # Some versions of GCC supported for building glibc do not support -std=c23
  266. # or -std=gnu23 (added in GCC 14), or the older names -std=c2x or -std=gnu2x
  267. # (added in GCC 9), so the tests for those versions use -std=c11 and -std=gnu11
  268. # and then _ISOC23_SOURCE is defined in the test as needed.
  269. CFLAGS-tst-wcstol-binary-c11.c += -std=c11
  270. CFLAGS-tst-wcstol-binary-c23.c += -std=c11
  271. CFLAGS-tst-wcstol-binary-gnu11.c += -std=gnu11
  272. CFLAGS-tst-wcstol-binary-gnu23.c += -std=gnu11
  273. CFLAGS-tst-wscanf-binary-c11.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
  274. CFLAGS-tst-wscanf-binary-c23.c += -std=c11 -DOBJPFX=\"$(objpfx)\"
  275. CFLAGS-tst-wscanf-binary-gnu11.c += -std=gnu11 -DOBJPFX=\"$(objpfx)\"
  276. CFLAGS-tst-wscanf-binary-gnu89.c += -std=gnu89 -DOBJPFX=\"$(objpfx)\"