Skip to main content
Krix N
Associate
September 29, 2017
Question

CubeMx and custom code in Makefile

  • September 29, 2017
  • 1 reply
  • 676 views
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
This topic has been closed for replies.

1 reply

waclawek.jan
Super User
September 29, 2017
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