Makefile hacks
I love GNU Make. The simplicity of Makefiles makes it an extremely versatile and powerful tool. Here is some Makefile-fu I learned over the years.
I love GNU Make. The simplicity of Makefiles makes it an extremely versatile and powerful tool. Here is some Makefile-fu I learned over the years.
Preprocessor flags C++ preprocessor directives are useful for many things. One use is to set flags from the command line in order to compile the program in different ways. For instance, we could have a DEBUG flag which, if set, gives us some extra feedback useful for debugging: int main() { // Do some stuff…
Building (compiling) large projects can take a long time. Build systems like Make and SCons do a really good job of reusing resources that don’t need recompiling because we didn’t change anything, but compiling a large project for the first time can still take a while. One solution to this issue, especially with multicore and
We already know make, a powerful tool to automate all kinds of building sequences. But if you are using it to compile large C++ projects, you will quickly find that it’s tedious to maintain, and that you’re often repeating the same commands over and over again. This, of course, opens up the door to mistakes
make is a very useful tool when working on large projects with many dependencies. A C++ project with many header includes, for instance, can quickly get tedious to compile, when at each compilation you must run several commands: g++ -c main.cpp -o lib/main.o g++ -c myfile.cpp -o lib/myfile.o g++ lib/main.o lib/myfile.o -o main What make