Should a Makefile delete itself on 'make clean'?
configure, makefile, posix
Solution
This is a stylistic question, rather than a technical question. The best place to go for answers is the automake manual, which will tell you:
`make clean'
Erase from the build tree the files built by `make all'.
`make distclean'
Additionally erase anything `./configure' created.
So, no, `make clean` should not delete `Makefile`. `make distclean` should delete `Makefile`, since it's created by `configure` not `make all`.
One of the best things about autotools is that they are consistent and standard. It's best to not irritate your users by flouting those standards.
Problem
I have a `configure` script that writes a Makefile (from `Makefile.in`). The `clean` target currently removes everything created from within the makefile, but it doesn't delete the makefile itself. (I'm not using Autotools as you can probably tell) My question therefore: Should the makefile also remove itself, requiring the developer to run `./configure` again? On the one hand, I want the clean target to properly clean up the source tree. But, on the other hand, I'd like to be able to type `make clean test` to check that everything's working as it should before committing; Running the configure script again seems weird somehow.