summaryrefslogtreecommitdiff
path: root/tests/i18n/GNUmakefile
blob: c933f57ff96a7de8e0ec74432025a93099c4d117 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
TOPDIR = ../..

SUBDIRS =

INCLUDE_LIBS = \
	$(TOPDIR)/src/libwolf.a

INCLUDE_DIRS = \
	-I$(TOPDIR)/include/wolf -I.

TEST_BINS = \
	test_gettext$(EXE)

-include $(TOPDIR)/makefiles/gmake/sub.mk

test_gettext: $(TOPDIR)/src/libwolf.a

# create and update the template:
# xgettext --flag=_:1:pass-c-format -d test_gettext -s -o test_gettext.pot test_gettext.c
#
# initial creation of the translation table:
# msginit -l de_CH -o test_gettext_de_CH.po -i test_gettext.pot
#
# merge the changes into the translation tables keeping existing
# translations
# msgmerge -s -U test_gettext_de_CH.po test_gettext.pot
#
# compile message files into binary format:
# msgfmt -c -v -o test_gettext_de.mo test_gettext_de.po
#
# for running make sure (on ARCH at least, check out others):
# - edit /etc/locale.gen
# - locale-gen
#
# - NetBSD needs -lintl for linking, the LANG is defined different (only de)

%.pot: %.c
	xgettext -k_ --flag=_:1:pass-c-format -d test_gettext -s -o $@ $<
	touch $@

test_gettext_de.po: test_gettext.pot
	msgmerge -s -U $@ -i $<
	touch $@

test_gettext_de_CH.po: test_gettext.pot
	msgmerge -s -U $@ -i $<
	touch $@

%.mo : %.po
	msgfmt -c -o $@ $<

# TODO: big cleanup for GCC compilation flags
# in older gcc (before 4.2.1) we can't switch off warnings selectivly with a
# prage. So gettext misses a format attribute which results in a warning
# test_gettext.c:81: warning: format not a string literal, argument types not checked
# (Solaris 8, NetBSD)
# on Solaris 10 we get a system header conflict if we don't specify -std=c99
#test_gettext.o : test_gettext.c
#	$(CC) -c -g -o $@ $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $<

# LANG setting differs from platform to platform a little bit :-(
ifeq "$(PLATFORM)" "LINUX"
TEST_LANG = de_CH
endif
ifeq "$(PLATFORM)" "FREEBSD"
TEST_LANG = de_CH.ISO8859-1
endif
ifeq "$(PLATFORM)" "OPENBSD"
TEST_LANG = de_CH.ISO8859-1
endif
ifeq "$(PLATFORM)" "SUNOS"
TEST_LANG = de_CH.iso_8859_1
endif
ifeq "$(PLATFORM)" "CYGWIN"
TEST_LANG = de
endif
ifeq "$(PLATFORM)" "NETBSD"
TEST_LANG = de
endif
	
local_test: test_gettext_de.mo test_gettext_de_CH.mo
	@echo "Testing gettext.."
	@mkdir -p locale/de_CH/LC_MESSAGES
	@mkdir -p locale/de/LC_MESSAGES
	@cp test_gettext_de.mo locale/de_CH/LC_MESSAGES/test_gettext.mo
	@cp test_gettext_de.mo locale/de/LC_MESSAGES/test_gettext.mo
	@LANG=$(TEST_LANG) ./test_gettext >/dev/null 2>&1

local_all:

local_clean:
	@-rm -f *.mo
	@-rm -rf locale

local_distclean: