3 ms·
The thing people miss a lot about makefile, apart from what has already been mentioned is the fact you can have "local" version of the "global" variables, per r
by buserror 9y ago
The thing people miss a lot about makefile, apart from what has already been mentioned is the fact you can have "local" version of the "global" variables, per rules.
It's very very powerfull, clear to read, and simplify all these if/else/end no end...
For example:
CFLAGS = -std=gnu99 -Werror
release/%.elf: CFLAGS += -DRELEASE
debug/%.elf: CFLAGS += -DDEBUG
Basically you can add your own context flags and variables for each individual targets, and they are 'inherited' by any of their /sub/ targets...
Oh, people also need to learn about VPATH or course [0]!
[0]: https://www.gnu.org/software/make/manual/html_node/General-Search.html https://www.gnu.org/software/make/manual/html_node/General-S...
- henry_flower 9y agoyes, target-specific vars are neat. I've thought about adding a couple of sentences about vpath (in a cautious style akin to "think twice before using it" [0]), but ultimately decided that the topic is too obscure; besides I practically never use vpath myself. [0] http://make.mad-scientist.net/how-not-to-use-vpath/ http://make.mad-scientist.net/how-not-to-use-vpath/