help-make
[Top][All Lists]
Advanced

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

"Advanced Auto-Dependency Generation" and lex/yacc


From: Jason Elbaum
Subject: "Advanced Auto-Dependency Generation" and lex/yacc
Date: Tue, 06 Nov 2001 17:50:09 +0200

I've developed a makefile based on the technique you describe on your
website (http://www.paulandlesley.org/gmake/autodep.html), so that GNU's
compiler generates the dependency files while compiling using the -MD
flag. The system is great: elegant and efficient.

I have one problem, though: handling lex and yacc correctly. Typically,
yacc takes a .y file as input and builds two files: a .c file and a .h
file. Then, lex reads a .l file and builds a .c file. Usually, though,
lex also #includes the .h file created by yacc.

It's easy to tell make that yacc builds two files simultaneously. But I
don't see how to get make to determine whether the .c file built by lex
depends on the .h file built by yacc.

The automatic dependency system only works on the .c files, but lex
needs to read the .h file in order to create the .c file. Until yacc has
been run, the .h file doesn't exist or is out of date.

I can't assume automatically that lex needs the .h file, since it
doesn't necessarily need it - there might not even by a yacc file
working with lex.

Is there any alternative to manually inserting the dependency line in
the makefile?

(I hope I've explained this clearly enough...)


Thanks,

Jason Elbaum



reply via email to

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