How to "subclass" a suffix rule in a makefile?
Make noob here.
I have some code that looks a little like this: foo : foo.o foo.o : foo.cpp In other words it relies on (default) suffix rules to build. I wish to execute some code (setting a variable) when the rule is evaluated, then fire the default rule. So my first cut looks like this: foo : foo.o @echo Linking! foo.o : foo.cpp @echo Compiling! But of course when I run it, the printed line replaces the default rule. I want to do this: foo : foo.o @echo Linking! run_default_rule foo.o : foo.cpp @echo Compiling! run_default_rule But don't know how. How do I get at that "higher" rule? I realize I can run make -p to get info, and then just paste it into my makefile .. but I am looking for something more elegant. RDeW |
the default rule is used when there is no other rule.
you can change the default rule to contain the echo line also, and there can be other tricks... |
All times are GMT -5. The time now is 11:04 PM. |