Re: bug or feature
Joerg Sonnenberger wrote:
> On Wed, Jan 05, 2005 at 09:23:20PM -0800, Matthew Dillon wrote:
>> There's nothing wrong with make. The make clean target is not removing
>> the temporary expr.c file generated by previous runs of make before you
>> changed expr.y to expr.c, and it is that expr.c that it is finding.
>>
>> If you do that you will see that the standard conversion rules will
>> cause yacc to be run to generate the .c file from the .y file. That's
>> documented conversion rule behavior for make.
>>
>> So the bug is simply that the Makefile is missing a CLEANFILES= expr.c
>> line (or one of the .mk files is).
>
> It's not that simple. Just create a new directory, copy the expr.y into it
> and add a Makefile containing only "expr: expr.c". Run make and it will
> create the expr.c from expr.y.
>
> Second try: create expr.c and touch expr.y afterwards. It will still run
> yacc to generate expr.c.
>
> This is what created the problem with GCC 3.4 back than, we had both
> the bison generated C sources (which I originally had in the
> Makefile's SRCS) and the .y source. CVS checkout creates X.c before X.y,
> so the yacc source is always newer than the C source. It wasn't a problem
> in the GCC case, because yacc handles the sources fine. It can be a problem
> for newer CVS version, because the included getdate.y isn't compilable by
> yacc anymore. I'm thinking about adding the reentrant parser support, but
> I have to read the sources more.
>
> Joerg
Ok I found the 'feature', and it is sort of documented
in the PSD.doc/tutorial.ms in the make directory. .SUFFIXES
get applied to everything, so it when make finds expr.y it
uses it.
Max
% make -d s
SuffFindDeps (expr)
No known suffix on expr. Using .NULL suffix
not adding suffix rules
SuffFindDeps (expr.o)
trying expr.c...got it
applying .c -> .o to "expr.o"
SuffFindDeps (expr.c)
trying expr.y...got it
applying .y -> .c to "expr.c"
SuffFindDeps (expr.y)
討論串 (同標題文章)