I wonder if anyone has ever wanted the ability to "handle" the failure of a rule?
I needed it so that I could produce various types of log information when a compile/link step failed. I have used some ugly macros to wrap my rules in a bash subshell so that I can catch the return result, perform my logging and then using exit with the original result. This forces me to make all the lines of the rule end with "&& \" so that I can process all of them in the handler. It works but it's error-prone and I wondered if anyone else had ever wanted some alternative mechanism? e.g. # Rule Failure handling. # please excuse use of spaces - can't do tabs in gmail fred.exe: $(OBJLIST) echo "<link target='$@'>" echo $(OBJLIST) > objectlistfile link -v objectlistfile -o $@ fred.exe:onfail: echo "<error target="$@" type='postlink'>OBJLIST=$(OBJLIST)</error> fred.exe:finally: -rm objectlistfile echo "</link>" I am not fixated on what the syntax might be - the example is just for argument's sake. The features would be: 1) the "finally" rule allows one to guarantee the ability to clean up after some failed rule no matter what kinds of things it may have done - whether creating temporary files or other state changes. 2) The "onfail" rule allows one to log useful information in the event of some error. On multi-hour builds with "keepgoing" enabled this is very useful and keeps the logs small and relevant. 3) One can make logs that show the start and end of a rule - which makes it slightly more parsable. What do you think? Regards, Tim -- http://www.thezimbabwean.co.uk/
_______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make