How to pass in define to Makefiles from command line?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
BaRo_4833941
Level 1
Level 1
First question asked Welcome!

Maybe there is a better way to accomplish what I'm trying to do, but I'm looking to pass a build number into the build process from Jenkins which will use a batch file to execute the make command in a nightly build.   In other words, I'd like to be able to pass in this number to be compiled in as part of the version number of the application.  This number should become part of the CFLAGS.

The make files are more complex than what I've dealt with before and I haven't found an obvious solution.

0 Likes
1 Solution
Murali_R
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 100 solutions authored

In a  more generic sense, Can you have a look at this and see if it helps https://stackoverflow.com/questions/2826029/passing-additional-variables-from-command-line-to-make?

In WICED there is an option where you pass the build version from Makefiles when using ota2. You can use  APP_VERSION_FOR_OTA2_MAJOR and APP_VERSION_FOR_OTA2_MINOR as strings in the make target and pass the values which gets stored in the DCT. Now you can something similar for your requirement based on this. 

View solution in original post

0 Likes
1 Reply
Murali_R
Moderator
Moderator
Moderator
250 sign-ins 250 replies posted 100 solutions authored

In a  more generic sense, Can you have a look at this and see if it helps https://stackoverflow.com/questions/2826029/passing-additional-variables-from-command-line-to-make?

In WICED there is an option where you pass the build version from Makefiles when using ota2. You can use  APP_VERSION_FOR_OTA2_MAJOR and APP_VERSION_FOR_OTA2_MINOR as strings in the make target and pass the values which gets stored in the DCT. Now you can something similar for your requirement based on this. 

0 Likes