summaryrefslogtreecommitdiff
path: root/dviware/mdvi/config/nls.mk.in
blob: d69e1535a4c2b2059614a244de3c80923c40e7e1 (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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
###########################################################################
#
# This makefile fragment deals with generation and installation of message
# catalogs. It is a modified version of the Makefile.in.in distributed with
# GNU gettext (taken from version 0.10.35). It was modified to be used when
# distributing a package that contains several sub-packages and libraries,
# each with their own message catalogs, and each with support for different
# languages.
#
# Packages can have different directories or share the same one. This
# fragment assumes that the catalogs are in a `po' subdirectory of the
# source directory, but if this is not the case, set the `SOURCEDIR'
# directory to point to the sources.
#
# To use this, create a Makefile that looks like the following:
# 
# --cut-here--
# include <top directory>/config/config.mk
#
# LINGUAS = <set of languages supported by this package>
#
# # These are optional (see below)
# PACKAGE = <package name>
#
# POT_SOURCES = <base name of source files needing translation in `..'>
# POT_OTHER = <full name of other source files>
#
# include <top directory>/config/nls.mk
# --cut-here--
# 
# That's it. You may omit the PACKAGE variable if you have a file
# `package-info' in the source directory
#
###########################################################################

ifndef SOURCEDIR
SOURCEDIR = ..
endif

ifndef PACKAGE
include $(SOURCEDIR)/package-info
endif

ifndef LOCALEDIR
ifeq "@LOCALEDIR@" ""
LOCALEDIR = $(prefix)/locale
else
LOCALEDIR    = @LOCALEDIR@
endif
endif

GNU_LOCALEDIR = $(prefix)/share/locale

srcdir     = @srcdir@
top_srcdir = @TOPSRCDIR@

# Programs
GENCAT   = @GENCAT@
GMSGFMT  = @GMSGFMT@
MSGFMT   = @MSGFMT@
XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge

SOURCES   = cat-id-tbl.c
POFILES   = @POFILES@
GMOFILES  = @GMOFILES@

# Files for distribution
# DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
# stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)

POTFILES = $(addprefix $(SOURCEDIR)/, $(POT_SOURCES)) $(POT_OTHER)

CATOBJEXT  = @CATOBJEXT@
INSTOBJEXT = @INSTOBJEXT@

CLEANABLE += core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp *.o
DISTCLEANABLE += *.mo *.msg *.cat *.cat.m
MAINCLEANABLE += $(GMOFILES)

CATALOGS := $(addsuffix $(CATOBJEXT), $(LINGUAS))

.SUFFIXES: .po .pox .gmo .mo .msg .cat

.po.pox: $(PACKAGE).pot
	# $(MAKE) $(PACKAGE).pot
	$(MSGMERGE) $< $(PACKAGE).pot -o $*.pox

.po.mo:
	$(MSGFMT) -o $@ $<

.po.gmo:
	file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
	  && rm -f $$file && $(GMSGFMT) -o $$file $<

.po.cat:
	sed -f $(top_srcdir)/intl/po2msg.sed < $< > $*.msg \
	  && rm -f $@ && $(GENCAT) $@ $*.msg

.PHONY: all all-yes all-no
all: all-@USE_NLS@

all-yes: cat-id-tbl.c $(CATALOGS)
all-no:

$(PACKAGE).pot: $(POTFILES)
	@echo "Extracting messages from sources"
	@$(XGETTEXT) --default-domain=$(PACKAGE) \
	  --add-comments --keyword=_ --keyword=_G $(POTFILES) \
	&& test ! -f $(PACKAGE).po \
	   || ( rm -f $(srcdir)/$(PACKAGE).pot \
		&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )

$(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
$(srcdir)/stamp-cat-id: $(PACKAGE).pot
	@rm -f cat-id-tbl.tmp
	@sed -f $(top_srcdir)/intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
		| sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
	@if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
	  rm cat-id-tbl.tmp; \
	else \
	  echo cat-id-tbl.c changed; \
	  rm -f $(srcdir)/cat-id-tbl.c; \
	  mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
	fi
	@cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id

.PHONY: install install-exec install-data install-data-yes install-data-no
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
install-data-no: all
install-data-yes: all
	@catalogs="$(CATALOGS)"; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  case "$$cat" in \
	    *.gmo) destdir=$(GNU_LOCALEDIR);; \
	    *)     destdir=$(LOCALEDIR);; \
	  esac; \
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
	  dir=$$destdir/$$lang/LC_MESSAGES; \
	  $(MKINSTALLDIRS) $$dir; \
	  if test -r $$cat; then \
	    $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
	    echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
	  else \
	    $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
	    echo "installing $(srcdir)/$$cat as" \
		 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
	  fi; \
	  if test -r $$cat.m; then \
	    $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
	    echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
	  else \
	    if test -r $(srcdir)/$$cat.m ; then \
	      $(INSTALL_DATA) $(srcdir)/$$cat.m \
		$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
	      echo "installing $(srcdir)/$$cat as" \
		   "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
	    else \
	      true; \
	    fi; \
	  fi; \
	done

.PHONY: uninstall
uninstall:
	catalogs='$(CATALOGS)'; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
	  rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
	  rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
	  rm -f $(GNU_LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
	  rm -f $(GNU_LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
	done

.PHONY: check
check: all

cat-id-tbl.o: $(top_srcdir)/intl/libgettext.h

.PHONY: update-po
update-po: Makefile $(PACKAGE).pot
	cd $(srcdir); \
	catalogs='$(CATALOGS)'; \
	for cat in $$catalogs; do \
	  cat=`basename $$cat`; \
	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
	  mv $$lang.po $$lang.old.po; \
	  echo "$$lang:"; \
	  if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
	    rm -f $$lang.old.po; \
	  else \
	    echo "msgmerge for $$cat failed!"; \
	    rm -f $$lang.po; \
	    mv $$lang.old.po $$lang.po; \
	  fi; \
	done

ifdef SUBDIR
Makefile: Makefile.in
	@cd $(TOPSRCDIR) && \
	  CONFIG_FILES=$(SUBDIR)/po/$@ CONFIG_HEADERS= \
	  ./config.status
endif

# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

include $(FRAGDIR)/targets.mk