[comp.sources.bugs] watcher

mkhaw@teknowledge-vaxc.UUCP (11/02/87)

The watcher program has a defs.h file that #include's "y.tab.h", but
there is no y.tab.h in the distribution, and the MANIFEST file doesn't
mention it either.  Make terminates (very early) with an error because
y.tab.h is missing.

Mike Khaw
-- 
internet:  mkhaw@teknowledge-vaxc.arpa
usenet:	   {uunet|sun|ucbvax|decwrl|uw-beaver}!mkhaw%teknowledge-vaxc.arpa
USnail:	   Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303

larry@kitty.UUCP (11/02/87)

In article <18476@teknowledge-vaxc.ARPA>, mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes:
> The watcher program has a defs.h file that #include's "y.tab.h", but
> there is no y.tab.h in the distribution, and the MANIFEST file doesn't
> mention it either.  Make terminates (very early) with an error because
> y.tab.h is missing.

	Hang your head in shame - but don't feel bad for too long, since we
were all in your shoes, once-upon-a-time. :-)
	`y.tab.h' is the output of yacc invoked with the -d option to produce
a define file for token names; a `y.tab.h' file would almost never be
distributed with source code, as it is intended to be created by yacc at the
time of compilation.  You will also discover that `y.tab.c' is also missing;
this file is the C-language output file of yacc, and is created when yacc is
executed.
	If you examine the makefile, you will see that all that is needed
to produce y.tab.c and y.tab.h is to execute the command `make y.tab.c';
this automatically invokes yacc.  Many people write a makefile to explicilty
invoke yacc upon first time execution; this author did not, for whatever
reason - so it requires a separate invocation of make.

<>  Larry Lippman @ Recognition Research Corp., Clarence, New York
<>  UUCP:  {allegra|ames|boulder|decvax|rutgers|watmath}!sunybcs!kitty!larry
<>  VOICE: 716/688-1231       {hplabs|ihnp4|mtune|seismo|utzoo}!/
<>  FAX:   716/741-9635 {G1,G2,G3 modes}   "Have you hugged your cat today?" 

mkhaw@teknowledge-vaxc.UUCP (11/02/87)

in article <2189@kitty.UUCP>, larry@kitty.UUCP (Larry Lippman) says:
+ 	Hang your head in shame - but don't feel bad for too long, since we
+ were all in your shoes, once-upon-a-time. :-)
...
+ 	If you examine the makefile, you will see that all that is needed
+ to produce y.tab.c and y.tab.h is to execute the command `make y.tab.c';
+ this automatically invokes yacc.  Many people write a makefile to explicilty

Thanks for enlightening this yacc-ignoramus.

Mike Khaw
-- 
internet:  mkhaw@teknowledge-vaxc.arpa
usenet:	   {uunet|sun|ucbvax|decwrl|uw-beaver}!mkhaw%teknowledge-vaxc.arpa
USnail:	   Teknowledge Inc, 1850 Embarcadero Rd, POB 10119, Palo Alto, CA 94303

stevo@jane.Jpl.Nasa.Gov (Steve Groom) (11/02/87)

In article <18476@teknowledge-vaxc.ARPA> mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes:
>The watcher program has a defs.h file that #include's "y.tab.h", but
>there is no y.tab.h in the distribution, and the MANIFEST file doesn't
>mention it either.  Make terminates (very early) with an error because
>y.tab.h is missing.

I had the same problem, but the workaround is very simple. y.tab.h is a
file generated by yacc. This means that what really needs to happen is
for yacc to be run before anything that #include's y.tab.h is
compiled.  One way to do this is to add y.tab.h to the list of things
that watcher depends on, like this:
    watcher: y.tab.h $(OBJS)
or something like that (I've forgotten exactly what the fix was).  If
all else fails, try running the yacc step manually, and then running
make again.

BTW, I reported this to watcher's author (Kenneth Ingham,
ingham@charon.unm.edu) and he tells me that the makefile worked fine on
his system as it was distributed. Make does things a little differently
between systems sometimes, so that a deficient makefile might work fine
on some systems and bomb on others. Note I said 'deficient' - I believe
that the distributed makefile really should have included watcher's
dependency on y.tab.h.
/* Steve Groom, Jet Propulsion Laboratory, Pasadena, CA 91109
 * ARPA: stevo@elroy.jpl.nasa.gov   UUCP: ..!cit-vax!elroy!stevo
 * Disclaimer: (thick German accent) "I know noothingg! Noothingg!"
 */

gregg@a.cs.okstate.edu (Gregg Wonderly) (11/03/87)

> 
> In article <18476@teknowledge-vaxc.ARPA> mkhaw@teknowledge-vaxc.ARPA writes:
>The watcher program has a defs.h file that #include's "y.tab.h", but
>there is no y.tab.h in the distribution, and the MANIFEST file doesn't
>mention it either.  Make terminates (very early) with an error because
>y.tab.h is missing.
> 

YACC(1) generates this file, and one of the biggest mistakes some makefile
authors make is to not put sufficient information in the makefile to tell
MAKE(1) how to create it.  The easist thing to do is to move y.tab.o, in
the list of OBJ's, to the beginning of the list.  MAKE(1) always processes
dependents from left to right, so this assures that y.tab.h will be
generated by YACC(1) before the other modules are compiled.  Better yet,
you should always provide sufficent information to MAKE(1) so that it
does not ever say "make: don't know how to make y.tab.h".

e.g.

==================================
OBJ=yacc.o lex.o prog.o util.o
SOURCES=yacc.y lex.l prog.c util.c
YFLAGS=-d
CFLAGS=-DDEBUG

prog: $(OBJ)
	cc $(OBJ) -o prog

lex.o: y.tab.h
y.tab.h: yacc.o
$(OBJ): header.h
==================================

--------------
Gregg Wonderly
Department of Computing and Information Sciences
Oklahoma State University

UUCP:  {cbosgd, ihnp4, rutgers}!okstate!gregg
ARPA:  gregg@A.CS.OKSTATE.EDU
IBM:   Yesterday's technology, tomorrow, for incredible prices