Simplify hackery added to fix AIX build.
authorTom Fogal <tfogal@alumni.unh.edu>
Tue, 24 Nov 2009 23:46:31 +0000 (16:46 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 1 Dec 2009 18:27:27 +0000 (10:27 -0800)
Borrow an idiom from the GNU build system which can handle `for'
loops over empty lists.

progs/Makefile

index d5852fa416cd4bde57abe88475148513ed8bb7ed..5bc444e952425d52ca50038329688d6ba36ceb97 100644 (file)
@@ -4,7 +4,7 @@ TOP = ..
 
 include $(TOP)/configs/current
 
-SUBDIRS = "$(strip "$(PROGRAM_DIRS)")"
+SUBDIRS = $(PROGRAM_DIRS)
 
 
 default: message subdirs
@@ -15,22 +15,18 @@ message:
 
 
 subdirs:
-       @if test -n "$(SUBDIRS)" ; then \
-               for dir in $(SUBDIRS) ; do \
-                       if [ -d $$dir ] ; then \
-                               (cd $$dir && $(MAKE)) || exit 1 ; \
-                       fi \
-               done \
-       fi
+       @list='$(SUBDIRS)'; for dir in $$list ; do \
+               if [ -d $$dir ] ; then \
+                       (cd $$dir && $(MAKE)) || exit 1 ; \
+               fi \
+       done
 
 # Dummy install target
 install:
 
 clean:
-       -@if test -n "$(SUBDIRS)" ; then \
-               for dir in $(SUBDIRS) tests ; do \
-                       if [ -d $$dir ] ; then \
-                               (cd $$dir && $(MAKE) clean) ; \
-                       fi \
-               done \
-       fi
+       @list='$(SUBDIRS)'; for dir in $$list tests ; do \
+               if [ -d $$dir ] ; then \
+                       (cd $$dir && $(MAKE) clean) ; \
+               fi \
+       done