[Make] Building all files in targeted location

I’m really enjoying the Particle build system, but I’ve run across a customization problem. It seems that setting the APP_DIR variable only puts the application object files into the intended directory. How can I go about putting all build files there? I’d like more control over my build environment and, amongst other things, I’d like to make sure that a make all_clean cleans absolutely everything, including all Particle build files.

Right now, I’m finding build files a little spread throughout, like ~/.particle/toolchains/deviceOS/1.4.4/firmware-1.4.4/build/target/user/platform-12-m, ~/.particle/toolchains/deviceOS/1.4.4/firmware-1.4.4/build/target/user/platform-13-m, ~/.particle/toolchains/deviceOS/1.4.4/firmware-1.4.4/build/target/user/platform-14-m, … That’s really not great because it makes deep cleaning hard. It also makes it hard to do more advanced analysis into the binaries because it’s not clear where all the changes are.


As per @rickkas7 below, there is no way to do what I asked, but there is a way to accomplish the biggest goal, which is to ensure that make clean can delete absolutely everything.

Bumping this. @rickkas7, any ideas? This problem popped back onto my radar a few minutes ago, when I had to do a weird make clean because of the files in .particle/toolchains/deviceOS/1.4.4/firmware-1.4.4/build/target/user/platform*`.

There’s no way to change the behavior other than modifying all of the Makefiles. However, you can just delete build/target which will delete all of the intermediate object files and built binaries.

build/target, or build/target/user? It seems like build/target has a lot of things in it. Are those all automagically populated?

Is there a way to programmatically do this, aside from a custom rm script? I can’t swear by it, but I remember a time in the past when I used make sanitize and even then I had to go through and delete files manually.

Everything in build/target is generated. If you delete only build/target/user it will delete all of the intermediate objects and binaries for user firmware, but leave the built binaries for Device OS itself.

Make clean should be sufficient, but if I get an unexplained failure to build I usually then opt to delete build/target and that usually solves the problem.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.