Extension of Macro definition for User

Dear all,
Currently I am using Workbench Platform.
Suppose in my application code I want to do :

#ifdef EXPERIMENTAL
// Experimental code here
#endif

And I want to define this macro from outside of my code, does the platform provide any convenient method to do this?

Ok I found the solution already, we can use additional make param EXTRA_CFLAGS so if you are using Workbench Platform you can use:

make -f $MAKE_FILE clean-user
make -f $MAKE_FILE compile-all EXTRA_CFLAGS="-DAPP_EXPERIMENTAL"

$MAKE_FILE is environement variable set to point to the Makefile to build binary which is typically:

export MAKE_FILE=$HOME/.particle/toolchains/buildscripts/1.9.2/Makefile

Hopefully it is useful for others

2 Likes