diff options
author | Carl Worth <[email protected]> | 2012-12-03 15:43:19 -0800 |
---|---|---|
committer | Carl Worth <[email protected]> | 2013-01-11 13:54:54 -0800 |
commit | b587a7595e7aae0809a8e7392e89c39df0c955b1 (patch) | |
tree | cf73d53420456623ec9974cc9ee52e5ee04b07bc /src/mesa/drivers/dri/common/xmlpool/Makefile.am | |
parent | 8888c6f8e50f3e5e316d2f41556162bec9a685d4 (diff) |
driconf: Add translation-generation to build system, don't track generated files
Previously, the xmlpool directory had a lone Makefile to assist poeple in
manually invoking a deep make in order to update the translations in
options.h. We can observe that this wasn't happening in fact, (new
translations had been added to de.po without being generated into options.h,
and new options had been manually added directly to options.h rather than to
t_options.h).
Prevent both of these problems from occurring in the future by automatically
generating options.h as part of the standard build of mesa.
For this, the generated options.h is now removed from version control, (along
with Makefile in favor of Makefile.am).
[chadv: Port the Autotools changes to Android.]
Signed-off-by: Chad Versace <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/common/xmlpool/Makefile.am')
-rw-r--r-- | src/mesa/drivers/dri/common/xmlpool/Makefile.am | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/common/xmlpool/Makefile.am b/src/mesa/drivers/dri/common/xmlpool/Makefile.am new file mode 100644 index 00000000000..526ae932069 --- /dev/null +++ b/src/mesa/drivers/dri/common/xmlpool/Makefile.am @@ -0,0 +1,96 @@ +# Convenient makefile for managing translations. + +# Prerequisites: +# - GNU gettext +# - Python + +# Adding new translations +# ----------------------- + +# To start working on a new translation edit the POS=... line +# below. If you want to add for example a french translation, add +# fr.po. + +# Then run "make po" to generate a fresh .po file from translatable +# strings in t_options.h. Now you can edit the new .po file (fr.po in +# the example above) to translate the strings. Please make sure that +# your editor encodes the file in UTF-8. + +# Updating existing translations +# ------------------------------ + +# Run "make po" to update .po files with new translatable strings from +# t_options.h. Now you can edit the .po files you're interested +# in. Please make sure that your editor encodes the file in UTF-8. + +# Updating options.h +# ------------------ + +# Finally run "make" to generate options.h from t_options.h with all +# translations. Now you can rebuild the drivers. Any common options +# used by the drivers will have option descriptions with the latest +# translations. + +# Publishing translations +# ----------------------- + +# To get your translation(s) into Mesa CVS, please send me your +# <lang>.po file. + +# More information: +# - info gettext + +# The set of supported languages. Add languages as needed. +POS=de.po es.po nl.po fr.po sv.po + +# +# Don't change anything below, unless you know what you're doing. +# +LANGS=$(POS:%.po=%) +MOS=$(POS:%.po=%/LC_MESSAGES/options.mo) +POT=xmlpool.pot + +.PHONY: all clean pot po mo + +all: options.h + +# All generated files are cleaned up. +clean: + -rm -f $(POT) options.h *~ + -rm -rf $(LANGS) + +# Default target options.h +options.h: LOCALEDIR := . +options.h: t_options.h mo + $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/gen_xmlpool.py t_options.h $(LOCALEDIR) $(LANGS) > options.h + +# Update .mo files from the corresponding .po files. +mo: + @for mo in $(MOS); do \ + lang=$${mo%%/*}; \ + echo "Updating $$mo from $$lang.po."; \ + mkdir -p $${mo%/*}; \ + msgfmt -o $$mo $$lang.po; \ + done + +# Use this target to create or update .po files with new messages in +# driconf.py. +po: $(POS) + +pot: $(POT) + +# Extract message catalog from driconf.py. +$(POT): t_options.h + xgettext -L C --from-code utf-8 -o $(POT) t_options.h + +# Create or update a .po file for a specific language. +%.po: $(POT) + @if [ -f $@ ]; then \ + echo "Merging new strings from $(POT) into $@."; \ + mv $@ $@~; \ + msgmerge -o $@ $@~ $(POT); \ + else \ + echo "Initializing $@ from $(POT)."; \ + msginit -i $(POT) -o $@~ --locale=$*; \ + sed -e 's/charset=.*\\n/charset=UTF-8\\n/' $@~ > $@; \ + fi |