blob: 0c6ac7992328ad06b21a9200b953fbe1bf8d031b [file] [log] [blame]
xf.libdd93d52023-05-12 07:10:14 -07001# Copyright (C) 1996-2016 Free Software Foundation, Inc.
2# This file is part of the GNU C Library.
3
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.
8
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.
13
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# <http://www.gnu.org/licenses/>.
17
18#
19# Makefile for catgets.
20#
21subdir := catgets
22
23include ../Makeconfig
24
25headers = nl_types.h
26routines = catgets open_catalog
27others = gencat
28install-bin = gencat
29extra-objs = $(gencat-modules:=.o)
30
31tests = tst-catgets
32test-srcs = test-gencat
33
34ifeq ($(run-built-tests),yes)
35tests-special += $(objpfx)de/libc.cat $(objpfx)test1.cat $(objpfx)test2.cat \
36 $(objpfx)sample.SJIS.cat $(objpfx)test-gencat.out
37tests-special += $(objpfx)tst-catgets-mem.out
38endif
39
40gencat-modules = xmalloc
41
42# To find xmalloc.c
43vpath %.c ../locale/programs
44
45
46include ../Rules
47
48$(objpfx)gencat: $(gencat-modules:%=$(objpfx)%.o)
49
50catgets-CPPFLAGS := -DNLSPATH='"$(msgcatdir)/%L/%N:$(msgcatdir)/%L/LC_MESSAGES/%N:$(msgcatdir)/%l/%N:$(msgcatdir)/%l/LC_MESSAGES/%N:"'
51
52generated += de.msg test1.cat test1.h test2.cat test2.h sample.SJIS.cat \
53 test-gencat.h
54generated += tst-catgets.mtrace tst-catgets-mem.out
55
56generated-dirs += de
57
58tst-catgets-ENV = NLSPATH="$(objpfx)%l/%N.cat" LANG=de MALLOC_TRACE=$(objpfx)tst-catgets.mtrace
59
60ifeq ($(run-built-tests),yes)
61# This test just checks whether the program produces any error or not.
62# The result is not tested.
63$(objpfx)test1.cat: test1.msg $(objpfx)gencat
64 $(built-program-cmd-before-env) \
65 $(run-program-env) LC_ALL=hr_HR.ISO-8859-2 \
66 $(built-program-cmd-after-env) -H $(objpfx)test1.h $@ $<; \
67 $(evaluate-test)
68$(objpfx)test2.cat: test2.msg $(objpfx)gencat
69 $(built-program-cmd) -H $(objpfx)test2.h $@ $<; \
70 $(evaluate-test)
71$(objpfx)de/libc.cat: $(objpfx)de.msg $(objpfx)gencat
72 $(make-target-directory)
73 $(built-program-cmd-before-env) \
74 $(run-program-env) LC_ALL=de_DE.ISO-8859-1 \
75 $(built-program-cmd-after-env) $@ $<; \
76 $(evaluate-test)
77$(objpfx)tst-catgets.out: $(objpfx)de/libc.cat
78
79# Generate a non-simple input file.
80$(objpfx)de.msg: xopen-msg.awk $(..)po/de.po
81 LC_ALL=C $(AWK) -f $^ $< > $@
82
83$(objpfx)test-gencat.out: test-gencat.sh $(objpfx)test-gencat \
84 $(objpfx)sample.SJIS.cat
85 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
86 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
87 $(evaluate-test)
88
89$(objpfx)sample.SJIS.cat: sample.SJIS $(objpfx)gencat
90 $(built-program-cmd) -H $(objpfx)test-gencat.h < $(word 1,$^) > $@; \
91 $(evaluate-test)
92
93$(objpfx)tst-catgets-mem.out: $(objpfx)tst-catgets.out
94 $(common-objpfx)malloc/mtrace $(objpfx)tst-catgets.mtrace > $@; \
95 $(evaluate-test)
96endif