Question 1
If you define step
22 clean:
23 rm $(OBJECTS)
If there any way to gracefully “do nothing, if there is nothing to delete“?
Question 2
Assume the following line, again, is there a way to gracefully exit with a warhing when no files are found when processing line
6 SOURCES = $(shell echo src/*.cpp)
Question 3
How can one perform the final post processing on the final product, like mv $(PRODUCT) someDir? Where would this instruction be?
1) Just use
rm -f, which is tellingrmto ignore it if the files are missing.3) That can just be the last step of the target that actually builds the product, or you can create a target named
install(for example) that depends on your build target, and then contains thismvcommand.