3 ms·
You're not supposed to put significant logic in a makefile. You've already got tons of tools for real logic. A makefile is a dependency graph. If statements are
by snprbob86 15y ago
You're not supposed to put significant logic in a makefile. You've already got tons of tools for real logic. A makefile is a dependency graph. If statements are for defining slightly different graphs in slightly different environments.
If you need to add real logic, write a shell script.
A well written Makefile has a small preamble of variable definitions, followed by a couple of named convenience .PHONY targets (without any commands), followed by a small handful of pattern rules, followed by the dependency graph. Each edge in the dependency graph should include as few commands as possible, preferably just one!