make
is not limited to C/C++ programs. You can use it to organize shell commands as well.
a simple example of Makefile:
target: prerequisites
echo "Hello, Xiamen!"
prerequisites:
echo "Hello, Vancouver!"
Note: Makefiles must be indented using TABs and not spaces or
make
will fail.
Here is the output of running the above example:
$ make target
echo "Hello, Vancouver!"
Hello, Vancouver!
echo "Hello, Xiamen!"
Hello, Xiamen!
$ make prerequisites
echo "Hello, Vancouver!"
Hello, Vancouver!
Another example of Makefile :
hey: one two
touch hey
one:
touch one
two:
touch two
clean:
rm -f hey one two
Here is the output:
$ make hey
touch one
touch two
touch hey
$ make clean
rm -f hey one two