1 # Makefile for PO directory in any package using GNU gettext.
2 # Copyright (C) 1995-1997, 2000-2003 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.
22 BUILD_DIR
= /mnt
/hgfs
/workspace
/tmp
/srcpkg
/bush
25 exec_prefix = ${prefix}
27 datarootdir
= ${prefix}/share
28 datadir = ${datarootdir}
29 localedir
= ${datarootdir}/locale
31 gettextsrcdir
= $(datadir)/gettext
/po
33 INSTALL
= /usr
/bin
/install -c
34 INSTALL_DATA
= ${INSTALL} -m
644
35 MKINSTALLDIRS
= $(top_srcdir
)/support
/mkinstalldirs
36 mkinstalldirs
= $(SHELL
) $(MKINSTALLDIRS
)
42 MSGMERGE_UPDATE
= : --update
49 UPDATEPOFILES
= @UPDATEPOFILES@
50 DUMMYPOFILES
= @DUMMYPOFILES@
51 DISTFILES.common
= Makefile.in.in remove-potcdate.sin \
52 $(DISTFILES.common.extra1
) $(DISTFILES.common.extra2
) $(DISTFILES.common.extra3
)
53 DISTFILES
= $(DISTFILES.common
) Makevars POTFILES.in
$(DOMAIN
).pot stamp-po \
54 $(POFILES
) $(GMOFILES
) \
55 $(DISTFILES.extra1
) $(DISTFILES.extra2
) $(DISTFILES.extra3
)
61 # Makevars gets inserted here. (Don't remove this line!)
64 .SUFFIXES
: .po .gmo .mo .sed .sin .nop .po-update
67 @echo
"$(MSGFMT) -c -o $@ $<"; \
68 $(MSGFMT
) -c
-o t-
$@
$< && mv t-
$@
$@
71 @lang
=`echo $* | sed -e 's,.*/,,'`; \
72 test "$(srcdir)" = .
&& cdcmd
="" || cdcmd
="cd $(srcdir) && "; \
73 echo
"$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
74 cd
$(srcdir) && rm -f
$${lang}.gmo
&& $(GMSGFMT
) -c
--statistics
-o t-
$${lang}.gmo
$${lang}.po
&& mv t-
$${lang}.gmo
$${lang}.gmo
77 sed
-e
'/^#/d' $< > t-
$@
86 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
87 # been loosely updated. Its purpose is that when a developer or translator
88 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
89 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
90 # invocations of "make" will do nothing. This timestamp would not be necessary
91 # if updating the $(CATALOGS) would always touch them; however, the rule for
92 # $(POFILES) has been designed to not touch files that don't need to be
94 stamp-po
: $(srcdir)/$(DOMAIN
).pot
95 test -z
"$(CATALOGS)" ||
$(MAKE
) $(CATALOGS
)
96 @echo
"touch stamp-po"
97 @echo timestamp
> stamp-poT
98 @mv stamp-poT stamp-po
100 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
101 # otherwise packages like GCC can not be built if only parts of the source
102 # have been downloaded.
104 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
105 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
106 $(DOMAIN
).pot-update
: $(POTFILES
) $(srcdir)/POTFILES.in remove-potcdate.sed
107 $(XGETTEXT
) --default-domain
=$(DOMAIN
) --directory
=$(top_srcdir
) \
108 --add-comments
=TRANSLATORS
: $(XGETTEXT_OPTIONS
) \
109 --files-from
=$(srcdir)/POTFILES.in \
110 --copyright-holder
='$(COPYRIGHT_HOLDER)'
111 $(MAKE
) $(MFLAGS
) builtins.pot-update
112 test ! -f
$(DOMAIN
).po ||
{ \
113 if
test -f
$(srcdir)/$(DOMAIN
).pot
; then \
114 sed
-f remove-potcdate.sed
< $(srcdir)/$(DOMAIN
).pot
> $(DOMAIN
).1po
&& \
115 sed
-f remove-potcdate.sed
< $(DOMAIN
).po
> $(DOMAIN
).2po
&& \
116 if cmp
$(DOMAIN
).1po
$(DOMAIN
).2po
>/dev
/null
2>&1; then \
117 rm -f
$(DOMAIN
).1po
$(DOMAIN
).2po
$(DOMAIN
).po
; \
119 rm -f
$(DOMAIN
).1po
$(DOMAIN
).2po
$(srcdir)/$(DOMAIN
).pot
&& \
120 mv
$(DOMAIN
).po
$(srcdir)/$(DOMAIN
).pot
; \
123 mv
$(DOMAIN
).po
$(srcdir)/$(DOMAIN
).pot
; \
127 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
128 # every "make" invocation, only create it when it is missing.
129 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
130 $(srcdir)/$(DOMAIN
).pot
:
131 $(MAKE
) $(DOMAIN
).pot-update
133 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
134 # Note that a PO file is not touched if it doesn't need to be changed.
135 $(POFILES
): $(srcdir)/$(DOMAIN
).pot
136 @lang
=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
137 test "$(srcdir)" = .
&& cdcmd
="" || cdcmd
="cd $(srcdir) && "; \
138 echo
"$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
139 cd
$(srcdir) && $(MSGMERGE_UPDATE
) $${lang}.po
$(DOMAIN
).pot
142 install: install-exec install-data
144 install-data
: install-data-yes
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-yes
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-yes
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 stamp-po
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 updating PO files.
322 @lang
=`echo $@ | sed -e 's/\.po-update$$//'`; \
323 if
test "$(PACKAGE)" = "gettext-tools"; then PATH
=`pwd`/..
/src
:$$PATH; fi
; \
326 test "$(srcdir)" = .
&& cdcmd
="" || cdcmd
="cd $(srcdir) && "; \
327 echo
"$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
329 if
$(MSGMERGE
) $$lang.po
$(DOMAIN
).pot
-o
$$tmpdir/$$lang.new.po
; then \
330 if cmp
$$lang.po
$$tmpdir/$$lang.new.po
>/dev
/null
2>&1; then \
331 rm -f
$$tmpdir/$$lang.new.po
; \
333 if mv
-f
$$tmpdir/$$lang.new.po
$$lang.po
; then \
336 echo
"msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
341 echo
"msgmerge for $$lang.po failed!" 1>&2; \
342 rm -f
$$tmpdir/$$lang.new.po
; \
347 update-gmo
: Makefile
$(GMOFILES
)
350 Makefile
: Makefile.in.in
$(top_builddir
)/config.status @POMAKEFILEDEPS@
$(srcdir)/Rules-builtins
352 && CONFIG_FILES
=$(subdir
)/$@.in CONFIG_HEADERS
= \
353 $(SHELL
) .
/config.status
357 # Tell versions [3.59,3.63) of GNU make not to export all variables.
358 # Otherwise a system limit (for SysV at least) may be exceeded.