In my extconf.rb, I have
$srcs = %w{foo.cpp bar.cpp}
$objs = %w{foo bar}
Each of these is dependent upon multiple header files. If I touch foo.cpp or touch bar.cpp, and then do rake compile, it recompiles the appropriate object file.
But touching a .h file doesn't have the same effect, obviously. I can't remember if this is a symptom of my use of extconf.rb or just a fact of coding in C/C++.
Is there some way I can direct extconf.rb to write a makefile that is aware of these header files?
You don't do it directly within the
extconf.rb; for whatever reason,mkmfuses a separate file, nameddepend, to specify these sorts of things. You put all of your dependencies in the same form you would if you were writing a makefile by hand; so, for a filefoo.cppthat usedclient.handwombat.h, you would add the following line todepend:In the process of building your
Makefile,mkmfwill copy the contents of that file into yourMakefile, causing those rules to be honoured as part of the build process.