I have a bit of a strange workflow wherein I use mbed compile to actually generate the code for my application but I need to generate a compilation database (a compile_commands.json file) to be used with clang tools.
To do this, I use mbed export -i make_gcc_arm to generate a Makefile, and then I use https://github.com/rizsotto/Bear to generate the compile_commands.json file. Bear is simply a make wrapper so the command used is just bear -- make.
I typically have to make clean before running the bear command which wipes out the entire ./BUILD directory. This means subsequent mbed compile commands have to be run from scratch. Is it possible to generate the Makefile so that the output directory is something like ./BUILD/make?