These Makefiles are used for building systems software projects. They support C and C++ compilation, proper assembly, and compilation of a variety of asset formats used by software into object code. The Slick Makefiles are a living example showing how meta-build systems like CMake and SCons are unnecessary to target many platforms. They are a vastly simpler answer to the problem of building software, and they make no sacrifices in ability to output.
There are two files comprising the distribution:
targets.mk. In the project root where the
Makefile resides, a folder
etc/ is created to contain these two files. In the
base.mk is included at the top, before anything else;
targets.mk is included last, after the declaration of sources, flags and such.
This Makefile provides multi-platform build normalisation for the C and C++ compilation toolchains. It is included at the top of the main Makefile. Before anything else, it ensures that
make is GNU make, and that it is at least version 3.82. After this, it defines a long list of variables, grouped into several categories:
base.mkperforms a printout of all the variables as-configured to standard output. This eases build diagnostics, as options used are viewable so they can be copied and modified into environmental overrides as necessary.
exports all of the variables so other modules can see them.
SLICK_NOPRINTenvironment variable in your session.
$TC). Note that TCC is supported as an override with
$TC). Beware that on macOS, this is the LLVM IR assembler!
$DEFINESthis does not work for the assembler.
uname -s. Usually either
$UNAME). Valid values are:
llvm(installed through Homebrew!); on Linux, this defaults to
gnu. Valid values are:
mingw32(Windows targets only),
.soon POSIX platforms,
.dllon Windows targets, and a bad dummy value for the GBA where it is unsupported.
lib/folders for different target platforms in the same development environment.
#defines. As noted earlier, these are synthetic stand-ins for the variables in an autogenerated
config.hfile, allowing code to be made more portable according to the specific quirks and limits of the target system.
.exe. Targeting the GBA makes it become
#defines are provided by
base.mk to the CPP and the assembler to allow code to be made more amicable to the specifics of different machines. They are always prefixed with
This file provides the actual recipes for building the program. Most importantly, it provides half a dozen phony targets for different styles of builds:
ubsan. These of course support fully parallel job control with invocations of the sort
make -j, and non-phony targets can be built and rebuilt at will.
base.mk’s printout will show what the default options are for a given target. There are also
clean targets which provide C/C++ autoformatting and build artefact cleaning, respectively.
alltarget in the main Makefile and set whichever default target they wish (the first target in any Makefile is the default), but otherwise
debugwill be the default target.
Several variables are intentionally left undefined in
base.mk despite being required by
targets.mk, as they are the variables projects are supposed to define in their Makefiles! These are:
<system>include directories for the CPP.
"local"include directories for the CPP.
While usage of sysroots is supported and encouraged since development is bound to Unix-like hosts, sometimes it is useful to bring dependencies in-tree. The Slick Makefiles provide a straightforward way to do this with a folder named
Say you have a library with
uni. By cloning or symlinking it into another project’s
3rdparty/ subfolder under the name
unilib and appending
uni to the
$3PLIBS variable in the Makefile, that library will have its
#includes and code brought in automatically for free. The catch is, the libraries must adhere to ADP 1 so that directories and names can resolve.
$3PLIBS provides a list of such libraries to integrate.
$3PLIBDIRS provides additional directories besides
3rdparty/ to search through for them, if desired.
There are example Makefiles in the repository for both executable programs and libraries, located in the
src/ folder. With this documentation and those files as a helping hand, you can start using Slick to build your programs quickly and easily.