[gimp-help-2] [make] Clean-up Makefiles
- From: Ulf-D. Ehlert <ulfehlert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-help-2] [make] Clean-up Makefiles
- Date: Sat, 16 Jun 2012 20:32:31 +0000 (UTC)
commit 140bc8428427f38cecb5c1cb236cb40482fb0faf
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date: Sat Jun 16 22:16:41 2012 +0200
[make] Clean-up Makefiles
Makefile.GNU | 52 ++++++++++---------------------------------
Makefile.am | 53 ++++++++++----------------------------------
make.help | 8 +++---
quickreference/Makefile.am | 18 +++++----------
4 files changed, 34 insertions(+), 97 deletions(-)
---
diff --git a/Makefile.GNU b/Makefile.GNU
index b6975ed..1cf9b78 100644
--- a/Makefile.GNU
+++ b/Makefile.GNU
@@ -197,28 +197,12 @@ xml2pot = $(XML2PO) $(XML2POFLAGS) --output='-' $(filter %.xml,$(1)) \
# $1 - input POT file
# $2 - translation language
# $3 - output PO file
-pot2po = with_compendium="$(shell $(call get_compendium,$3)) \
- $(shell $(call use_gimp_po_files,$2))"; \
- tmpfile=$(3).tmp; \
- if [ -s $(3) ]; then \
- $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
- --output-file $${tmpfile} $(3) $(1); \
- else \
+pot2po = test -e $(3) || \
$(MSGINIT) $(MSGINITFLAGS) --input $(1) --locale=$(2) --output=$(3); \
- pofile=$(3); \
- if [ -s $${pofile%/*}.po ]; then \
- $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
- --output-file $${tmpfile} $${pofile%/*}.po $(3); \
- elif [ -n "$${with_compendium}" ]; then \
- $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
- --output-file $${tmpfile} $(3) $(1); \
- else \
- $(SED) -e '/Plural-Forms:/d' $(3) > $${tmpfile}; \
- fi; \
- fi; \
- test -s $${tmpfile} && mv -f $${tmpfile} $(3) || rm -f $${tmpfile}; \
- test -s $(3) && $(MSGFMT) $(MSGFMTFLAGS) $(3) || exit 70; \
- rm -f messages.mo messages.gmo
+ with_compendium="$(shell $(call get_compendium,$3))"; \
+ $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} --update $(3) $(1) \
+ && $(MSGFMT) $(MSGFMTFLAGS) $(3) || exit 70; \
+ rm -f $(3)~ messages.mo messages.gmo
# Merge PO file into (translated) XML file
#
@@ -245,7 +229,7 @@ endif
make_target_dir = f=$(1); d=$${f%/*}; test -d $$d || $(mkdir_p) $$d
-get_recent_file = $(shell ls -t $(1) | head -n 1)
+get_recent_file = $(shell ls -t $(1) 2>/dev/null | head -n 1)
copy = $(ln_s) $(abs_srcdir)/$(1) $(2)
@@ -254,15 +238,14 @@ get_compendium = \
file="$(1)"; dir=$${file%/*}; \
while true; do \
if test -f $${dir}/$(COMPENDIUM); then \
- opt="$${opt} --compendium=$${dir}/$(COMPENDIUM)"; \
+ echo "--compendium=$${dir}/$(COMPENDIUM)"; \
fi; \
case "$${dir}" in \
po|*/po) break;; \
*/*) dir="$${dir%/*}";; \
*) break;; \
esac; \
- done; \
- if test -n "$${opt}"; then echo $${opt}; fi
+ done
else
get_compendium =
endif
@@ -300,22 +283,11 @@ help: make.help
-e '### skip comments ###' \
-e '/^#/d' \
-e '### print if no "make" variable found ###' \
- -e '/@/!b' \
+ -e '/%/!b' \
-e '### replace "make" variables ###' \
- -e 's/@LANGUAGES@/@$(strip $(LANGUAGES))@/' \
- -e 's/@LINGUAS@/@$(strip $(LINGUAS))@/' \
- -e 's/@ALL_LINGUAS@/@$(strip $(ALL_LINGUAS))@/' \
- -e '### add commas ###' \
- -e 'tloop' \
- -e ':loop' \
- -e ' ### mark value of variable (@@...@@) ###' \
- -e ' s/@\([^ ]*\)@/@@\1@@/' \
- -e ' twhile' \
- -e ' :while' \
- -e ' s/\(@@[^,@]*\) \([^ ]*@@\)/\1, \2/' \
- -e ' twhile' \
- -e ' s/@@\([^ ]*\)@@/\1/' \
- -e 'tloop' \
+ -e 's/%LANGUAGES%/%$(strip $(LANGUAGES))%/' \
+ -e 's/%LINGUAS%/%$(strip $(LINGUAS))%/' \
+ -e 's/%ALL_LINGUAS%/%$(strip $(ALL_LINGUAS))%/' \
$<
diff --git a/Makefile.am b/Makefile.am
index 3c22a71..03ea4bd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -241,29 +241,12 @@ xml2pot = $(XML2PO) $(XML2POFLAGS) --output='-' $(filter %.xml,$(1)) \
# $1 - input POT file
# $2 - translation language
# $3 - output PO file
-pot2po = with_compendium="$(shell $(call get_compendium,$3)) \
- $(shell $(call use_gimp_po_files,$2))"; \
- tmpfile=$(3).tmp; \
- if [ -s $(3) ]; then \
- $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
- --output-file $${tmpfile} $(3) $(1); \
- else \
+pot2po = test -e $(3) || \
$(MSGINIT) $(MSGINITFLAGS) --input $(1) --locale=$(2) --output=$(3); \
- pofile=$(3); \
- if [ -s $${pofile%/*}.po ]; then \
- $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
- --output-file $${tmpfile} $${pofile%/*}.po $(3); \
- elif [ -n "$${with_compendium}" ]; then \
- $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} \
- --output-file $${tmpfile} $(3) $(1); \
- else \
- $(SED) -e '/Plural-Forms:/d' $(3) > $${tmpfile}; \
- fi; \
- fi; \
- test -s $${tmpfile} && mv -f $${tmpfile} $(3) || rm -f $${tmpfile}; \
- test -s $(3) && $(MSGFMT) $(MSGFMTFLAGS) $(3); \
- rm -f messages.mo messages.gmo; \
- test -s $(3)
+ with_compendium="$(shell $(call get_compendium,$3))"; \
+ $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} --update $(3) $(1) \
+ && $(MSGFMT) $(MSGFMTFLAGS) $(3) || exit 70; \
+ rm -f $(3)~ messages.mo messages.gmo
# Merge PO file into (translated) XML file
#
@@ -304,15 +287,14 @@ copy = $(LN_S) $(abs_srcdir)/$(1) $(2)
# HIDE FROM AUTOMAKE # file="$(1)"; dir=$${file%/*}; \
# HIDE FROM AUTOMAKE # while true; do \
# HIDE FROM AUTOMAKE # if test -f $${dir}/$(COMPENDIUM); then \
-# HIDE FROM AUTOMAKE # opt="$${opt} --compendium=$${dir}/$(COMPENDIUM)"; \
+# HIDE FROM AUTOMAKE # echo "--compendium=$${dir}/$(COMPENDIUM)"; \
# HIDE FROM AUTOMAKE # fi; \
# HIDE FROM AUTOMAKE # case "$${dir}" in \
# HIDE FROM AUTOMAKE # po|*/po) break;; \
# HIDE FROM AUTOMAKE # */*) dir="$${dir%/*}";; \
# HIDE FROM AUTOMAKE # *) break;; \
# HIDE FROM AUTOMAKE # esac; \
-# HIDE FROM AUTOMAKE # done; \
-# HIDE FROM AUTOMAKE # if test -n "$${opt}"; then echo $${opt}; fi
+# HIDE FROM AUTOMAKE # done
# HIDE FROM AUTOMAKE #else
# HIDE FROM AUTOMAKE #get_compendium =
# HIDE FROM AUTOMAKE #endif
@@ -353,22 +335,11 @@ help: make.help
-e '### skip comments ###' \
-e '/^#/d' \
-e '### print if no "make" variable found ###' \
- -e '/@/!b' \
+ -e '/%/!b' \
-e '### replace "make" variables ###' \
- -e 's/@LANGUAGES@/@$(strip $(LANGUAGES))@/' \
- -e 's/@LINGUAS@/@$(strip $(LINGUAS))@/' \
- -e 's/@ALL_LINGUAS@/@$(strip $(ALL_LINGUAS))@/' \
- -e '### add commas ###' \
- -e 'tloop' \
- -e ':loop' \
- -e ' ### mark value of variable (@@...@@) ###' \
- -e ' s/@\([^ ]*\)@/@@\1@@/' \
- -e ' twhile' \
- -e ' :while' \
- -e ' s/\(@@[^,@]*\) \([^ ]*@@\)/\1, \2/' \
- -e ' twhile' \
- -e ' s/@@\([^ ]*\)@@/\1/' \
- -e 'tloop' \
+ -e 's/%LANGUAGES%/%$(strip $(LANGUAGES))%/' \
+ -e 's/%LINGUAS%/%$(strip $(LINGUAS))%/' \
+ -e 's/%ALL_LINGUAS%/%$(strip $(ALL_LINGUAS))%/' \
$<
.PHONY: help
@@ -585,7 +556,7 @@ po: $(foreach LANG,$(PO_LANGS),po-$(LANG)) ;
# HIDE FROM AUTOMAKE #
# HIDE FROM AUTOMAKE ## This is indirectly used as HTML and PDF prerequisite:
# HIDE FROM AUTOMAKE #xml/$(1): $$($(1)_XML_FILES) | xml/$(1)/images
-# HIDE FROM AUTOMAKE # $$(cmd) test -d $$@ && touch $$@ || $(mkdir_p) $$@
+# HIDE FROM AUTOMAKE # $$(cmd) test -d $$@ && touch $$@ || $(MKDIR_P) $$@
# HIDE FROM AUTOMAKE #
# HIDE FROM AUTOMAKE ## Targets suitable for command line
# HIDE FROM AUTOMAKE #xml-$(1): po-$(1) xml/$(1) cleanup-xml-$(1) ;
diff --git a/make.help b/make.help
index 0de5ed9..0825be2 100644
--- a/make.help
+++ b/make.help
@@ -2,7 +2,7 @@
#
# This text will be printed when you type
# make [...] help
-# where @LANGUAGES@ (and @ALL_LINGUAS@ & @LINGUAS@) are
+# where %LANGUAGES% (and %ALL_LINGUAS% & %LINGUAS%) are
# replaced with the value of the respective 'make' variable
# and lines starting with '#' (comments) are skipped.
#
@@ -13,7 +13,7 @@ Default (main) targets:
all Create/update HTML manual (and AUTHORS file)
(equivalent to "make [..] html AUTHORS" or "make [..]")
html Create/update HTML manual for all languages
- (@LANGUAGES@)
+ (%LANGUAGES%)
AUTHORS Create/update AUTHORS file
Language-specific targets for making the GIMP-manual:
@@ -22,7 +22,7 @@ Language-specific targets for making the GIMP-manual:
odf-LANG Build ODF for language LANG (implies xml-LANG)
Omitting LANG (e.g."make [..] html") is equivalent to making target
- for all languages: @LANGUAGES@
+ for all languages: %LANGUAGES%
WARNING: Making HTML (or PDF, ODF, XML) will automatically update
------- po files if necessary. This may lead to unintended commits
@@ -64,7 +64,7 @@ Special (helper) targets for build-system development:
Make variables (can be overriden at command-line):
LINGUAS="..." Space-separated list of manual languages (e.g. "en de fr"),
- restricted to ALL_LINGUAS= ALL_LINGUAS@
+ restricted to ALL_LINGUAS=%ALL_LINGUAS%
LANGUAGES="..." Space-separated list of manual languages (e.g. "en de fr"),
overriding ALL_LINGUAS
VERBOSE=0|1|2 Controls the amount of output messages:
diff --git a/quickreference/Makefile.am b/quickreference/Makefile.am
index 94f820a..80b39e0 100644
--- a/quickreference/Makefile.am
+++ b/quickreference/Makefile.am
@@ -35,17 +35,11 @@ po/%.po: po/gimp-keys.pot
if [ -f $(top_srcdir)/po/$*/$(COMPENDIUM) ]; then \
with_compendium="--compendium=$(top_srcdir)/po/$*/$(COMPENDIUM)"; \
fi; \
- if [ -d "$(GIMP_PO_ROOT)" ]; then \
- for po in $(GIMP_PO_ROOT)/po*/$*.po; do \
- with_gimp="$${with_gimp} --compendium=$${po}"; \
- done; \
- fi; \
if [ ! -s $@ ]; then \
$(MSGINIT) $(MSGINITFLAGS) --input=$< --locale=$* --output=$@; \
fi; \
- $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} $${with_gimp} \
- --update $@ $<; \
- test -s $@
+ $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} --update $@ $<; \
+ rm -f $ ~
.PHONY: pot po-% po
pot: po/gimp-keys.pot ;
@@ -53,18 +47,18 @@ po-%: po/%.po ;
po: $(foreach lang,$(filter-out en,$(QUICKREFERENCE_LINGUAS)),po-$(lang)) ;
xml/gimp-keys-%.xml: po/%.po gimp-keys.xml
- $(mkdir_p) xml
+ $(MKDIR_P) xml
$(XML2PO) -p $< $(srcdir)/gimp-keys.xml > $@
# English is a special case
#
.INTERMEDIATE: xml/gimp-keys-en.xml
xml/gimp-keys-en.xml: gimp-keys.xml
- $(mkdir_p) xml; \
+ $(MKDIR_P) xml; \
cp $< $@
svg/gimp-keys-%.svg: xml/gimp-keys-%.xml stylesheets/keys-svg.xsl
- $(mkdir_p) svg
+ $(MKDIR_P) svg
$(XSLTPROC) \
$(srcdir)/stylesheets/keys-svg.xsl \
$< \
@@ -73,7 +67,7 @@ svg/gimp-keys-%.svg: xml/gimp-keys-%.xml stylesheets/keys-svg.xsl
svg: $(foreach lang,$(QUICKREFERENCE_LINGUAS),svg/gimp-keys-$(lang).svg)
docbook/gimp-keys-%.xml: xml/gimp-keys-%.xml stylesheets/keys-docbook.xsl
- $(mkdir_p) docbook
+ $(MKDIR_P) docbook
$(XSLTPROC) \
$(srcdir)/stylesheets/keys-docbook.xsl \
$< \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]