OT: cross compiling: `?=` or `+=` for `INCLUDES`
Dear OE folks,
what is the best practice for Makefiles with INCLUDES? On the VDR list it was requested to use += instead of ?=. [1]
However, in the Makefile changes:
-INCLUDES = -I/usr/include/freetype2
+INCLUDES ?= -I/usr/include/freetype2
Shouldn't that be += instead of ?=.
In my case, my IDE sets INCLUDES with some custom stuff. Therefore the Makefile does not touch INCLUDES any more and I get an error.
Is it common when changing INCLUDES that one has to take care about this by oneself, i. e. by adding -I/usr/include/freetype2 to INCLUDES? Or is there a better way?
Thanks,
Paul
[1] http://www.linuxtv.org/pipermail/vdr/2010-November/023953.html
[2] http://www.linuxtv.org/pipermail/vdr/2010-December/024019.html
Quoted 10 lines · Paul Menzel
Dear OE folks,
what is the best practice for Makefiles with
INCLUDES? On the VDR list it was requested to use+=instead of?=. [1]However, in the
Makefilechanges:
-INCLUDES = -I/usr/include/freetype2
+INCLUDES ?= -I/usr/include/freetype2
Quoted 8 lines
Shouldn't that be += instead of ?=.
In my case, my IDE sets INCLUDES with some custom stuff. Therefore the
Makefiledoes not touch INCLUDES any more and I get an error.Is it common when changing
INCLUDESthat one has to take care about this by oneself, i. e. by adding-I/usr/include/freetype2toINCLUDES? Or is there a better way?
IMO you should use pkg-config or freetype-config instead, e.g.:
INCLUDES ?= pkg-config --cflags freetype2
or better, instead of using INCLUDES at all:
FREETYPE_CFLAGS ?= pkg-config --cflags freetype2 CFLAGS += $(FREETYPE_CFLAGS)
This will work in most environments.
Regards,
Andreas