Mkmf & swig

As I started to play with SWIG, I did a quick modification of mkmf so it
supports SWIG (see attached diff). An extconf.rb file would look like:

require ‘mkmf’
use_swig
create_makefile(‘example’)

Then, the usual:
ruby extconf.rb make

should do.

In addition, there is a ‘swig’ rule to trigger swig (“make swig”). So
that one can generate the C files and distribute a tarball that doesn’t
require SWIG.

“make distclean” gets ride of the C files generated by swig.

That’s it. It is fairly simple and has plenty of shortcomings. For
example, it doesn’t support C++ source file.
Is it of interest to anybody? Should mkmf in the standard distribution
supports SWIG and other tools (like Racc)?

Guillaume.

mkmf.diff (2.41 KB)