For those who are not very fond of CMake. For C++ code bases.
It can be used with C if you're willing to do some little editing.
Relies on common essential tools—find
, git
, make
(obviously) and pkg-config
—in addition to jq
—for querying ubermakefile.json
.
- Plop your code into a
src
folder - Specify the build (compile and link) flags alongside with normal dependencies in
ubermakefile.json
- Define the build targets with their even-so-more-specific flags and objects in
ubermakefile.json
- Either symlink
ubermakefile/makefile
into your project or have a shimmakefile
that includes or redirects all unmatched targets into it make
/make all
ormake devall
, for building in release or debug mode, respectively
- Add any source-built dependencies as
git
submodules and declare them with build instructions inubermakefile.json
flags
targets
(mandatory)<target-path>
(mandatory)
dependencies
Contains the build flags, i.e. CXXFLAGS
, CPPFLAGS
, LDFLAGS
, LDLIBS
, etc.
They are passed directly into make
and, as such, are subject to expansion. That means you can use -I$(CURDIR)/...
for adding include paths in the current directory.
It also means you can do all sorts of make
shenanigans that are valid inside variable assignments.
For general build flags that do not affect debugging or optimisation levels.
Examples: -std=c++17
, -pedantic
, -Wall
, -I...
Flags typically used when debugging, i.e. -O0
, -Og
, -g
, -g<1-3>
, etc.
Normally the opposite of debugging, these flags are meant for increased optimisation, i.e. -O
, -O<1-3>
, -Os
, -g0
, etc.
Build artifacts are declared in this section. There can be many, including test rigs.
Each key in this dictionary is the path of a single build artifact, as if located inside the src
folder.
A single build artifact. Its name is used by make
as target for a recipe.
A boolean value. Specifies if the current artifact is a static library.
Defaults to false
if absent.
Flags that are specific to the underlying type of artifact being built.
These should not affect debugging or optimisation characteristics.
A string or an array of strings, each containing a pattern that can be passed to $(filter pattern…,text)
in make
.
Used for selecting the objects required for building the current artifact.
TL;DR: It's a list of wildcard paths, with the wildcard character being %
.
Build dependencies—normal and source-built—are declared here.
Each key in this dictionary is a package that can be queried with pkg-config
.
A single dependency. Used in invocations of
pkg-config <package-name> [--static] <--cflags ¦ --libs-only-L --libs-only-other ¦ --libs-only-l>
A boolean value. Toggles the --static
option of pkg-config
.
Basically, it toggles between static and dynamic linking against <package-name>
.
Only used for source-built dependencies.
A string or an array of strings containing commands to build <package-name>
.
They are executed, in sequence, inside the corresponding submodule folder using git submodule foreach
.