bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

issues make vs. gmake solaris 2.5.1 (.y.o vs .y.cc rules)


From: Phil Lobbes
Subject: issues make vs. gmake solaris 2.5.1 (.y.o vs .y.cc rules)
Date: Thu, 21 Mar 2002 17:19:11 -0800

Hi again,

Sorry for the long delay in getting back to you.  I finally got to see
what was going wrong with the Solaris 2.5.1 make versus GNU make.
Below is an example of make using gcc instead of g++ after using yacc
on file pic.y:

  [groff-current] ultra% make -d src/preproc/pic
  MAKEFLAGS value:
    Building src/preproc/pic because FORCE does not exist
  MAKEFLAGS value: -d
      Building pic.o using suffix rule for .y.o because it is out of
  date relative to pic.y
  yacc  pic.y
  "pic.y", line 130: warning: redeclaration of precedence of UP.
  "pic.y", line 131: warning: redeclaration of precedence of DOWN.
  "pic.y", line 132: warning: redeclaration of precedence of RIGHT.
  "pic.y", line 133: warning: redeclaration of precedence of LEFT.
  gcc -I. -I/export/site/src/groff/groff-current/src/preproc/pic
  -I/export/site/src/groff/groff-current/src/include
  -I/export/site/src/groff/groff-current/src/include -DHAVE_CONFIG_H -g
  -O2  -c -o pic.o y.tab.c
  In file included from pic.h:22,
                   from pic.y:21:
  /export/site/src/groff/groff-current/src/include/lib.h:25: parse error
  before string constant
  /export/site/src/groff/groff-current/src/include/lib.h:32: parse error
  before `}'
  In file included from pic.h:22,
                   from pic.y:21:

I'm not even close to a "make" expert but as you can see above,
solaris 2.5.1 make wants to use the ".y.o" rule but when using GNU
make (3.77) the ".y.cc" rule from Makefile.comm gets used.  I was able
to find a work around for this problem (not sure if it's the *ideal*
solution).

My work around basically takes the logic in "y.cc" and puts that into
a ".y.o" rule (NOTE, the use of $(YTABC) below):

[groff-current] ultra% diff Makefile.comm Makefile.comm.ORIG
96,122d95
< # Default Solaris 2.5.1 make rule (for your reference)
< #.y.o:
< #      $(YACC.y) $<
< #      $(COMPILE.c) -o $@ y.tab.c
< #      $(RM) y.tab.c
<
< .y.o:
<       if test -n "$(YTABH)"; then \
<         $(YACC) $(YACCFLAGS) -d $<; \
<       else \
<         $(YACC) $(YACCFLAGS) $<; \
<       fi
<       -test -f y.tab.h && mv y.tab.h y_tab.h
<       -test -f y.tab.c && mv y.tab.c y_tab.c
<       mv y_tab.c $(YTABC)
< # Avoid ending up with two versions of $(YTABH).
<       if test -n "$(YTABH)"; then \
<         if test -f $(srcdir)/$(YTABH); then \
<           rm -f $(YTABH); \
<           mv y_tab.h $(srcdir)/$(YTABH); \
<         else \
<           mv y_tab.h $(YTABH); \
<         fi; \
<       fi
<       $(COMPILE.cc) -o $@ $(YTABC)
<       $(RM) $(YTABC)
<


That's it.  I hope this helps.

Phil
--
Phillip E. Lobbes
address@hidden

> > 1) Modify lib.h to also "#include <stdarg.h>" after line 56:
> >     #ifndef HAVE_SNPRINTF
> >     #include <stdarg.h>
> 
> Added, thanks.
> 
> > ** NOTE (thoughts on the problem but no fix): make ends up using gcc
> > to compile instead of g++, I suspect this is just an incompatibility
> > somewhere in the makefile for moving the file to pic.cc, but a simple
> > workaround for this problem is to use something like:
> >     make CC=g++ or use gmake
> 
> It seems that an internal make rule is taking precedence over the
> `.y.cc' rule in Makefile.comm -- does Sun's make program has an option
> to deactivate the built-in rules?  groff's makefiles should be
> self-contained.
> 
> Since I never got such a report please tell me which version of Sun
> make you are using.
> 
> > However, later on things again seem to break without gmake so maybe
> > it's not worth going on any more about problems using Sun's make?
> 
> It should work with Sun's make also.
> 
>     Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]