Makefile 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. # Makefile for intl subdirectory: message handling code from GNU gettext.
  15. subdir = intl
  16. include ../Makeconfig
  17. headers = libintl.h
  18. routines = bindtextdom dcgettext dgettext gettext \
  19. dcigettext dcngettext dngettext ngettext \
  20. finddomain loadmsgcat localealias textdomain
  21. aux = l10nflist explodename plural plural-exp hash-string
  22. multithread-test-srcs := tst-gettext4 tst-gettext5 tst-gettext6
  23. test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset tst-gettext3
  24. ifeq ($(have-thread-library),yes)
  25. test-srcs += $(multithread-test-srcs)
  26. endif
  27. tests = \
  28. tst-gettext-c-utf8 \
  29. tst-ngettext \
  30. # tests
  31. before-compile += $(objpfx)msgs.h
  32. install-others = $(inst_localedir)/locale.alias
  33. generated += msgs.h mtrace-tst-gettext.out tst-gettext.mtrace plural.c
  34. generated-dirs += domaindir localedir
  35. $(objpfx)plural.c: plural.y
  36. $(make-target-directory)
  37. $(BISON) $(BISONFLAGS) $@ $^
  38. $(objpfx)plural.o: $(objpfx)plural.c
  39. ifeq ($(run-built-tests),yes)
  40. ifeq (yes,$(build-shared))
  41. ifneq ($(strip $(MSGFMT)),:)
  42. tests-special += $(objpfx)tst-translit.out $(objpfx)tst-gettext.out \
  43. $(objpfx)tst-gettext2.out $(objpfx)tst-codeset.out \
  44. $(objpfx)tst-gettext3.out
  45. ifeq ($(have-thread-library),yes)
  46. tests-special += $(objpfx)tst-gettext4.out $(objpfx)tst-gettext5.out \
  47. $(objpfx)tst-gettext6.out
  48. endif
  49. ifneq (no,$(PERL))
  50. tests-special += $(objpfx)mtrace-tst-gettext.out
  51. endif
  52. endif
  53. endif
  54. endif
  55. include ../Rules
  56. ifeq ($(run-built-tests),yes)
  57. ifeq (yes,$(build-shared))
  58. # Multiple tests use this data. Create it once to avoid racing and
  59. # spurious test failures.
  60. codeset_mo = $(objpfx)domaindir/de_DE/LC_MESSAGES/codeset.mo
  61. $(codeset_mo): tstcodeset.po
  62. $(make-target-directory)
  63. msgfmt -o $@T $<
  64. mv -f $@T $@
  65. $(objpfx)mtrace-tst-gettext.out: $(objpfx)tst-gettext.out
  66. $(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@; \
  67. $(evaluate-test)
  68. $(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
  69. $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
  70. '$(run-program-env)' '$(test-program-prefix-after-env)' \
  71. $(common-objpfx)intl/ $(objpfx)tst-gettext.mtrace; \
  72. $(evaluate-test)
  73. $(objpfx)tst-translit.out: tst-translit.sh $(objpfx)tst-translit
  74. $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' \
  75. $(common-objpfx)intl/; \
  76. $(evaluate-test)
  77. $(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2
  78. $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
  79. '$(run-program-env)' '$(test-program-prefix-after-env)' \
  80. $(common-objpfx)intl/; \
  81. $(evaluate-test)
  82. $(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4
  83. $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)intl/; \
  84. $(evaluate-test)
  85. $(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
  86. $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' $(common-objpfx)intl/; \
  87. $(evaluate-test)
  88. $(objpfx)tst-codeset.out: $(codeset_mo)
  89. $(objpfx)tst-gettext3.out: $(codeset_mo)
  90. $(objpfx)tst-gettext5.out: $(codeset_mo)
  91. endif
  92. LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 fr_FR.ISO-8859-1 \
  93. ja_JP.UTF-8
  94. include ../gen-locales.mk
  95. $(objpfx)tst-codeset.out: $(gen-locales)
  96. $(objpfx)tst-gettext.out: $(gen-locales)
  97. $(objpfx)tst-gettext2.out: $(gen-locales)
  98. $(objpfx)tst-gettext3.out: $(gen-locales)
  99. $(objpfx)tst-gettext4.out: $(gen-locales)
  100. $(objpfx)tst-gettext5.out: $(gen-locales)
  101. $(objpfx)tst-gettext6.out: $(gen-locales)
  102. $(objpfx)tst-gettext-c-utf8.out: $(gen-locales)
  103. $(objpfx)tst-translit.out: $(gen-locales)
  104. endif
  105. $(objpfx)tst-gettext-de.po: ../po/de.po
  106. $(make-target-directory)
  107. LC_ALL=C $(AWK) '!/^"POT-Creation-Date: [0-9-]+ [0-9:+-]+\\n"$$/' $^ > $@
  108. $(objpfx)msgs.h: po2test.awk $(objpfx)tst-gettext-de.po
  109. $(make-target-directory)
  110. LC_ALL=C $(AWK) -f $^ > $@
  111. CFLAGS-tst-gettext.c += -DTESTSTRS_H=\"$(objpfx)msgs.h\"
  112. CFLAGS-tst-translit.c += -DOBJPFX=\"$(objpfx)\"
  113. CFLAGS-tst-gettext2.c += -DOBJPFX=\"$(objpfx)\"
  114. CFLAGS-tst-codeset.c += -DOBJPFX=\"$(objpfx)\"
  115. CFLAGS-tst-gettext3.c += -DOBJPFX=\"$(objpfx)\"
  116. CFLAGS-tst-gettext4.c += -DOBJPFX=\"$(objpfx)\"
  117. CFLAGS-tst-gettext5.c += -DOBJPFX=\"$(objpfx)\"
  118. CFLAGS-tst-gettext6.c += -DOBJPFX=\"$(objpfx)\"
  119. ifeq ($(have-thread-library),yes)
  120. ifeq (yes,$(build-shared))
  121. $(addprefix $(objpfx),$(multithread-test-srcs)): $(shared-thread-library)
  122. else
  123. $(addprefix $(objpfx),$(multithread-test-srcs)): $(static-thread-library)
  124. endif
  125. endif
  126. $(objpfx)tst-translit.out: $(objpfx)tst-gettext.out
  127. $(objpfx)tst-gettext2.out: $(objpfx)tst-gettext.out
  128. $(objpfx)tst-codeset.out: $(objpfx)tst-gettext.out
  129. $(objpfx)tst-gettext3.out: $(objpfx)tst-gettext.out
  130. $(objpfx)tst-gettext4.out: $(objpfx)tst-gettext.out
  131. $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
  132. $(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
  133. CPPFLAGS += -D'LOCALEDIR="$(localedir)"' \
  134. -D'LOCALE_ALIAS_PATH="$(localedir)"' \
  135. -Wno-unused-but-set-variable \
  136. -Wno-implicit-fallthrough
  137. BISONFLAGS = --yacc --no-lines --name-prefix=__gettext --output
  138. $(inst_localedir)/locale.alias: locale.alias $(+force)
  139. $(do-install)