[GRASS5] dependencies issue for recompilation

hi,

we discovered that two subsequent full compilation
runs lead to a significant recompilation. We would
expect that nearly nothing is recompiled in the second
run. This seems to be a new "feature" - any ideas
where to look for that?

Markus

Markus Neteler wrote:

we discovered that two subsequent full compilation
runs lead to a significant recompilation. We would
expect that nearly nothing is recompiled in the second
run. This seems to be a new "feature" - any ideas
where to look for that?

I've committed this fix to CVS:

  Index: include/Make/Rules.make
  ===================================================================
  RCS file: /grassrepository/grass6/include/Make/Rules.make,v
  retrieving revision 1.31
  diff -u -r1.31 Rules.make
  --- include/Make/Rules.make 4 Nov 2005 08:35:06 -0000 1.31
  +++ include/Make/Rules.make 10 Mar 2006 00:37:26 -0000
  @@ -14,7 +14,7 @@
   NLS_CFLAGS=$(GETHOSTNAME) $(ZLIBINCPATH) $(PICFLAGS) $(DEFS)
   
   # default cc rules
  -$(OBJDIR)/%.o : %.c $(DEPENDENCIES) $(LOCAL_HEADERS)
  +$(OBJDIR)/%.o : %.c $(LOCAL_HEADERS)
     @test -d $(OBJDIR) || mkdir $(OBJDIR)
     $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(EXTRA_INC) $(INC) \
       -o $(OBJDIR)/$*.o -c $*.c

$(DEPENDENCIES) is the list of *libraries* on which an executable
depends.

Because libgis is rebuilt each time, anything which lists a dependency
upon $(GISDEP) (i.e. almost everything) will be re-compiled from
scratch.

The fact that libgis is rebuilt each time means that modules still
have to be re-linked, but that should be a lot quicker than
re-compiling.

The reason that libgis is rebuilt each time is that version.h is
re-installed (to dist.<arch>/include/grass) on each run, gisinit.o has
a dependency upon version.h, and libgis has a dependency upon
gisinit.o.

To eliminate the re-linking, I've committed this:

  Index: lib/gis/Makefile
  ===================================================================
  RCS file: /grassrepository/grass6/lib/gis/Makefile,v
  retrieving revision 1.43
  diff -u -r1.43 Makefile
  --- lib/gis/Makefile 7 Feb 2006 13:15:57 -0000 1.43
  +++ lib/gis/Makefile 10 Mar 2006 01:07:49 -0000
  @@ -10,8 +10,7 @@
     EXTRA_CFLAGS = -D_FILE_OFFSET_BITS=64
   endif
   
  -default: $(ARCH_INCDIR)/version.h \
  - lib \
  +default: lib \
     $(FMODE_OBJ) \
     $(ETC)/ellipse.table \
     $(ETC)/datum.table \
  @@ -27,9 +26,6 @@
     echo -e "#include <stdlib.h>\n#include <fcntl.h>\n#undef _fmode\nint _fmode = _O_BINARY;" > $(OBJDIR)/fmode.c
     $(CC) $(CFLAGS) $(INC) -o $(FMODE_OBJ) -c $(OBJDIR)/fmode.c
   
  -$(ARCH_INCDIR)/version.h:
  - echo 'static char *GRASS_VERSION_STRING = "@(#) GRASS $(GRASS_VERSION_NUMBER) ($(GRASS_VERSION_DATE))";' > $@
  -
   $(ETC)/ellipse.table: ellipse.table
     rm -f $@
     $(INSTALL) -m 644 $? $@
  @@ -113,7 +109,6 @@
   $(OBJDIR)/get_row.o: G.h
   $(OBJDIR)/get_window.o: G.h
   $(OBJDIR)/gisinit.o: G.h
  -$(OBJDIR)/gisinit.o: $(ARCH_INCDIR)/version.h
   $(OBJDIR)/maskfd.o: G.h
   $(OBJDIR)/opencell.o: G.h
   $(OBJDIR)/put_row.o: G.h

The actual fix is simply the removal of the dependency at the bottom.
The first two parts are removed because they are redundant; the
configure script generates include/version.h, and the "headers" rule
in include/Makefile installs it in $(ARCH_INCDIR).

There are still a few modules which are re-linked:

1. XDRIVER, due to winname.h being updated on each run.

2. The various mod* programs from r.support, because they are *moved*
to $(ETC) rather than installed.

3. tools/timer, because the target is $(PGM) but the rule creates
$(ETC)/$(PGM), so $(PGM) will never exist.

I'll fix those shortly.

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