Dan Nicholson <[email protected]> writes:
> On Tue, Nov 24, 2009 at 12:37 PM, tom fogal <[email protected]> wrote:
> > Dan Nicholson <[email protected]> writes:
> >> On Thu, Nov 19, 2009 at 8:28 AM, Brian Paul <[email protected]> wrote:
> >> > tom fogal wrote:
> >> >> Brian Paul <[email protected]> writes:
> >> >>> Please test and report any problems ASAP.  If there aren't any issues
> >> >>> we'd like to release 7.6.1 on Friday or Saturday.
> > [snip]
> >> >> Secondly, the AIX build is failing in progs/Makefile.
> >
> >  PROGRAM_DIRS =
> >                ^ (there's a space here [1] ;)
> >
> > in a config/ though. *shrug*.  As I said, it doesn't matter much for
> > me.
> 
> Actually, I don't know why this is a problem. On my system with GNU
> make (which you're using, too) having just spaces after the = gets
> stripped.

We're using the native make on AIX, not GNU make.

Speaking of which, I guess AIX make *does* support $(strip ...).

> $ cat > Makefile << "EOF"
> DIRS =      # bunch of spaces here
> SUBDIRS = $(DIRS)
> dirs:
>         @echo '"$(SUBDIRS)"'
>         @test -n "$(SUBDIRS)" && echo non-empty || echo empty
> EOF
> $ make dirs

This test does in fact work fine.

However, if you do:
  @for d in "$(SUBDIRS)" ; do \
    echo "$$d" \
  done
after the @test -n line, AIX make chokes.

> What is the actual error you're seeing?

  -bash-3.00$ cat Makefile 
  DIRS = 
  SUBDIRS = $(DIRS)
  dirs:
          @echo '"$(SUBDIRS)"'
          @test -n "$(SUBDIRS)" && echo non-empty || echo empty
          @for dir in $(SUBDIRS) ; do \
                  echo "$$dir" \
          done
  -bash-3.00$ make
  ""
  empty
  /usr/bin/sh: 0403-057 Syntax error at line 1 : `;' is not expected.
  make: 1254-004 The error code from the last command is 2.


  Stop.
  -bash-3.00$

If I quote the $(SUBDIRS) in the @for line, I get the error "`for' is
not matched.".

> 31f7e8efb25a77e3bdfb6e9850cf31e339060976 is definitely correct as the
> quotes would cause all the directories to be a single argument. Can
> you try the automake way, which I believe is used to workaround this
> exact issue? It constructs the for loop using a shell variable instead
> of a make variable.
> 
> subdirs:
>         @list='$(SUBDIRS)'; for dir in $$list; do echo $$dir; done

This works great with AIX (and of course GNU) make.

> >> Tom, what arguments do you pass to configure?
> >
> > FWIW on AIX we do something like this:
> >
> >  ./configure CC=xlc CXX=xlC CFLAGS=-qcpluscmt -qlanglvl=extc99
> >  -DUSE_MGL_NAMESPACE CXXFLAGS=-DUSE_MGL_NAMESPACE
> >  --prefix=/usr/common/homes/f/fogal1/sw
> >  --without-demos --with-driver=xxx --disable-gallium --with-max-width=16384
> >  --with-max-height=16384 --disable-glw --disable-glu --disable-egl
> >
> > Except it happens twice, the first time with xxx=xlib and the latter
> > with xxx=osmesa.  If you're *really* curious, see the function
> > 'build_mesa' in:
> >
> >  http://portal.nersc.gov/svn/visit/trunk/src/svn_bin/build_visit
> 
> That's strange since --without-demos will substitute PROGRAM_DIRS="".
> I think there's something else funky going on.

The issue is SUBDIRS = $(PROGRAM_DIRS) in progs/Makefile, I think (but
haven't verified).  That seems to cause AIX make to think that SUBDIRS
is a string with a single space, which != the empty string, and thus
the test -n fails.

I like your automake-esque solution.  How's the attached patch?  Note
that I tested the approach but not Mesa on AIX yet (please don't
apply).

-tom

From 8e97a68d0f85d72f81f4652dcfd0cb1665beec87 Mon Sep 17 00:00:00 2001
From: Tom Fogal <[email protected]>
Date: Tue, 24 Nov 2009 16:46:31 -0700
Subject: [PATCH] RFC: Simplify hackery added to fix AIX build.

Borrow an idiom from the GNU build system which can handle `for'
loops over empty lists.
---
 progs/Makefile |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/progs/Makefile b/progs/Makefile
index d5852fa..5bc444e 100644
--- a/progs/Makefile
+++ b/progs/Makefile
@@ -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
-- 
1.6.3.3

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to