Doing rake-like stuff with mkmf?

  • Thread starter Wincent Colaiuta
  • Start date
W

Wincent Colaiuta

Following the pattern I've seen in widespread use, I use rake in my
Ruby projects for most high-level tasks (running specs, building gems
etc) and mkmf to make C extension makefiles.

mkmf works great for the simple case where you just want to compile
some C files and link to some libraries; the default behaviour seems
to handle most things automatically.

But what if I want to do some more sophisticated rake-like stuff where
I manually specify dependencies? For example:

* Start with ANTLR grammar file "Grammar.g"

* Whenever this file is updated, have to run ANTLR on it and this
regenerates new "GrammarLexer.c" and "GrammarParser.c" files

* In this case want to rebuild the extension

Is there a way to do this using mkmf? Or do I have to manually tweak
the generated Makefile myself?

Cheers,
Wincent
 
N

Nobuyoshi Nakada

Hi,

At Sat, 9 Jun 2007 23:15:08 +0900,
Wincent Colaiuta wrote in [ruby-talk:254933]:
But what if I want to do some more sophisticated rake-like stuff where
I manually specify dependencies? For example:

* Start with ANTLR grammar file "Grammar.g"

* Whenever this file is updated, have to run ANTLR on it and this
regenerates new "GrammarLexer.c" and "GrammarParser.c" files

* In this case want to rebuild the extension

Is there a way to do this using mkmf? Or do I have to manually tweak
the generated Makefile myself?

create_makefie in mkmf appends the content of "depend" file if
it exists, so that you can add your own rules.
 
J

Jano Svitok

Following the pattern I've seen in widespread use, I use rake in my
Ruby projects for most high-level tasks (running specs, building gems
etc) and mkmf to make C extension makefiles.

mkmf works great for the simple case where you just want to compile
some C files and link to some libraries; the default behaviour seems
to handle most things automatically.

But what if I want to do some more sophisticated rake-like stuff where
I manually specify dependencies? For example:

* Start with ANTLR grammar file "Grammar.g"

* Whenever this file is updated, have to run ANTLR on it and this
regenerates new "GrammarLexer.c" and "GrammarParser.c" files

* In this case want to rebuild the extension

Is there a way to do this using mkmf? Or do I have to manually tweak
the generated Makefile myself?

Cheers,
Wincent

There's mkrf (http://rubyforge.org/projects/mkrf) aimed at replacing
mkmf generated makefile with rakefile.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top