Hands-on task
A default value with override
In /root/proj there is src.txt. Write a Makefile where the name of the result is set by a variable NAME with a default value app, but in such a way that it can be overridden both from the command line and from the environment. The build target copies src.txt into the file $(NAME). A bare make build creates app, while make NAME=prog build and NAME=prog make build create prog.
- make
- make variables
- conditional assignment
- variable priority