Suppose in my makefile I have
program_INCLUDE_DIRS += ../inc
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))
Now I want to include a directory named ../inc2 (which is present one directory above where I am running the makefile) while running the makefile through the command line
I know that I should set the ../inc2 directory to CPPFLAGS.
Please suggest me the syntax of the command to include the directory ../inc2 through command line. Also I dont want to override the existing directory included in the makefile(../inc above).
The
+=meansCPPFLAGSis appended instead of replaced. That means you can set it in your shell and the existing directories will get appended, like this:If you need to do this a lot, the better solution would be to change your makefile to say: