Prevent running Make in production
Sometimes you want to make sure that the project's build system is not run in production, particularly when it contains instructions that can
possibly harm or destroy the environment. I use Make (GNU Make) in my projects. Make is a simple and reliable build system available on all
platforms. There is an easy (tho a bit hackish) way to prevent running it in production and allow it only in a development environment. To do this,
add an include
directive to the beginning of the make file:
include .development
And add the .development
file into the project directory only in development. The file should be empty. The missing file (in
production) will cause Make output the error:
$ make clean
Makefile:1: .development: No such file or directory
make: *** No rule to make target `.development'. Stop.
That is, the file is not found and there is no rule to build it. This makes it to exit with the error and run no targets given on the command line. This behavior is described in-depth in the GNU Make manual.