Mesa (mesa_7_6_branch): Fix build when PROGRAM_DIRS is empty.

Brian Paul brianp at kemper.freedesktop.org
Tue Oct 13 22:22:40 UTC 2009


Module: Mesa
Branch: mesa_7_6_branch
Commit: 115edf24a9128b79dfa5f30482c990e2cb898357
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=115edf24a9128b79dfa5f30482c990e2cb898357

Author: Tom Fogal <tfogal at alumni.unh.edu>
Date:   Tue Oct 13 10:55:34 2009 -0700

Fix build when PROGRAM_DIRS is empty.

SUBDIRS just takes PROGRAM_DIRS value.  If PROGRAM_DIRS gets set
to the empty string (as can happen when building only OSMesa), a
'for' loop will lack anything to iterate over, causing a parse
error.

This fixes the issue by making sure SUBDIRS is the null string
when PROGRAM_DIRS is, and wrapping the for loops in if's, causing
them only to execute if there are directories to iterate over.

---

 progs/Makefile |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/progs/Makefile b/progs/Makefile
index c99f4ee..064e5a2 100644
--- a/progs/Makefile
+++ b/progs/Makefile
@@ -4,7 +4,7 @@ TOP = ..
 
 include $(TOP)/configs/current
 
-SUBDIRS = $(PROGRAM_DIRS)
+SUBDIRS ="$(PROGRAM_DIRS)"
 
 
 default: message subdirs
@@ -15,18 +15,22 @@ message:
 
 
 subdirs:
-	@for dir in $(SUBDIRS) ; do \
-		if [ -d $$dir ] ; then \
-			(cd $$dir && $(MAKE)) || exit 1 ; \
-		fi \
-	done
+	@if test -n "$(SUBDIRS)" ; then \
+		for dir in $(SUBDIRS) ; do \
+			if [ -d $$dir ] ; then \
+				(cd $$dir && $(MAKE)) || exit 1 ; \
+			fi \
+		done \
+	fi
 
 # Dummy install target
 install:
 
 clean:
-	- at for dir in $(SUBDIRS) tests ; do \
-		if [ -d $$dir ] ; then \
-			(cd $$dir && $(MAKE) clean) ; \
-		fi \
-	done
+	- at if test -n "$(SUBDIRS)" ; then \
+		for dir in $(SUBDIRS) tests ; do \
+			if [ -d $$dir ] ; then \
+				(cd $$dir && $(MAKE) clean) ; \
+			fi \
+		done \
+	fi




More information about the mesa-commit mailing list