help-make
[Top][All Lists]
Advanced

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

Re: "Advanced Auto-Dependency Generation" and lex/yacc


From: Paul D. Smith
Subject: Re: "Advanced Auto-Dependency Generation" and lex/yacc
Date: Tue, 4 Dec 2001 12:53:58 -0500

%% Jason Elbaum <address@hidden> writes:

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

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

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

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

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

No.

The makefile must explicitly define all "internal" prerequisites between
build targets, otherwise make can't be sure it will create them in the
proper order.

Automatic dependency detection can only be reliably used for "leaf"
prerequisites: prerequisites which are source files, not derived
objects.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist



reply via email to

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