[Top][All Lists]

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

Re: generated lex/yacc sources?

From: Nick Bowler
Subject: Re: generated lex/yacc sources?
Date: Tue, 21 Sep 2021 13:52:29 -0400

On 21/09/2021, Karl Berry <> wrote:
> Suppose I want to generate a lex or yacc input file from another file,
> e.g., a CWEB literate program. Is there a way to tell Automake about
> this so that the ultimately-generated parser/lexer [.ch] files are saved
> in srcdir, as happens when [.ly] are direct sources, listed in *_SOURCES?
> I should know the answer to this, but sadly, I don't. I couldn't find
> any hints in the manual or sources or online, although that probably
> only indicates insufficient searching.

I think all that should be needed is to list the .l (or .y) file in
_SOURCES normally, then just write a suitable make rule to update
it from the literate sources.  Automake doesn't "know" about it but
make should do the right thing.  For example, this seems to work OK:

  % cat > <<'EOF'
bin_PROGRAMS = main

main_SOURCES = main.l

# for simplicity, keep distributed stuff in srcdir
$(srcdir)/main.l: $(srcdir)/main.x
        cp $(srcdir)/main.x $@

EXTRA_DIST = main.x


reply via email to

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