[GRASS5] G57 compile errors in r.mapcalc
Glynn Clements
glynn.clements at virgin.net
Mon May 24 12:04:14 EDT 2004
Markus Neteler wrote:
> > It appears that y.tab.c was to be placed into the OBJ dir, but the OBJ
> > dir was not yet created. Also, it doesn't seem like y.tab.c should be
> > place into the OBJ dir at all.
> >
> > So I changed:
> >
> > y.tab.c y.tab.h: mapcalc.y
> > $(YACC) -b $(OBJDIR)/y -d mapcalc.y
> > $(MKDIR) $(OBJDIR)
> > $(CC) $(LDFLAGS) $(INC) $(XTRA_LDFLAGS) -o $(OBJDIR)/$*.o -c
> > $*.c
> >
> > to:
> >
> > y.tab.c y.tab.h: mapcalc.y
> > $(MKDIR) $(OBJDIR)
> > $(YACC) -b y -d mapcalc.y
> > $(CC) $(LDFLAGS) $(INC) $(XTRA_LDFLAGS) -o $(OBJDIR)/$*.o -c
> > $*.c
> >
> > And it works for me.
>
> I have submitted a similar change. Please try again.
> (Anyone knowing more about this may teach me...).
OK; the original rule was:
y.tab.c y.tab.h: mapcalc.y
$(YACC) -d mapcalc.y
\mkdir -p $(OBJDIR)
$(CC) $(LDFLAGS) $(INC) $(XTRA_LDFLAGS) -o $(OBJDIR)/$*.o -c $*.c
This was changed to put y.tab.[ch] into $(OBJDIR):
y.tab.c y.tab.h: mapcalc.y
$(YACC) -b $(OBJDIR)/y -d mapcalc.y
$(MKDIR) $(OBJDIR)
$(CC) $(LDFLAGS) $(INC) $(XTRA_LDFLAGS) -o $(OBJDIR)/$*.o -c $*.c
This won't work because:
a) the rule's targets are y.tab.c and y.tab.h, but it's actually
creating $(OBJDIR)/y.tab.c and $(OBJDIR)/y.tab.h.
b) The compilation command is still compiling y.tab.c, not
$(OBJDIR)/y.tab.c, and there don't appear to be any compiler switches
to force the compiler to look in $(OBJDIR) for y.tab.h.
c) $(OBJDIR) isn't created until after $(YACC) has been told to put
its output files there.
In Funkmeister's case, the new Makefile was creating the new
y.tab.[ch] files (based upon the new mapcalc.y, which was changed to
support r3.mapcalc) in a different directory, then using the old
y.tab.[ch] (left over from a previous build) instead.
So, as Funkmeister noted, you essentially need to revert the changes:
y.tab.c y.tab.h: mapcalc.y
$(MKDIR) $(OBJDIR)
$(YACC) -b y -d mapcalc.y
$(CC) $(LDFLAGS) $(INC) $(XTRA_LDFLAGS) -o $(OBJDIR)/$*.o -c $*.c
This is almost identical to the original version, except that \mkdir
is replaced with $(MKDIR), and becomes the first command.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-dev
mailing list