QUESTION — Local Build: How to Specify Variables in the Makefile?

This thread deals with a specific question of the more general Local building for Core+Photon thread.

  • How to Specify Variables in the Makefile?

The particle-3 folder contains

/Users/ReiVilo/Desktop/particle-3/blink.ino /Users/ReiVilo/Desktop/particle-3/LocalLibrary.cpp /Users/ReiVilo/Desktop/particle-3/LocalLibrary.h /Users/ReiVilo/Desktop/particle-3/main.cpp /Users/ReiVilo/Desktop/particle-3/Particle_fast.mk

Particle_fast.mk include a variable definition MY_IDE, which is tested on main.cpp and blink.ino.

CPPFLAGS += -DMY_IDE=310 CFLAGS += -DMY_IDE=310

  • Launch make v=1 GCC_ARM_PATH=/Users/ReiVilo/Library/embedXcode/gcc-arm-none-eabi-4_9-2015q2/bin/ COMPILE_LTO=n PLATFORM_ID=6 APPDIR=/Users/ReiVilo/Desktop/particle-3 TARGET_DIR=/Users/ReiVilo/Desktop/particle-3/Builds TARGET_FILE=embeddedcomputing USER_MAKEFILE=Particle_fast.mk clean all program-dfu > ~/Desktop/particle-3/3a.txt
  • Result is not OK.

Still no answer?

It is not clear what you are trying to do but here is the book I would use to answer any questions on make files:

http://www.oreilly.com/openbook/make3/book/index.csp

Thanks for the pointer!

I’ve been playing with makefiles for more than five years now and I’m just trying to do with Particle what I’m doing with any of the other popular boards.

I just want to use the local build in command line and set a variable MY_IDE=310
so the tools —gcc, g++ et al.— are called with -DMY_IDE=310.

How is this done on other boards? If there's a standard way then it makes sense for us to provide the same.

For other boards, I’m using makefiles which pass variables with their value to the compiler through -DVARIABLE=VALUE.

This is part of embedXcode, a template for embedded computing on Xcode.

I’d like to leverage the makefiles provided by Particle, but there’s only one option missing. Just add another variable to the make invocation as described at this page, e.g. VARIABLE_NAME=VARIABLE VARIABLE_VALUE=VALUE.