1 # Makefile for PO directory in any package using GNU gettext.
2 # Copyright (C) 1995-1997, 2000-2004 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
4 # This file can be copied and used freely without restrictions. It can
5 # be used in projects which are not available under the GNU General Public
6 # License but which still want to provide support for the GNU gettext
8 # Please note that the actual code of GNU gettext is covered by the GNU
9 # General Public License and is *not* in the public domain.
11 # Origin: gettext-0.14
24 exec_prefix = ${prefix}
25 datadir = ${prefix}/share
26 localedir
= $(datadir)/locale
27 gettextsrcdir
= $(datadir)/gettext
/po
29 INSTALL
= /usr
/bin
/install -c
30 INSTALL_DATA
= ${INSTALL} -m
644
31 MKINSTALLDIRS
= $(top_builddir
)/.
/mkinstalldirs
32 mkinstalldirs
= $(SHELL
) $(MKINSTALLDIRS
)
34 GMSGFMT
= /usr
/bin
/msgfmt
35 MSGFMT
= /usr
/bin
/msgfmt
36 XGETTEXT
= /usr
/bin
/xgettext
38 MSGMERGE_UPDATE
= /usr
/bin
/msgmerge
--update
45 UPDATEPOFILES
= @UPDATEPOFILES@
46 DUMMYPOFILES
= @DUMMYPOFILES@
47 DISTFILES.common
= Makefile.in.in remove-potcdate.sin \
48 $(DISTFILES.common.extra1
) $(DISTFILES.common.extra2
) $(DISTFILES.common.extra3
)
49 DISTFILES
= $(DISTFILES.common
) Makevars POTFILES.in
$(DOMAIN
).pot stamp-po \
50 $(POFILES
) $(GMOFILES
) \
51 $(DISTFILES.extra1
) $(DISTFILES.extra2
) $(DISTFILES.extra3
)
57 # Makevars gets inserted here. (Don't remove this line!)
60 .SUFFIXES
: .po .gmo .mo .sed .sin .nop .po-create .po-update
63 @echo
"$(MSGFMT) -c -o $@ $<"; \
64 $(MSGFMT
) -c
-o t-
$@
$< && mv t-
$@
$@
67 @lang
=`echo $* | sed -e 's,.*/,,'`; \
68 test "$(srcdir)" = .
&& cdcmd
="" || cdcmd
="cd $(srcdir) && "; \
69 echo
"$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
70 cd
$(srcdir) && rm -f
$${lang}.gmo
&& $(GMSGFMT
) -c
--statistics
-o t-
$${lang}.gmo
$${lang}.po
&& mv t-
$${lang}.gmo
$${lang}.gmo
73 sed
-e
'/^#/d' $< > t-
$@
82 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
83 # been loosely updated. Its purpose is that when a developer or translator
84 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
85 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
86 # invocations of "make" will do nothing. This timestamp would not be necessary
87 # if updating the $(CATALOGS) would always touch them; however, the rule for
88 # $(POFILES) has been designed to not touch files that don't need to be
90 stamp-po
: $(srcdir)/$(DOMAIN
).pot
91 test -z
"$(GMOFILES)" ||
$(MAKE
) $(GMOFILES
)
92 @echo
"touch stamp-po"
93 @echo timestamp
> stamp-poT
94 @mv stamp-poT stamp-po
96 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
97 # otherwise packages like GCC can not be built if only parts of the source
98 # have been downloaded.
100 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
101 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
102 $(DOMAIN
).pot-update
: $(POTFILES
) $(srcdir)/POTFILES.in remove-potcdate.sed
103 $(XGETTEXT
) --default-domain
=$(DOMAIN
) --directory
=$(top_srcdir
) \
104 --add-comments
=TRANSLATORS
: $(XGETTEXT_OPTIONS
) \
105 --files-from
=$(srcdir)/POTFILES.in \
106 --copyright-holder
='$(COPYRIGHT_HOLDER)' \
107 --msgid-bugs-address
='$(MSGID_BUGS_ADDRESS)'
108 test ! -f
$(DOMAIN
).po ||
{ \
109 if
test -f
$(srcdir)/$(DOMAIN
).pot
; then \
110 sed
-f remove-potcdate.sed
< $(srcdir)/$(DOMAIN
).pot
> $(DOMAIN
).1po
&& \
111 sed
-f remove-potcdate.sed
< $(DOMAIN
).po
> $(DOMAIN
).2po
&& \
112 if cmp
$(DOMAIN
).1po
$(DOMAIN
).2po
>/dev
/null
2>&1; then \
113 rm -f
$(DOMAIN
).1po
$(DOMAIN
).2po
$(DOMAIN
).po
; \
115 rm -f
$(DOMAIN
).1po
$(DOMAIN
).2po
$(srcdir)/$(DOMAIN
).pot
&& \
116 mv
$(DOMAIN
).po
$(srcdir)/$(DOMAIN
).pot
; \
119 mv
$(DOMAIN
).po
$(srcdir)/$(DOMAIN
).pot
; \
123 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
124 # every "make" invocation, only create it when it is missing.
125 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
126 $(srcdir)/$(DOMAIN
).pot
:
127 $(MAKE
) $(DOMAIN
).pot-update
129 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
130 # Note that a PO file is not touched if it doesn't need to be changed.
131 $(POFILES
): $(srcdir)/$(DOMAIN
).pot
132 @lang
=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
133 if
test -f
"$(srcdir)/$${lang}.po"; then \
134 test "$(srcdir)" = .
&& cdcmd
="" || cdcmd
="cd $(srcdir) && "; \
135 echo
"$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
136 cd
$(srcdir) && $(MSGMERGE_UPDATE
) $${lang}.po
$(DOMAIN
).pot
; \
138 $(MAKE
) $${lang}.po-create
; \
142 install: install-exec install-data
144 install-data
: install-data-no
145 if
test "$(PACKAGE)" = "gettext-tools"; then \
146 $(mkinstalldirs
) $(DESTDIR
)$(gettextsrcdir
); \
147 for file in
$(DISTFILES.common
) Makevars.template
; do \
148 $(INSTALL_DATA
) $(srcdir)/$$file \
149 $(DESTDIR
)$(gettextsrcdir
)/$$file; \
151 for file in Makevars
; do \
152 rm -f
$(DESTDIR
)$(gettextsrcdir
)/$$file; \
158 install-data-yes
: all
159 $(mkinstalldirs
) $(DESTDIR
)$(datadir)
160 @catalogs
='$(CATALOGS)'; \
161 for cat in
$$catalogs; do \
162 cat
=`basename $$cat`; \
163 lang
=`echo $$cat | sed -e 's/\.gmo$$//'`; \
164 dir=$(localedir
)/$$lang/LC_MESSAGES
; \
165 $(mkinstalldirs
) $(DESTDIR
)$$dir; \
166 if
test -r
$$cat; then realcat
=$$cat; else realcat
=$(srcdir)/$$cat; fi
; \
167 $(INSTALL_DATA
) $$realcat $(DESTDIR
)$$dir/$(DOMAIN
).mo
; \
168 echo
"installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
169 for lc in
'' $(EXTRA_LOCALE_CATEGORIES
); do \
170 if
test -n
"$$lc"; then \
171 if
(cd
$(DESTDIR
)$(localedir
)/$$lang && LC_ALL
=C ls
-l
-d
$$lc 2>/dev
/null
) | grep
' -> ' >/dev
/null
; then \
172 link
=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
173 mv
$(DESTDIR
)$(localedir
)/$$lang/$$lc $(DESTDIR
)$(localedir
)/$$lang/$$lc.old
; \
174 mkdir
$(DESTDIR
)$(localedir
)/$$lang/$$lc; \
175 (cd
$(DESTDIR
)$(localedir
)/$$lang/$$lc.old
&& \
177 if
test -f
$$file; then \
178 ln
-s ..
/$$link/$$file $(DESTDIR
)$(localedir
)/$$lang/$$lc/$$file; \
181 rm -f
$(DESTDIR
)$(localedir
)/$$lang/$$lc.old
; \
183 if
test -d
$(DESTDIR
)$(localedir
)/$$lang/$$lc; then \
186 rm -f
$(DESTDIR
)$(localedir
)/$$lang/$$lc; \
187 mkdir
$(DESTDIR
)$(localedir
)/$$lang/$$lc; \
190 rm -f
$(DESTDIR
)$(localedir
)/$$lang/$$lc/$(DOMAIN
).mo
; \
191 ln
-s ..
/LC_MESSAGES
/$(DOMAIN
).mo
$(DESTDIR
)$(localedir
)/$$lang/$$lc/$(DOMAIN
).mo
2>/dev
/null || \
192 ln
$(DESTDIR
)$(localedir
)/$$lang/LC_MESSAGES
/$(DOMAIN
).mo
$(DESTDIR
)$(localedir
)/$$lang/$$lc/$(DOMAIN
).mo
2>/dev
/null || \
193 cp
-p
$(DESTDIR
)$(localedir
)/$$lang/LC_MESSAGES
/$(DOMAIN
).mo
$(DESTDIR
)$(localedir
)/$$lang/$$lc/$(DOMAIN
).mo
; \
194 echo
"installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
199 install-strip
: install
201 installdirs: installdirs-exec installdirs-data
203 installdirs-data
: installdirs-data-no
204 if
test "$(PACKAGE)" = "gettext-tools"; then \
205 $(mkinstalldirs
) $(DESTDIR
)$(gettextsrcdir
); \
210 installdirs-data-yes
:
211 $(mkinstalldirs
) $(DESTDIR
)$(datadir)
212 @catalogs
='$(CATALOGS)'; \
213 for cat in
$$catalogs; do \
214 cat
=`basename $$cat`; \
215 lang
=`echo $$cat | sed -e 's/\.gmo$$//'`; \
216 dir=$(localedir
)/$$lang/LC_MESSAGES
; \
217 $(mkinstalldirs
) $(DESTDIR
)$$dir; \
218 for lc in
'' $(EXTRA_LOCALE_CATEGORIES
); do \
219 if
test -n
"$$lc"; then \
220 if
(cd
$(DESTDIR
)$(localedir
)/$$lang && LC_ALL
=C ls
-l
-d
$$lc 2>/dev
/null
) | grep
' -> ' >/dev
/null
; then \
221 link
=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
222 mv
$(DESTDIR
)$(localedir
)/$$lang/$$lc $(DESTDIR
)$(localedir
)/$$lang/$$lc.old
; \
223 mkdir
$(DESTDIR
)$(localedir
)/$$lang/$$lc; \
224 (cd
$(DESTDIR
)$(localedir
)/$$lang/$$lc.old
&& \
226 if
test -f
$$file; then \
227 ln
-s ..
/$$link/$$file $(DESTDIR
)$(localedir
)/$$lang/$$lc/$$file; \
230 rm -f
$(DESTDIR
)$(localedir
)/$$lang/$$lc.old
; \
232 if
test -d
$(DESTDIR
)$(localedir
)/$$lang/$$lc; then \
235 rm -f
$(DESTDIR
)$(localedir
)/$$lang/$$lc; \
236 mkdir
$(DESTDIR
)$(localedir
)/$$lang/$$lc; \
243 # Define this as empty until I found a useful application.
246 uninstall: uninstall-exec uninstall-data
248 uninstall-data
: uninstall-data-no
249 if
test "$(PACKAGE)" = "gettext-tools"; then \
250 for file in
$(DISTFILES.common
) Makevars.template
; do \
251 rm -f
$(DESTDIR
)$(gettextsrcdir
)/$$file; \
258 catalogs
='$(CATALOGS)'; \
259 for cat in
$$catalogs; do \
260 cat
=`basename $$cat`; \
261 lang
=`echo $$cat | sed -e 's/\.gmo$$//'`; \
262 for lc in LC_MESSAGES
$(EXTRA_LOCALE_CATEGORIES
); do \
263 rm -f
$(DESTDIR
)$(localedir
)/$$lang/$$lc/$(DOMAIN
).mo
; \
269 info dvi ps pdf html
tags TAGS ctags CTAGS ID
:
272 rm -f remove-potcdate.sed
274 rm -f core core.
* $(DOMAIN
).po
$(DOMAIN
).1po
$(DOMAIN
).2po
*.new.po
280 rm -f Makefile Makefile.in POTFILES
*.mo
282 maintainer-clean
: distclean
283 @echo
"This command is intended for maintainers to use;"
284 @echo
"it deletes files that may require special tools to rebuild."
285 rm -f stamp-po
$(GMOFILES
)
287 distdir
= $(top_builddir
)/$(PACKAGE
)-$(VERSION
)/$(subdir
)
291 # This is a separate target because 'update-po' must be executed before.
293 dists
="$(DISTFILES)"; \
294 if
test "$(PACKAGE)" = "gettext-tools"; then \
295 dists
="$$dists Makevars.template"; \
297 if
test -f
$(srcdir)/ChangeLog
; then \
298 dists
="$$dists ChangeLog"; \
300 for i in
0 1 2 3 4 5 6 7 8 9; do \
301 if
test -f
$(srcdir)/ChangeLog.
$$i; then \
302 dists
="$$dists ChangeLog.$$i"; \
305 if
test -f
$(srcdir)/LINGUAS
; then dists
="$$dists LINGUAS"; fi
; \
306 for file in
$$dists; do \
307 if
test -f
$$file; then \
308 cp
-p
$$file $(distdir
); \
310 cp
-p
$(srcdir)/$$file $(distdir
); \
315 $(MAKE
) $(DOMAIN
).pot-update
316 test -z
"$(UPDATEPOFILES)" ||
$(MAKE
) $(UPDATEPOFILES
)
319 # General rule for creating PO files.
322 @lang
=`echo $@ | sed -e 's/\.po-create$$//'`; \
323 echo
"File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
326 # General rule for updating PO files.
329 @lang
=`echo $@ | sed -e 's/\.po-update$$//'`; \
330 if
test "$(PACKAGE)" = "gettext-tools"; then PATH
=`pwd`/..
/src
:$$PATH; fi
; \
333 test "$(srcdir)" = .
&& cdcmd
="" || cdcmd
="cd $(srcdir) && "; \
334 echo
"$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
336 if
$(MSGMERGE
) $$lang.po
$(DOMAIN
).pot
-o
$$tmpdir/$$lang.new.po
; then \
337 if cmp
$$lang.po
$$tmpdir/$$lang.new.po
>/dev
/null
2>&1; then \
338 rm -f
$$tmpdir/$$lang.new.po
; \
340 if mv
-f
$$tmpdir/$$lang.new.po
$$lang.po
; then \
343 echo
"msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
348 echo
"msgmerge for $$lang.po failed!" 1>&2; \
349 rm -f
$$tmpdir/$$lang.new.po
; \
354 update-gmo
: Makefile
$(GMOFILES
)
357 Makefile
: Makefile.in.in
$(top_builddir
)/config.status @POMAKEFILEDEPS@
359 && CONFIG_FILES
=$(subdir
)/$@.in CONFIG_HEADERS
= \
360 $(SHELL
) .
/config.status
364 # Tell versions [3.59,3.63) of GNU make not to export all variables.
365 # Otherwise a system limit (for SysV at least) may be exceeded.