C++ Makefile, Library Folders

Earlier, we allowed each library to have individual compilation flags. Here, we will re-implement this feature in a more flexible way, and allow libraries to specify multiple directories that contain source code. Read more

Tags: C++ , Make

C++ Makefile, C code

So far, we have dealt with C++ code exclusively. Today, I was looking at the makefile, and I realized that it would be quite simple to compile C code as well. In addition, we will generalize the code, so that our C++ files can have file extensions other than .cc. Read more

Tags: C++ , Make

C++ Makefile, Cross-Compiling

I have written one previous post on cross compiling, which used the scons build system. However, scons is not universally installed, and has some issues with larger projects. Here, I will use the same strategy for cross-compiling using mingw-w64, but with the generic makefile that has been developed over the last several posts. Read more

Tags: C++ , Make

C++ Makefile, Static Library

All of our previous examples have used only shared libraries. While shared libraries are very useful, static libraries also have their use. Link-time optimization can be done much more aggressively. Any functions that are not called can be pruned by the compiler, whereas they cannot be pruned from a shared library. Here, we will improve the makefile to compile either shared or static libraries. Read more

Tags: C++ , Make

C++ Makefile, Build Targets

Currently, we can change build parameters from the command line by overwriting the makefile’s variables. However, if we are making a large number of changes, this becomes unwieldy. We wouldn’t want to need to remember all the parameters for switching between a debug build and a release build, for example. Let’s add the ability to switch between different sets of parameters. Read more

Tags: C++ , Make

C++ Makefile, Pretty Output

All the previous posts about makefiles have focused on flexibility and ease of use. This time, we will be improving the readability of the output of the makefile. Read more

Tags: C++ , Make

C++ Makefile, Library-Specific Flags

In the previous post, we made a makefile capable of compiling multiple shared libraries, and multiple executables. Now, modifying the makefile so that each library can have specific compilation flags. Read more

Tags: C++ , Make

C++ Makefile, Multiple Libraries

Previously, we made a makefile to compile programs against a single library. Now, we will extend that makefile to compile multiple libraries. Read more

Tags: C++ , Make

C++ Makefile, Command-Line Variables

As of the end of the previous post, we have a working makefile. Now, I want to start following better practices, so that it can be more flexible for interactive use. Read more

Tags: C++ , Make

C++ Makefile, Shared Libraries

In my previous post, I described a makefile that automatically determines which source files need to be built. Here, I will expand on this makefile to include shared libraries. Read more

Tags: C++ , Make