I believe the next way should work. You define an environment variable when you run make . In the Makefile, you check the status of an environment variable. Depending on the state, you define the parameters that will be passed to g ++ when compiling the code. g ++ Uses the parameters in the preprocessing phase to decide what to include in the file (for example, source.cpp).
Team
make FEATURE=1
Makefile
ifeq ($(FEATURE), 1)
source.cpp
#ifdef INCLUDE_FEATURE #include feature.h
To check if FEATURE is passed to or not (like any value):
ifdef FEATURE #do something based on it else # feature is not defined. Maybe set it to default value FEATURE=0 endif
source share