Particle build ignoring custom makefile

Hey All,

I’m building a software project that is configured to build and run on multiple different systems.
I’m invoking the particle make commands from a project-level Makefile.

My source tree is a bit unorthodox in the context of particle, but reasonably standard for C++ development:

+ project
+-- depends (git submodules and other 3rd party code)
|    +-- some_dep
|         +-- include
|              +-- someheader.h
|         +-- src
|              +-- somefile.cpp
|    +-- particle_lib
|          +-- firmware
|               +-- lib_name.h
|               +-- lib_name.cpp
|    +-- firmware (particle sysem firmware)
+-- appname   
|     +-- src
|          +-- core
|              +-- main.cpp
|         +-- logs
|             +-- logs.h
|             +-- logs.cpp
|             +-- pretty_logs.h
|     +--
|     +-- (blank)
+-- tests
|    +-- some_test
|    +-- some_test.cpp
+-- Makefile

It looks like the particle build system is ignoring my custom makefile. I’ve set APPDIR=/home/user/project/appname.
My makefile basically sets up any particle-firmware libraries in the depends folder, adds a few custom source directories, include directories (for libraries not in particle format), and explicitly structures the build directory (including the logs directory and source).




APP_LIB_DIR = depends


CPPSRC += $(call target_files, $(APP_ROOT)/$(APP_DEPENDECIES_SRC), *.cpp)
CSRC += $(call target_files, $(APP_ROOT)/$(APP_DEPENDECIES_SRC), *.c)


	depends/some_dep/src \
	appname/src/core \
	appname/src/logs \

CPPSRC += $(call target_files,$(APP_SRC), *.cpp)
CSRC += $(call target_files,$(APP_SRC), *.c)
APPSOURCES = $(call target_files,$(APP_SRC), *.cpp)

I’ve tried setting USER_MAKEFILE and naming the makefile differently.

The particle build is picking up my main.cpp for compilation, but missing some references to the include dirs. It’s failing with “fatal error: someheader.h: No such file or directory”. It’s referenced using #include <someheader.h>

Can anyone give me any insight into why particle seems to be ignoring my custom makefile? It doesn’t include any targets, just variable setup.
I assume if someheader.h was on the include path it would find it. I’ve tried switching to quote-based include references but it did not help. Our version of the system firmware is frozen at 0.5.3 if that makes any difference.

Running make with -d and v=1 sudo make -d v=1 <rest of make arguments> revealed that my makefile was getting included in the build chain. However particle mangles build paths so relative paths outside the src tree are not included unless you use absolue or system include references.

I’m working on getting particle to copy external source into it’s build tree in a non-symlinked way.

Let me ping someone that might be able to help, @rickkas7 or @ParticleD are you able to assist?

It turns out I wasn’t setting USER_MAKEFILE to the right directory.
I gave it a path relative to $APPDIR/src and it was picked up correctly.
I had some issues with the target_path unspooling macro, but eventually was able to get all my out-of-tree cpp and h files to be detected with absolute paths and system #include <somefile.h> directives.