[Top][All Lists]

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

GNU autogen code generation

From: Matěj Týč
Subject: GNU autogen code generation
Date: Tue, 27 Apr 2010 22:20:53 +0200

I use GNU Autogen to generate files to my project.

A little introduction:
Autogen uses two files: A definition file, let's say foo.def and a
template file, may be foo-template.tpl
If I pass the definition file to autogen, it should use the information
in it to find the template file and to produce the result by performing
expansions in the template file.
The extension of the result is defined in the template file and it can
be whatever, either one file, or more files that differ in extensions
(like a C source file and a header).

What I would like to have is some integration of autogen with autoconf
like YACC and LEX have.
Which means that I would like to specify the template and definitions
file in _SOURCES variable and Automake could take care of the rest:
        - Generating intermediate sources
        - Compiling those sources
        - Distributing both autogen sources (= templates and definitions) and
intermediate sources so even users who don't have autogen installed can
compile the source.
So i have some questions:
        - Wouldn't it be worth to have an AM_PROG_AUTOGEN macro since autogen
is GNU software?
        - If not, is there a way how to easily achieve similar functionality
using current automake capabilities?

For example if I know that every file foo.def and foo.tpl pair results
in foo.c, maybe I could have the following rule in
.def.c: $(basename $<).tpl
        $(autogen) autogen -o $@ $<
(just a guess)
But how to settle the distribution problem? I would probably need to put
foo1.c foo2.c to something_SOURCES
foo1.tpl foo1.def ... ... to EXTRA_DIST
but one would like to have those tpls and defs in SOURCES and the rest
generated automatically, like for YACC and LEX.
What do you think?

As a side note, I was thinking about generating code using m4 and some
macro package, and since it is not so uncommon to generate code, I would
like to ask what is the good approach to this since the automake manual
doesn't tell very much about this...

reply via email to

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