On Wed, 16 Jan 2002, Luigi Ballabio wrote:

> At 11:09 AM 1/16/02 +0000, Hugh Sasse Staff Elec Eng wrote:
> >I'm not using a .i file -- I'm using the fact that swig -ruby example.c
> >will generally work, as described elsewhere in the docs.
>
> Oh, I see. Then I agree: SWIG is correct in complaining, but this needs
> mentioning.

OK, will do.
>
> > > >* It is not clear what should be done about integrating several C
	[...]
> > > - I write a file mymodule.i containing:
> > >
> > > %module MyModule
> > > %include somefuncs.i
> > > %include someotherfuncs.i
> > >
> > > - by running SWIG on the latter file, all functions from the two original
> > > ones will be exported in MyModule.
> >
> >Will it produce one "%s_wrap.c" or two?
>
> Just one.

OK, that's worth knowing.
>
> > > If you want to get fancy, you can compare the modification times of
> > > MyModule.i and mymodule_wrap.cpp and run swig only when needed
> >
> >Yes, that sort of thing would work, but since extconf is supposed to be
> >used to write a makefile, it seems a bit much to re-implement make
> >inside it! :-)
>
> I see your point.
> Ok, how about:
>
> require 'mkmf'
> require 'ftools'
	[...]
> # add the target to the makefile
> makefile = File.new("Makefile","a")  # open in append mode

I'm not sure that putting it at the end would be right.
> makefile << "\n"
> makefile << "mymodule_wrap.cpp: MyModule.i\n"
> makefile << "\tswig -ruby MyModule.i\n"
> makefile.close
> # Done. Now the makefile will do the job as expected.

I think mkmf needs some method for adding target, dependencies, actions
to the makefile.  I'm not sure who to contact about this, and I'm
not sure how to integrate it into the makefile creation process, so that
your new targets end up as dependencies in rules mkmf already writes.

I think such a method would be part of a good refactoring for this package.
>
> Again, I didn't test the above.
>
> Bye,
>          Luigi
>
>
	Hugh