[gimp-help-2] [make] Add feature: force making pot files
- From: Ulf-D. Ehlert <ulfehlert src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp-help-2] [make] Add feature: force making pot files
- Date: Sun, 24 Jan 2010 18:54:27 +0000 (UTC)
commit 43512eed27e7404b273d9f3854354f31e86e3dea
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date: Sun Jan 17 18:54:59 2010 +0100
[make] Add feature: force making pot files
Force updating pot files which are explicitely specified as targets.
Makefile.GNU | 53 +++++++++++++++++++++++++++++++++++------------------
Makefile.am | 51 ++++++++++++++++++++++++++++++++-------------------
2 files changed, 67 insertions(+), 37 deletions(-)
---
diff --git a/Makefile.GNU b/Makefile.GNU
index 2141819..e6ff683 100644
--- a/Makefile.GNU
+++ b/Makefile.GNU
@@ -82,7 +82,9 @@ xml_file_predicates = -name '*.xml'
# List of authors and contributors (no DocBook)
AUTHORS_SOURCE_XML = stylesheets/authors.xml
# Automatically generated authors section (DocBook)
-AUTHORS_DOCBOOK_XML = src/preface/authors.xml
+AUTHORS_DOCBOOK_XML = src/preface/authors.xml
+AUTHORS_DOCBOOK_DIRNAME = $(dir $(AUTHORS_DOCBOOK_XML))
+AUTHORS_DOCBOOK_FILENAME = $(notdir $(AUTHORS_DOCBOOK_XML))
# Stylesheets generating AUTHORS
AUTHORS_TEXT_STYLESHEETS = \
stylesheets/authors_text.xsl \
@@ -316,33 +318,42 @@ help: make.help
#### Make pot files: XML(en) --> POT ####
########################################################################
-# xmldir/path/to/file/*.xml --> potdir/path/to/file.pot
+# src/path/to/file/*.xml --> pot/path/to/file.pot
POT_FILES = $(patsubst src/%,pot/%.pot,$(filter-out src src/,$(SRC_DIRS)))
-# Special case
+# Special case: src/*.xml --> pot/gimp.pot
POT_FILES += pot/gimp.pot
-# Special case
-pot/gimp.pot: src/*.xml
+# General case
+ifeq ($(filter pot/%.pot,$(MAKECMDGOALS)),)
+pot/%.pot: src/%/*.xml
+else
+pot/%.pot: src/%/*.xml FORCE
+endif
$(cmd) $(call make_target_dir,$@)
$(msg) "[POT] $@"
- $(cmd) $(call xml2pot,$^,$@)
-# Special case: pot file for the authors DocBook file
-# (src/preface/authors.xml, but this may change...)
-# TODO: is there a better way?
-AUTHORS_POT = $(AUTHORS_DOCBOOK_XML:src/%/$(notdir $(AUTHORS_DOCBOOK_XML))=pot/%.pot)
-$(AUTHORS_POT): $(AUTHORS_DOCBOOK_XML) $(wildcard $(dir $(AUTHORS_DOCBOOK_XML))*.xml)
+ $(cmd) $(call xml2pot,$(filter-out FORCE,$^),$@)
+# Special case: rename pot file for toplevel xml files
+ifeq ($(filter pot/%.pot,$(MAKECMDGOALS)),)
+pot/gimp.pot: src/*.xml
+else
+pot/gimp.pot: src/*.xml FORCE
+endif
$(cmd) $(call make_target_dir,$@)
$(msg) "[POT] $@"
- $(cmd) $(call xml2pot,$^,$@)
-pot/%.pot: src/%/*.xml
+ $(cmd) $(call xml2pot,$(filter-out FORCE,$^),$@)
+# Special case: pot file for the authors DocBook file
+# requires an additional prerequisite
+AUTHORS_POT = $(AUTHORS_DOCBOOK_XML:src/%/$(AUTHORS_DOCBOOK_FILENAME)=pot/%.pot)
+ifeq ($(filter pot/%.pot,$(MAKECMDGOALS)),)
+$(AUTHORS_POT): $(AUTHORS_DOCBOOK_XML) $(wildcard $(AUTHORS_DOCBOOK_DIRNAME)*.xml)
+else
+$(AUTHORS_POT): $(AUTHORS_DOCBOOK_XML) $(wildcard $(AUTHORS_DOCBOOK_DIRNAME)*.xml) FORCE
+endif
$(cmd) $(call make_target_dir,$@)
$(msg) "[POT] $@"
- $(cmd) $(call xml2pot,$^,$@)
+ $(cmd) $(call xml2pot,$(filter-out FORCE,$^),$@)
-# Targets suitable for command line
-# ("make pot" will work even if pot exists)
-pot: potfiles cleanup-pot ;
-potfiles: $(POT_FILES) ;
+# Remove left over po files
cleanup-pot:
$(msg) "Cleaning up pot files ..."
$(cmd) $(find_l) pot/ $(pot_file_predicates) | \
@@ -351,6 +362,12 @@ cleanup-pot:
test -e $${srcfile} || rm -f $${potfile}; \
done
+# Targets suitable for command line
+pot: potfiles cleanup-pot ;
+potfiles: $(POT_FILES) ;
+
+.PHONY: pot potfiles cleanup-pot
+
########################################################################
#### Make po files: POT --> PO ####
diff --git a/Makefile.am b/Makefile.am
index 1066bfc..ce82f83 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -347,36 +347,43 @@ $(AUTHORS_DOCBOOK_XML): $(AUTHORS_DATA_XML) $(AUTHORS_DOCBOOK_STYLESHEETS)
########################################################################
#### Make pot files: XML(en) --> POT ####
########################################################################
-#
+
# src/path/to/file/*.xml --> pot/path/to/file.pot
POT_FILES = $(patsubst src/%,pot/%.pot,$(filter-out src src/,$(SRC_DIRS)))
# Special case: src/*.xml --> pot/gimp.pot
POT_FILES += pot/gimp.pot
# General case
-pot/%.pot: $(srcdir)/src/%/*.xml
- $(cmd) $(call make_target_dir,$@)
- $(msg) "[POT] $@"
- $(cmd) $(call xml2pot,$^,$@)
+# HIDE FROM AUTOMAKE #ifeq ($(filter pot/%.pot,$(MAKECMDGOALS)),)
+# HIDE FROM AUTOMAKE #pot/%.pot: $(srcdir)/src/%/*.xml
+# HIDE FROM AUTOMAKE #else
+# HIDE FROM AUTOMAKE #pot/%.pot: $(srcdir)/src/%/*.xml FORCE
+# HIDE FROM AUTOMAKE #endif
+# HIDE FROM AUTOMAKE # $(cmd) $(call make_target_dir,$@)
+# HIDE FROM AUTOMAKE # $(msg) "[POT] $@"
+# HIDE FROM AUTOMAKE # $(cmd) $(call xml2pot,$(filter-out FORCE,$^),$@)
# Special case: rename pot file for toplevel xml files
-pot/gimp.pot: $(srcdir)/src/*.xml
- $(cmd) $(call make_target_dir,$@)
- $(msg) "[POT] $@"
- $(cmd) $(call xml2pot,$^,$@)
+# HIDE FROM AUTOMAKE #ifeq ($(filter pot/%.pot,$(MAKECMDGOALS)),)
+# HIDE FROM AUTOMAKE #pot/gimp.pot: $(srcdir)/src/*.xml
+# HIDE FROM AUTOMAKE #else
+# HIDE FROM AUTOMAKE #pot/gimp.pot: $(srcdir)/src/*.xml FORCE
+# HIDE FROM AUTOMAKE #endif
+# HIDE FROM AUTOMAKE # $(cmd) $(call make_target_dir,$@)
+# HIDE FROM AUTOMAKE # $(msg) "[POT] $@"
+# HIDE FROM AUTOMAKE # $(cmd) $(call xml2pot,$^,$@)
# Special case: pot file for the authors DocBook file
# requires an additional prerequisite
AUTHORS_POT = $(AUTHORS_DOCBOOK_XML:src/%/$(AUTHORS_DOCBOOK_FILENAME)=pot/%.pot)
-$(AUTHORS_POT): $(AUTHORS_DOCBOOK_XML) $(wildcard $(AUTHORS_DOCBOOK_DIRNAME)/*.xml)
- $(cmd) $(call make_target_dir,$@)
- $(msg) "[POT] $@"
- $(cmd) $(call xml2pot,$^,$@)
- $(cmd) touch -c -r `ls -t $^ | $(SED) 1q` $@ || true
-
-# Targets suitable for command line
-# ("make pot" will work even if pot exists)
-pot: potfiles cleanup-pot ;
-potfiles: $(POT_FILES) ;
+# HIDE FROM AUTOMAKE #ifeq ($(filter pot/%.pot,$(MAKECMDGOALS)),)
+# HIDE FROM AUTOMAKE #$(AUTHORS_POT): $(AUTHORS_DOCBOOK_XML) $(wildcard $(AUTHORS_DOCBOOK_DIRNAME)*.xml)
+# HIDE FROM AUTOMAKE #else
+# HIDE FROM AUTOMAKE #$(AUTHORS_POT): $(AUTHORS_DOCBOOK_XML) $(wildcard $(AUTHORS_DOCBOOK_DIRNAME)*.xml) FORCE
+# HIDE FROM AUTOMAKE #endif
+# HIDE FROM AUTOMAKE # $(cmd) $(call make_target_dir,$@)
+# HIDE FROM AUTOMAKE # $(msg) "[POT] $@"
+# HIDE FROM AUTOMAKE # $(cmd) $(call xml2pot,$(filter-out FORCE,$^),$@)
+# Remove left over po files
cleanup-pot:
$(msg) "Cleaning up pot files ..."
$(cmd) $(find_l) pot/ $(pot_file_predicates) | \
@@ -385,6 +392,12 @@ cleanup-pot:
test -e $${srcfile} || rm -f $${potfile}; \
done
+# Targets suitable for command line
+pot: potfiles cleanup-pot ;
+potfiles: $(POT_FILES) ;
+
+.PHONY: pot potfiles cleanup-pot
+
########################################################################
#### Make po files: POT --> PO ####
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]