Trying makefiles for the first time (used to VS). I have a few questions:
1. All files (src, include [for entry points], bin and intermediate) are in the same directory. How can I specify paths for each one?
2. Is there a way to automatically make header dependencies for .o targets?
If I add #include "dictionary.hpp" in synthesizer.hpp, do I have to go back and change my makefile?
> How can I specify paths for each one?
For headers, use the INCLUDEFLAGS, by instance -Iheader
note how it has different directories for binary, object files, dependencies, in debug and release configuration.
> Is there a way to automatically make header dependencies for .o targets?
The header dependencies are generated by invoking g++ with the -MM -MP flags
> I like the -Wall option, how do I include that in an implicit rule
CFLAGS are flags for compiling C code
CXXFLAGS are flags for compiling C++ code
Hmm after adding -MM, the build seems to fail. Before it failed, figured out how to get the output directory in there though. (make is still built from the src folder though).
Here is the makefile/Output
That link actually really helped. I've got it working now with proper dependencies and intermediate directories. A lot of the syntax I'm still confused about, but I think I can worry about specific lines when I need to change them.