Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-objc-gnustep / po / GNUmakefile
blob00ee5234716aff90716920621e4033538fc79642
1 # Example for use of GNU gettext.
2 # This file is in the public domain.
4 # Makefile - processed by GNU make.
6 # NLS is enabled by default.
7 USE_NLS = yes
9 # List of files which contain translatable strings.
10 POTFILES = \
11 Hello.m
13 # Usually the message domain is the same as the package name in lower case.
14 DOMAIN = hello-objc-gnustep
16 # These options get passed to xgettext.
17 XGETTEXT_OPTIONS =
19 # This is the copyright holder that gets inserted into the header of the
20 # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
21 # package. (Note that the msgstr strings, extracted from the package's
22 # sources, belong to the copyright holder of the package.) Translators are
23 # expected to transfer the copyright for their translations to this person
24 # or entity, or to disclaim their copyright. The empty string stands for
25 # the public domain; in this case the translators are expected to disclaim
26 # their copyright.
27 COPYRIGHT_HOLDER = Yoyodyne, Inc.
29 # This is the email address or URL to which the translators shall report
30 # bugs in the untranslated strings:
31 # - Strings which are not entire sentences, see the maintainer guidelines
32 # in the GNU gettext documentation, section 'Preparing Strings'.
33 # - Strings which use unclear terms or require additional context to be
34 # understood.
35 # - Strings which make invalid assumptions about notation of date, time or
36 # money.
37 # - Pluralisation problems.
38 # - Incorrect English spelling.
39 # - Incorrect formatting.
40 # It can be your email address, or a mailing list address where translators
41 # can write to without being subscribed, or the URL of a web page through
42 # which the translators can contact you.
43 MSGID_BUGS_ADDRESS = bug-gnu-gettext@gnu.org
45 # These options get passed to msgmerge.
46 # Useful options are in particular:
47 # --previous to keep previous msgids of translated messages,
48 # --quiet to reduce the verbosity.
49 MSGMERGE_OPTIONS = --quiet
51 -include $(GNUSTEP_MAKEFILES)/rules.make
53 # Main application
54 PACKAGE_NAME = Hello
55 PACKAGE_VERSION = 0
57 XGETTEXT = xgettext
58 MSGMERGE = msgmerge
59 MSGMERGE_UPDATE = msgmerge --update
60 MSGINIT = msginit
61 MSGCONV = msgconv
62 MSGFILTER = msgfilter
64 # Set of available languages.
65 LINGUAS := $(shell sed -e "/^\#/d" LINGUAS)
66 # Set of languages which use msgen.
67 ENLINGUAS := $(filter-out $(LINGUAS), en)
69 top_srcdir = ..
71 include LocaleAliases
73 POTFILES_DEPS = $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
74 POFILES = $(foreach lang, $(LINGUAS), $(lang).po)
75 UPDATEPOFILES = $(foreach lang, $(LINGUAS), $(lang).po-update)
76 DUMMYPOFILES = $(foreach lang, $(LINGUAS), $(lang).nop)
77 STRINGSFILES = $(foreach lang, $(LINGUAS), $(top_srcdir)/$(NSLOCALE_$(lang)).lproj/Localizable.strings)
78 ENSTRINGSFILES = $(foreach lang, $(ENLINGUAS), $(top_srcdir)/$(NSLOCALE_$(lang)).lproj/Localizable.strings)
79 CATALOGS = $(STRINGSFILES) $(ENSTRINGSFILES)
81 .SUFFIXES: .po .mo .sed .sin .nop .po-create .po-update
83 .sin.sed:
84 sed -e '/^#/d' $< > t-$@
85 mv t-$@ $@
88 internal-all:: all-local-$(USE_NLS)
90 all-local-yes: $(CATALOGS)
91 all-local-no:
93 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
94 # otherwise packages like GCC can not be built if only parts of the source
95 # have been downloaded.
97 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
98 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
99 $(DOMAIN).pot-update: $(POTFILES_DEPS) remove-potcdate.sed
100 if LC_ALL=C grep 'GNU $(PACKAGE_NAME)' ../* 2>/dev/null >/dev/null; then \
101 package_gnu='GNU '; \
102 else \
103 package_gnu=''; \
104 fi; \
105 msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
106 case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
107 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
108 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
109 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
110 --copyright-holder='$(COPYRIGHT_HOLDER)' \
111 --msgid-bugs-address="$$msgid_bugs_address" \
112 $(POTFILES) \
113 ;; \
114 *) \
115 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
116 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
117 --copyright-holder='$(COPYRIGHT_HOLDER)' \
118 --package-name="$${package_gnu}$(PACKAGE_NAME)" \
119 --package-version='$(VERSION)' \
120 --msgid-bugs-address="$$msgid_bugs_address" \
121 $(POTFILES) \
122 ;; \
123 esac
124 test ! -f $(DOMAIN).po || { \
125 if test -f $(DOMAIN).pot; then \
126 sed -f remove-potcdate.sed < $(DOMAIN).pot > $(DOMAIN).1po && \
127 sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
128 if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
129 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
130 else \
131 rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).pot && \
132 mv $(DOMAIN).po $(DOMAIN).pot; \
133 fi; \
134 else \
135 mv $(DOMAIN).po $(DOMAIN).pot; \
136 fi; \
139 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
140 # every "make" invocation, only create it when it is missing.
141 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
142 $(DOMAIN).pot:
143 $(MAKE) $(DOMAIN).pot-update
145 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
146 # Note that a PO file is not touched if it doesn't need to be changed.
147 $(POFILES): $(DOMAIN).pot
148 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
149 if test -f $${lang}.po; then \
150 echo "$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot"; \
151 case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
152 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
153 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
154 *) \
155 $(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} $${lang}.po $(DOMAIN).pot;; \
156 esac; \
157 else \
158 $(MAKE) $${lang}.po-create; \
161 update-po:
162 $(MAKE) $(DOMAIN).pot-update
163 test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
164 $(MAKE) update-strings
166 # General rule for creating PO files.
168 .nop.po-create:
169 @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
170 echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
171 exit 1
173 # General rule for updating PO files.
175 .nop.po-update:
176 @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
177 tmpdir=`pwd`; \
178 echo "$$lang:"; \
179 echo "$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
180 if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
181 '' | 0.[0-9] | 0.[0-9].* | 0.1[0-7] | 0.1[0-7].*) \
182 $(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
183 *) \
184 $(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
185 esac; \
186 }; then \
187 if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
188 rm -f $$tmpdir/$$lang.new.po; \
189 else \
190 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
191 :; \
192 else \
193 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
194 exit 1; \
195 fi; \
196 fi; \
197 else \
198 echo "msgmerge for $$lang.po failed!" 1>&2; \
199 rm -f $$tmpdir/$$lang.new.po; \
202 $(DUMMYPOFILES):
205 update-strings: $(CATALOGS)
208 # I don't know how to make a dependency from a particular .strings file to its
209 # corresponding .po file; therefore I put here a dependency towards all .po
210 # files. It's safer than no dependency at all.
211 $(STRINGSFILES): $(POFILES)
212 $(MAKE) $(UNIXLOCALE_$(patsubst %.lproj,%, $(notdir $(patsubst %/,%, $(dir $@))))).po
213 mkdir -p $(patsubst %/,%, $(dir $@))
214 msgcat --stringtable-output -o $@.tmp $(UNIXLOCALE_$(patsubst %.lproj,%, $(notdir $(patsubst %/,%, $(dir $@))))).po
215 mv $@.tmp $@
217 $(ENSTRINGSFILES): $(DOMAIN).pot
218 mkdir -p $(patsubst %/,%, $(dir $@))
219 $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $(UNIXLOCALE_$(patsubst %.lproj,%, $(notdir $(patsubst %/,%, $(dir $@))))) --stringtable-output -o $@.tmp
220 mv $@.tmp $@
222 echo-languages:
223 @echo $(foreach lang, $(LINGUAS), $(NSLOCALE_$(lang)))