Open b-spencer opened 10 months ago
@b-spencer Thank you for the detailed issue and request! Updating the docs as well as your suggestions for running clean configure upon switching targets is a reasonable thing to consider, I will mark it as a request and put it on our backlog to investigate and consider! Thanks.
First up, thanks for the extension. I use it constantly to generate a compilation database (CDB).
I think that the following Makefile Tools commands behave as I describe below:
make
with flags including--dry-run
that cause it to print the commands needed to build all out-of-date targets. Makefile Tools then parses this to producecompile_commands.json
.make
with the same flags, plus--always-make
so that it prints the commands needed to build all targets.I also think that whenever I change the "Configuration" on the Makefile Tools section of the Primary Sidebar, the extension automatically runs "Makefile: Configure". Thus, when I switch configuration, the CDB is updated, but only with information about the commands needed to build the out-of-date targets.
(BTW, I learned the above by examining the diagnostics output of Makefile Tools. This wasn't at all obvious to me, and it took a great deal of experimentation to figure this out. I suggest expanding the documentation to talk about these commands and why and when you should use them.)
When I am working on a project, I almost always have all of it already built. So, most of my targets are already up-to-date. This means that when "Makefile: Configure" runs, there are usually zero or very few commands printed by
make
to the build log, which means that Makefile Tools does not update very much of the CDB.So, when I change the Configuration in the Makefile Tools section of the Primary Sidebar, I always want to regenerate all of the commands in the CDB. At least for all of my projects, changing the configuration means changing every compile command. Note that I am talking about the Configuration, not the Build target. Note that I do not
make clean
when I switch configurations. In my projects, different configurations actually generate completely different artefacts to different build output directories, or have other automatic rules that do not require cleaning the workspace. I think this is common even for less complex projects with, for example, release vs. debug configurations.Thus, every time I change the Configuration:
Therefore, I ask:
Thanks for considering the questions.