[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: generated lex/yacc sources?
From: |
Jan Engelhardt |
Subject: |
Re: generated lex/yacc sources? |
Date: |
Tue, 21 Sep 2021 23:38:00 +0200 (CEST) |
User-agent: |
Alpine 2.25 (LSU 592 2021-09-18) |
On Tuesday 2021-09-21 22:32, Karl Berry wrote:
>Thanks much. I was thinking I should avoid that since the .[ly] are not
>ultimate sources, but if it works, fine with me.
>
> jan>
> BUILT_SOURCES = foo.y
> foo.y: foo.cweb
> somecommands
>
>That would be sensible, but I failed to mention the problem with
>BUILT_SOURCES (sorry): the manual says it only works with the general
>targets (all, check, install, install-exec). I need something that works
>with individual targets.
The example that the manual gives (the one with foo.c and foo.h) has a
peculiarity: it involves $CC's automatic dependency _generation_,
which, in that case, implies a cycle:
* foo.o (for practical purposes) requires foo.c and foo.h
* but the _dependency_ (edge in make's DAG) "foo.o: foo.h"
is only available after foo.o's command (gcc -Wp,-M*) has run.
BUILT_SOURCES is just a bandaid for that missing dependency, and yes,
this cycle breaker is only hooked to all/check/install.
If you were to hardcode into Makefile.am:
foo.${OBJEXT}: foo.h
then BUILT_SOURCES would not be needed at all.
==
In your lex/yacc case, there is no such cycle anyway, because foo.h
already exists (created by lex or yacc - I always forget which)
by the time foo.o compilation is attempted.