[Top][All Lists]

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

Re: allowing users to add source files without rerunning the autotools?

From: Nick Bowler
Subject: Re: allowing users to add source files without rerunning the autotools?
Date: Thu, 19 Jan 2012 15:27:29 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On 2012-01-20 05:12 +0900, Miles Bader wrote:
> Stefano Lattarini <address@hidden> writes:
> > Still, things are not as easy as it would appear from your sample project.
> > For example, with this rule:
> >
> >   $(CC) -c $(CFLAGS) -DIM_STUUPD=1 $<
> >
> > you are losing some important features offered by automake -- most
> > notably, the automatic dependency tracking and the configurable verbosity
> > specification (silent-rules).  Which might be OK in some circumstances,
> > but unacceptable in others.
> Actually, although I provided my own compilation rule, the default rule
> works too, if the user considers that acceptable (compiler flags the
> same etc).  You need at least one "automake-controlled" source-file of
> the same type (.c etc) for automake to generate it, but that's probably
> a safe bet for most projects. :)
> Since the default rule generates the dependency information into
> $(DEPDIR)/*.Po as Makefile fragments, one need only figure out some
> appropriate way to include fragments into the Makefile for the "extra"
> source files.
> What automake does for source files it knows about is just "include
> $(DEPDIR)/srcfile.Po" (apparently "include" is considered portable
> make?).

It's not considered portable make.  Automake's dependency tracking
requires a mechanism to include makefile fragments to work, but this is
not required to build the package.  The lines generated by Automake look
something like this:

  @AMDEP_TRUE@@am__include@ @address@hidden(DEPDIR)/address@hidden@

Note all the configure-substituted variables there.  In particular, if
configure cannot figure out how to make dependency tracking work, then
it will disable it.  In that case, @AMDEP_TRUE@ will be substituted with
a # and the line will be ignored by make.

> The include directive apparently understands wildcards, but is
> a little tricky to use in the same way, because it fails for
> non-existant files (automake arranges to make sure the .Po files always
> exist by just sticking in code to explicitly create them all over the
> place, which is probably too annoying for this sort of user case).

Interestingly, if you actually stick a line exactly like the above into
your, Automake will actually do "The Right Thing™" and
creates the .Po stub as if you had actually specified the source file
normally.  Presumably you'd be relying on totally unsupported internal
behaviour of Automake in this case, though. :)

Nick Bowler, Elliptic Technologies (

reply via email to

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