[Top][All Lists]

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

Re: interpolating automake variables?

From: Rusty Ballinger
Subject: Re: interpolating automake variables?
Date: Tue, 12 Jun 2001 04:12:33 -0700

> > Hey, I have a question about the interpolation of automake variables like
> > pkglibdir, pkgdatadir, etc.
> The way to do it recommended in the GNU coding standards is to do it
> in Makefiles, not at configure-time, so that the user can override the
> setting of prefix, exec_prefix, etc, during `make'.

Hmmm... that's kind of a bummer.  Instead of this in


you have to duplicate in your's a lot of what config.status
does (or, better, duplicate it once in a shared file included by your's), and duplicate the dependencies which automake handles
for you, etc.

So (this part is my question) in your $(top_srcdir)/, you'd have

        address@hidden@%$(exec_prefix)%g; \
        address@hidden@%$(prefix)%g; \
        address@hidden@%$(bindir)%g; \
        address@hidden@%$(sbindir)%g; \
        address@hidden@%$(libexecdir)%g; \
        address@hidden@%$(datadir)%g; \
        address@hidden@%$(sysconfdir)%g; \
        address@hidden@%$(sharedstatedir)%g; \
        address@hidden@%$(localstatedir)%g; \
        address@hidden@%$(libdir)%g; \
        address@hidden@%$(includedir)%g; \
        address@hidden@%$(infodir)%g; \
        address@hidden@%$(mandir)%g; \
        address@hidden@%$(SOME_AC_SUBSTED_VALUE)%g; \

(although that's not right, as it doesn't include the "protect against
being on the right side of a sed subst in config.status" business from
config.status or the part which breaks it up into smaller sets of sed
commands, and if you AC_SUBST a new variable and want to start using it
in files which are substituted at build time, there's another place you
have to remember to add it.)

And then the dependencies etc. in each of your relevant's:

    include $(top_srcdir)/
            $(NOT_QUITE_CONFIG_STATUS) < $< > $@
    # other stuff automake does for you that I'm forgetting?
    # plus the stuff you would have had anyway:
    bin_SCRIPTS = some_script

And even then, if you build some files with $prefix set one way, and then
you change $prefix and build some other files, you risk subtly & horribly
brain-damaged results, whereas if instead you let config.status generate
your files using interpolated paths, re-running your configure script will
regenerate config.status, and the dependencies generated by automake will
cause your other generated files to be regenerated, which should cause
object files which depended on them to be recompiled, and life will all be

Is there a simpler way to do this?  It seems like you'd wind up doing a
lot of work which automake already does.


reply via email to

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