Giter Site home page Giter Site logo

ubermakefile's Introduction

ubermakefile

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.

5 steps quick start

  • 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 shim makefile that includes or redirects all unmatched targets into it
  • make/make all or make devall, for building in release or debug mode, respectively

Optional step

  • Add any source-built dependencies as git submodules and declare them with build instructions in ubermakefile.json

Layout of ubermakefile.json


flags

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.

common

For general build flags that do not affect debugging or optimisation levels.
Examples: -std=c++17, -pedantic, -Wall, -I...

debug

Flags typically used when debugging, i.e. -O0, -Og, -g, -g<1-3>, etc.

release

Normally the opposite of debugging, these flags are meant for increased optimisation, i.e. -O, -O<1-3>, -Os, -g0, etc.


targets

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.

<target-path>

A single build artifact. Its name is used by make as target for a recipe.

static

A boolean value. Specifies if the current artifact is a static library.
Defaults to false if absent.

flags

Flags that are specific to the underlying type of artifact being built.
These should not affect debugging or optimisation characteristics.

objects

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 %.


dependencies

Build dependencies—normal and source-built—are declared here.
Each key in this dictionary is a package that can be queried with pkg-config.

<package-name>

A single dependency. Used in invocations of

pkg-config <package-name> [--static] <--cflags ¦ --libs-only-L --libs-only-other ¦ --libs-only-l>
static

A boolean value. Toggles the --static option of pkg-config.
Basically, it toggles between static and dynamic linking against <package-name>.

build

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.

ubermakefile's People

Contributors

bit2shift avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.