Re: generated lex/yacc sources?
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.
Re: generated lex/yacc sources?
Hi Nick, Jan, all, nick> I think all that should be needed is to list the .l (or .y) file in _SOURCES normally 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. I'll give the _SOURCES stuff a whirl. Thanks again. -k
Re: generated lex/yacc sources?
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 >Makefile.am <<'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 MAINTAINERCLEANFILES = main.l EOF Cheers, Nick
Re: generated lex/yacc sources?
On Tuesday 2021-09-21 19:02, 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. Will BUILT_SOURCES = foo.y foo.y: foo.cweb somecommands do the trick for you?