cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMx and custom code in Makefile

Krix N
Associate II
Posted on September 29, 2017 at 13:53

Using CubeMx with automatic Makefile generation.

I want to alter the build target name.

Example:

CubeMx creates a build target in the Makefile:

TARGET = myfirmware

But I want to append a version:

TARGET = myfirmware_$(FW_VERSION)

However my custom change is overwritten each time CubeMx auto generates a new makefile.

Does anyone know how to work around this?

I have not found documentation on how to protect parts of the Makefile from updating.

#stmcubemx #makefile #cubemx-project
1 REPLY 1
Posted on September 29, 2017 at 15:10

Don't use the generated makefile directly; rather, 

https://www.gnu.org/software/make/manual/make.html#Include

it into your own makefile which contains all the required settings.

JW