[Top][All Lists]

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

Re: Implementing a plugin-like module

From: Sam Varshavchik
Subject: Re: Implementing a plugin-like module
Date: Thu, 04 Aug 2011 12:29:31 -0400

Stefano Lattarini writes:

A quick workaround to obtain this behaviour is to write your custom/rules
defintion in a `.am' fragment in your source tree, and then include it
from all the files that need it:

  $ cat
  my_variable = ...
        # rules to create a C file from a template `.ctpl'.

  $ cat lib/
  include  $(top_srcdir)/
  ... [specific rules]

  $ cat src/
  include  $(top_srcdir)/
  ... [other specific rules]
There's no need to install an `.am' file there in order to use it with the
`include' directive.

I saw that, when I was rooting around in automake -- that it attempts to expand relative include statements in, rather than leaving them in, and have gmake handle them.

It just didn't register to me that I don't need to add the .am file into make dist, since automake handles the inclusion.

I guess I can whip-up something analogous to gettextize, that symlinks the .am file from $top_srcdir, and adds the include statement to, if it's not there already. That should do it.

I also came up with a different solution last night. I install something like this into /usr/share/aclocal:

PKG_CHECK_EXISTS([libx],[:],[AC_MSG_ERROR([libx not found])])

libx_pkgdatadir="`$PKG_CONFIG --variable=pkgdatadir libx`"

LIBX_AM="include $libx_pkgdatadir/"

Then, I add


to the and add


in; and aclocal ends up automatically adding the m4 macro to aclocal.m4, which gets expanded into At runtime, configure picks up the toolkit's installation directory, and creates an include statement that references it, which gets SUBST-ed into the Makefile.

Rather than having automake handle the inclusion, it's left up to gmake; but my build-rules are already gmake-specific, and this wouldn't be an additional requirement.


Attachment: pgpCOuRfn6mEw.pgp
Description: PGP signature

reply via email to

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