[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: Miles Bader
Subject: Re: allowing users to add source files without rerunning the autotools?
Date: Fri, 20 Jan 2012 05:12:17 +0900

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?).  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).

If GNU-make-specific features are OK, then one could just use
"-include", e.g. in my example "-include $(DEPDIR)/stuupd-*.Po".
Alternatively, a "dummy" .Po file could be created by configure that
matches the above include pattern (and so prevents an error until some
real .Po files exist to match it).



Carefully crafted initial estimates reward you not only with
reduced computational effort, but also with understanding and
increased self-esteem.         -- Numerical methods in C,
  Chapter 9. "Root Finding and Nonlinear Sets of Equations"

reply via email to

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