Eclipse build variables in Makefiles [SOLVED]

Hi All,

In Eclipse I have set up various build options (i.e dbg, rel etc), I would like to pass the name to my Makefile project so that I can select various build options for the

different type of build.

I believe the release name is held in the “ConfigName” variable, however when I try to access it in my makefile like this, it doesn’t work:

ifeq (rel, $(ConfigName))       # Release configuration ............................

BIN_DIR := rel
LIBS    := -lqk_$(ARM_CORE) -lqf_$(ARM_CORE) -lqep_$(ARM_CORE)

ASFLAGS = -mcpu=$(ARM_CORE)

CFLAGS = -mcpu=$(ARM_CORE) -mthumb -Wall  \
	-Os $(INCLUDES) $(DEFINES) -DNDEBUG

CPPFLAGS = -mcpu=$(ARM_CORE) -mthumb  \
	-Wall -fno-rtti -fno-exceptions \
	-Os $(INCLUDES) $(DEFINES) -DNDEBUG

LINKFLAGS = -T$(LD_SCRIPT) -mcpu=$(ARM_CORE) -mthumb  -nostdlib \
	-Wl,-Map=$(BIN_DIR)/$(OUTPUT).map,--gc-sections,-L$(QP_PORT_DIR)/$(BIN_DIR),-L$(LIB_DIR),-L$(LIB2_DIR)

else

ifeq (spy, $(ConfigName))  # Spy configuration ................................

BIN_DIR := spy
LIBS    := -lqk_$(ARM_CORE) -lqf_$(ARM_CORE) -lqep_$(ARM_CORE) -lqs_$(ARM_CORE)

ASFLAGS = -g -mcpu=$(ARM_CORE)

CFLAGS = -mcpu=$(ARM_CORE) -mthumb -Wall \
	-g -O $(INCLUDES) $(DEFINES) -DQ_SPY

CPPFLAGS = -mcpu=$(ARM_CORE) -mthumb -Wall  \
	-fno-rtti -fno-exceptions \
	-g -O $(INCLUDES) $(DEFINES) -DQ_SPY

LINKFLAGS = -T$(LD_SCRIPT) -mcpu=$(ARM_CORE) -mthumb   -nostdlib \
	-Wl,-Map=$(BIN_DIR)/$(OUTPUT).map,--gc-sections,-L$(QP_PORT_DIR)/$(BIN_DIR),-L$(LIB_DIR),-L$(LIB2_DIR)

else                # default Debug configuration .......................

BIN_DIR := dbg
LIBS    := -lqk_$(ARM_CORE) -lqf_$(ARM_CORE) -lqep_$(ARM_CORE) -lRDB1768cmsis_usbstack

ASFLAGS = -g3 -mcpu=$(ARM_CORE)

CFLAGS = -mcpu=$(ARM_CORE) -mthumb -Wall  \
	 -g3 -O0 $(INCLUDES) $(DEFINES)

CPPFLAGS = -mcpu=$(ARM_CORE) -mthumb \
	-Wall -fno-rtti -fno-exceptions \
	-g3 -O0 $(INCLUDES) $(DEFINES)

LINKFLAGS = -T$(LD_SCRIPT) -mcpu=$(ARM_CORE) -mthumb  -nostdlib \
	-Wl,-Map=$(BIN_DIR)/$(OUTPUT).map,--gc-sections,-L$(QP_PORT_DIR)/$(BIN_DIR),-L$(LIB_DIR),-L$(LIB2_DIR)
	
endif

It seems the line “ifeq (rel, $(ConfigName))” doesn’t do what I think it should.

When I was using CodeRed tools the line was: “ifeq (rel, $(CONF))” but that doesn’t work in Eclipse proper.

I cannot find any help in Eclipse on passing these variables to a makefile …

Can anyone help?

Thanks,

Bernie

Hi, found out how to fix this …

Under Eclipse properties for the project goto C/C++ Build->Environment

and add the system variable ConfigName so that it is exported … it is

then visible to the make program … works great now.