[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Implementing a plugin-like module
From: |
Sam Varshavchik |
Subject: |
Implementing a plugin-like module |
Date: |
Wed, 03 Aug 2011 22:32:11 -0400 |
I'm looking for a way to implement an optional plugin-like facility in
automake.
Basically, take a stock distro installation of automake, then augment it
somehow so that automake would add my stuff into each Makefile.in file that
it generates from Makefile.am.
My situation is that I'm installing a toolkit; a library, a part of which is
a code generator. Let's say that my code generator produces filename.H from
filename.tmpl.
I can always write out the rules explicitly, something like:
BUILT_SOURCES=filename.H
filename.H: filename.tmpl
# build rule that runs the code generator goes here
bin_PROGRAMS=app
app_SOURCES=appmain.C
# and appmain.C #includes filename.H
Something like that. That's the basic scenario. What I would like to
accomplish is to have the actual build rules defined by the installed
toolkit. The build rules are somewhat non-trivial, and with many code-
generated .H files, it gets tedious. I'm fine with limiting my portability
to gmake, so I can put something like
$(call GENERATE_TMPL_RULE,filename)
and my GENERATE_TMPL_RULE macro eval()s the appropriate make rules that
produce filename.H from filename.tmpl; then I just add additional calls to
this macro to generate rules for each code-generated .H file. Works fine.
The definition of the GENERATE_TMPL_RULE is owned by the toolkit, and I'm
looking for a way to avoid having each app, that builds against the toolkit,
from explicitly adding the macro definition in its Makefile.am. I'd like to
have automake put the canned GENERATE_TMP_RULE into the Makefile.in that it
generates.
In my distro, I see that automake has a collection of files in
/usr/share/automake-[VERSION]/am/*.am, which look like various snippets that
the main automake script pulls together into the Makefile.in script that it
produces. But it's not clear to me if it's possible for me to make the
necessary arrangements for the automake script to insert my own *.am script,
that my toolkit could install into that directory, into a Makefile.in
produced by automake. That's basically what I'm looking to do, in a
nutshell; I'm unable to locate any info on this topic in the automake
manual; any tips would be appreciated.
pgpELUIne6r9Y.pgp
Description: PGP signature
- Implementing a plugin-like module,
Sam Varshavchik <=