I've had several ideas I'd like to run them by everyone. I'm posting them as separate emails so they can be discussed separately. In this email I'd like to propose a new special target .MUSTCREATE.
Background: In my makefiles a target should *always* be either .PHONY or create that file when its respective rule is run. I'd like make to be able to enforce this, so that make can detect these kinds of problems. Proposed solution: I propose a new special target .MUSTCREATE. Its prerequisites would list the targets that would fail in error if the target rule is run and it fails to create the target. If there's nothing on the list, then all non-.PHONY targets will fail in error if the rule runs without creating its target. For example, given this makefile: ~~~~~ foo: <TAB>touch bar .MUSTCREATE: foo ~~~~ Then "make foo" create "bar", and then it would fail with something like: ~~~~ make: *** Rule 'foo' run, but target 'foo' was not created (and it must be). ~~~~ In my makefiles I would do this: ~~~~ # All non-.PHONY targets must always create a file. .MUSTCREATE: ~~~~ Referring to an actual file named .MUSTCREATE can be escaped the usual way, namely "./.MUSTCREATE". This would only affect makefiles with .MUSTCREATE; it would not change the behavior of existing makefiles. --- David A. Wheeler _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make