[gimp-help-2: 2/3] Makefiles: let 'find' follow links



commit 8b99b4288a746f0764d059f5e40c84bd9ed76662
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date:   Wed May 20 13:37:14 2009 +0200

    Makefiles: let 'find' follow links
---
 Makefile.GNU |   24 +++++++-----------------
 Makefile.am  |   23 ++++++++---------------
 2 files changed, 15 insertions(+), 32 deletions(-)

diff --git a/Makefile.GNU b/Makefile.GNU
index dea3aca..21a230f 100644
--- a/Makefile.GNU
+++ b/Makefile.GNU
@@ -106,12 +106,12 @@ AUTHORS_DOCBOOK_STYLESHEETS = \
 
 # Files & directories
 ifneq "$(MAKECMDGOALS)" "help"
-SRC_DIRS  := $(shell cd $(srcdir) && find src $(src_dir_predicates))
-SRC_FILES := $(shell cd $(srcdir) && find src $(xml_file_predicates)) \
+SRC_DIRS  := $(shell cd $(srcdir) && $(find_l) src/ $(src_dir_predicates))
+SRC_FILES := $(shell cd $(srcdir) && $(find_l) src/ $(xml_file_predicates)) \
              $(AUTHORS_DOCBOOK_XML)
 else
-SRC_DIRS   = $(shell cd $(srcdir) && find src $(src_dir_predicates))
-SRC_FILES  = $(shell cd $(srcdir) && find src $(xml_file_predicates)) \
+SRC_DIRS   = $(shell cd $(srcdir) && $(find_l) src/ $(src_dir_predicates))
+SRC_FILES  = $(shell cd $(srcdir) && $(find_l) src/ $(xml_file_predicates)) \
              $(AUTHORS_DOCBOOK_XML)
 endif
 
@@ -326,7 +326,7 @@ pot/%.pot: src/%/*.xml
 pot: potfiles ;
 potfiles: $(POT_FILES)
 	$(msg) "--- Cleaning up pot files ..."
-	$(cmd) find pot $(file_predicates) | \
+	$(cmd) $(find_l) pot/ $(file_predicates) | \
 	while read potfile; do \
 		potfile=$${potfile#pot/}; srcfile=src/$${potfile%.pot}.xml \
 		test -e $${srcfile} || rm -f $${potfile}; \
@@ -345,7 +345,7 @@ $$($(1)_PO_FILES): po/$(1)/%.po : pot/%.pot
 	$$(cmd) if test -s $$<; then $$(call pot2po,$$<,$(1),$$@); else touch $$@; fi
 po-$(1): $$($(1)_PO_FILES)
 	$$(cmd) if test -e messages.mo; then rm -f messages.mo; fi
-	$$(cmd) find po/$(1) -name $(COMPENDIUM) -prune -o $$(file_predicates) | \
+	$$(cmd) $(find_l) po/$(1)/ -name $(COMPENDIUM) -prune -o $$(file_predicates) | \
 	while read pofile; do \
 		potfile=pot/$$$${pofile#po/$(1)/}t; \
 		test -e $$$${potfile} || rm -vf $$$${pofile}; \
@@ -473,21 +473,11 @@ xml/en: $(en_XML_FILES)
 
 # remove stale xml files
 cleanup-xml-%:
-	$(cmd) find xml/$* $(file_predicates) | \
+	$(cmd) $(find_l) xml/$*/ $(file_predicates) | \
 	while read xmlfile; do \
 		test -e src/$${xmlfile#xml/$*/} || rm -vf $${xmlfile}; \
 	done
 
-# Workaround until everybody's links in xml/en
-# have been replaced with real files.
-# TODO: remove this target after a few weeks (e.g. on 2009-05-01)
-cleanup-xml-en:
-	$(cmd) find xml/en $(file_predicates) | \
-	while read xmlfile; do \
-		test -e src/$${xmlfile#xml/en/} || rm -vf $${xmlfile}; \
-	done
-	$(cmd) find xml/$* -type l -name '*.xml' | xargs rm -vf
-
 # Target suitable for command line
 xml-en: cleanup-xml-en xml/en $(en_XML_FILES) ;
 
diff --git a/Makefile.am b/Makefile.am
index 9212081..1d0831d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,6 +42,9 @@ DBLATEXFLAGS     = --verbose
 ## DOCBOOK2ODF      = docbook2odf
 DOCBOOK2ODFFLAGS =
 
+# Standard shell commands
+find_l = find -L
+
 # Calling make recursively
 RMAKE = $(MAKE) --no-print-directory
 
@@ -116,12 +119,12 @@ AUTHORS_DOCBOOK_STYLESHEETS = \
 	stylesheets/authors_common.xsl
 
 # lists of source (XML) files and source directories
-SRC_DIRS  = $(shell cd $(srcdir) && find src $(src_dir_predicates))
-SRC_FILES = $(shell cd $(srcdir) && find src $(src_find_predicates)) \
+SRC_DIRS  = $(shell cd $(srcdir) && $(find_l) src/ $(src_dir_predicates))
+SRC_FILES = $(shell cd $(srcdir) && $(find_l) src/ $(src_find_predicates)) \
             $(AUTHORS_DOCBOOK_XML)
 
 # lists of PO files (translations)
-PO_FILES = $(shell cd $(srcdir) && find po $(file_predicates))
+PO_FILES = $(shell cd $(srcdir) && $(find_l) po/ $(file_predicates))
 
 # stylesheets for HTML
 COMMON_CSS_FILES = \
@@ -353,7 +356,7 @@ pot/%.pot: $(srcdir)/src/%/*.xml
 pot: potfiles ;
 potfiles: $(POT_FILES)
 	$(msg) "--- Cleaning up pot files ..."
-	$(cmd) find pot $(file_predicates) | \
+	$(cmd) $(find_l) pot/ $(file_predicates) | \
 	while read potfile; do \
 		potfile=$${potfile#pot/}; srcfile=src/$${potfile%.pot}.xml \
 		test -e $${srcfile} || rm -f $${potfile}; \
@@ -489,21 +492,11 @@ xml/en: $(en_XML_FILES)
 
 # remove stale xml files
 cleanup-xml-%:
-	$(cmd) find xml/$* $(file_predicates) | \
+	$(cmd) $(find_l) xml/$*/ $(file_predicates) | \
 	while read xmlfile; do \
 		test -e src/$${xmlfile#xml/$*/} || rm -vf $${xmlfile}; \
 	done
 
-# Workaround until everybody's links in xml/en
-# have been replaced with real files.
-# TODO: remove this target after a few weeks (e.g. on 2009-05-01)
-cleanup-xml-en:
-	$(cmd) find xml/en $(file_predicates) | \
-	while read xmlfile; do \
-		test -e src/$${xmlfile#xml/en/} || rm -vf $${xmlfile}; \
-	done
-	$(cmd) find xml/$* -type l -name '*.xml' | xargs rm -vf
-
 # Target suitable for command line
 xml-en: cleanup-xml-en xml/en $(en_XML_FILES) ;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]