[GRASS-dev] some backports to 6.3.0-CVS branch

Glynn Clements glynn at gclements.plus.com
Fri Oct 26 05:46:40 EDT 2007


Benjamin Ducke wrote:

> > The rule should be there in the Makefile:
> > 
> > 	RTLINC = $(ARCH_INCDIR)/rtree
> > ...	
> > 	$(RTLINC)/%.h: %.h | $(RTLINC)
> > 		$(INSTALL_DATA) $< $@
> > 
> 
> As indeed it is, but in my CVS copy (fresh checkout from 30 mins ago,
> deleted the old copy completely),
> the make rule for 'HEADERS' is in the wrong place!
> 
> It is on a line preceeding the 'lib' target, which means that
> the latter can't find it.
> 
> It needs to be moved down a few lines in the Makefile, so that
> it appears after the 'lib' target.

The positioning doesn't matter in this case. Where a variable's value
is used as a dependency, the variable must be defined prior to the
reference, but that's the case here.

However, I see what's wrong with it; it's another case where adding
dependencies to a phony target from the *.make files doesn't behave as
expected, as described in:

	http://grass.itc.it/pipermail/grass-dev/2007-October/033559.html

Essentially, both $(HEADERS) and the actual library are dependencies
of "lib", and it's unspecified which order they're built in. On my
system, $(HEADERS) get built first (otherwise I'd have noticed it by
now); on yours, the library gets built first, and fails because the
headers haven't been installed.

Using a recursive make should fix it:

--- lib/vector/rtree/Makefile	19 Oct 2007 13:45:53 -0000	1.10
+++ lib/vector/rtree/Makefile	26 Oct 2007 09:28:19 -0000
@@ -15,9 +15,8 @@
 HEADERS := $(RTLINC)/card.h $(RTLINC)/index.h $(RTLINC)/split_q.h \
 	$(ARCH_INCDIR)/rtree.h
 
-default: lib
-
-lib: $(HEADERS)
+default: $(HEADERS)
+	$(MAKE) lib
 
 $(RTLINC):
 	$(MKDIR) $@

> In addition, a "make clean" in the lib/vector/ top level
> directory results in a whole bunch of error messages
> of the form:
> 
> rm -rf OBJ.i686-pc-mingw32
> rm -f  *.tmp.html
> if [ "" != "" ] ; then \
>         for dir in  ; do \
>                 make -C $dir clean ; \
>         done ; \
> fi
> /bin/sh: -c: line 1: syntax error near unexpected token `;'
> /bin/sh: -c: line 1: `if [ "" != "" ] ; then  for dir in  ; do  make -C
> $dir clean ;  done ;  fi'
> make: [clean] Error 2 (ignored)

I'm not entirely sure what the error is here; the test should be
false, so it shouldn't be interpreting the body of the "if".

As it says, the error is ignored. It would be nice to clean that up,
but it's not critical.

What happens if you enter the following directly into the shell?

	if [ "" != "" ] ; then  for dir in  ; do  make -C $dir clean ;  done ;  fi

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list