Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. # Copyright (C) 1996-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. # Makefile for catgets.
  16. #
  17. subdir := catgets
  18. include ../Makeconfig
  19. headers = \
  20. nl_types.h \
  21. # headers
  22. routines = \
  23. catgets \
  24. open_catalog \
  25. # routines
  26. others = gencat
  27. install-bin = gencat
  28. extra-objs = $(gencat-modules:=.o)
  29. tests = tst-catgets
  30. test-srcs = test-gencat
  31. ifeq ($(run-built-tests),yes)
  32. tests-special += \
  33. $(objpfx)de/libc.cat \
  34. $(objpfx)sample.SJIS.cat \
  35. $(objpfx)test-gencat.out \
  36. $(objpfx)test1.cat \
  37. $(objpfx)test2.cat \
  38. # tests-special
  39. ifeq (yes,$(build-shared))
  40. ifneq ($(PERL),no)
  41. tests-special += $(objpfx)tst-catgets-mem.out
  42. endif
  43. endif
  44. endif
  45. gencat-modules = xmalloc
  46. others-extras = $(gencat-modules)
  47. # To find xmalloc.c
  48. vpath %.c ../locale/programs
  49. include ../Rules
  50. $(objpfx)gencat: $(gencat-modules:%=$(objpfx)%.o)
  51. catgets-CPPFLAGS := -DNLSPATH='"$(localedir)/%L/%N:$(localedir)/%L/LC_MESSAGES/%N:$(localedir)/%l/%N:$(localedir)/%l/LC_MESSAGES/%N:"'
  52. generated += \
  53. de.msg \
  54. sample.SJIS.cat \
  55. test-gencat.h \
  56. test1.cat \
  57. test1.h \
  58. test2.cat \
  59. test2.h \
  60. # generated
  61. ifeq ($(run-built-tests),yes)
  62. ifeq (yes,$(build-shared))
  63. ifneq ($(PERL),no)
  64. generated += \
  65. tst-catgets-mem.out \
  66. tst-catgets.mtrace \
  67. # generated
  68. endif
  69. endif
  70. endif
  71. generated-dirs += \
  72. de \
  73. # generated-dirs
  74. tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de \
  75. MALLOC_TRACE=$(objpfx)tst-catgets.mtrace \
  76. LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
  77. ifeq ($(run-built-tests),yes)
  78. # This test just checks whether the program produces any error or not.
  79. # The result is not tested.
  80. $(objpfx)test1.cat: test1.msg $(objpfx)gencat
  81. $(built-program-cmd-before-env) \
  82. $(run-program-env) LC_ALL=hr_HR.ISO-8859-2 \
  83. $(built-program-cmd-after-env) -H $(objpfx)test1.h $@ $<; \
  84. $(evaluate-test)
  85. $(objpfx)test2.cat: test2.msg $(objpfx)gencat
  86. $(built-program-cmd) -H $(objpfx)test2.h $@ $<; \
  87. $(evaluate-test)
  88. $(objpfx)de/libc.cat: $(objpfx)de.msg $(objpfx)gencat
  89. $(make-target-directory)
  90. $(built-program-cmd-before-env) \
  91. $(run-program-env) LC_ALL=de_DE.ISO-8859-1 \
  92. $(built-program-cmd-after-env) $@ $<; \
  93. $(evaluate-test)
  94. $(objpfx)tst-catgets.out: $(objpfx)de/libc.cat
  95. # Generate a non-simple input file.
  96. $(objpfx)de.msg: xopen-msg.awk $(..)po/de.po
  97. LC_ALL=C $(AWK) -f $^ $< > $@
  98. $(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
  99. $(objpfx)sample.SJIS.cat
  100. $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
  101. '$(run-program-env)' '$(test-program-cmd-after-env)'; \
  102. $(evaluate-test)
  103. $(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat
  104. $(built-program-cmd) -H $(objpfx)test-gencat.h < $(word 1,$^) > $@; \
  105. $(evaluate-test)
  106. $(objpfx)tst-catgets-mem.out: $(objpfx)tst-catgets.out
  107. $(common-objpfx)malloc/mtrace $(objpfx)tst-catgets.mtrace > $@; \
  108. $(evaluate-test)
  109. endif