Single-header build system for C. Uses C to exclusively build C.
Specificity, reduced scope, everything in service of simplicity.
- C syntax build file.
- Simple API.
- Single header:
mace.h
. make
-like usage and flags withmace
convenience executable.- Tab completion (
zsh
only), see_mace.zsh
- Compatible with
gcc
,clang
,tcc
toolchains.
- Get
mace.h
- Write your own macefile e.g.
macefile.c
- Bootstrapping:
gcc macefile.c -o builder
- Building:
./builder
- Reserved targets:
./builder clean
,./builder all
- Configs:
./builder -g release
- Reserved targets:
Use the MACEFLAGS environment variable to set default flags.
- Install
mace
convenience executable- Bootstrapping:
gcc installer.c -o installer
- Run installer:
sudo ./installer
.
- Bootstrapping:
- Write your own macefile e.g.
macefile.c
- Bootstrapping & building:
mace
Use these macro definitions when compiling installer
to customize mace
:
-DPREFIX=<path>
to change install path. Defaults to/usr/local
.-DDEFAULT_MACEFILE=<file>
to change default macefile name. Defaults tomacefile.c
.-DBUILDER=<file>
to change builder executable path.-DCC=<compiler>
to change compiler used bymace
. Defaults togcc
.-DAR=<archiver>
to change archiver used bymace
. Defaults toar
.-DZSH_COMPLETION=<path>
to set path formace
zsh tab completion. Defaults to/usr/share/zsh/site-functions
.
- Too many build complex, slow build systems.
- Using C to build C gets you free lunches.
- Learning C is learning
mace
. - Full C functionality in your macefile.
- Learning C is learning
- Using C to build C gets me free lunches.
- No weird syntax to create.
- No bespoke parser to implement.
- POSIX glob.h required.
- On Windows,
Cygwin
orMSYS2
shells might work. Untested.
- On Windows,
- Circular dependencies unsupported.
- User inputs target dependencies with
target.links
andtarget.dependencies
- Build order determined by depth first search through all target dependencies.
- Mace saves file checksums to
.sha1
files in<obj_dir>/src
,<obj_dir>/include
- Uses checksum to check if sources, headers change for recompilation.
- Compiler computes object file dependencies, saved to
.d
files in<obj_dir>
- Parsed into binary
.ho
file for faster reading.
- Parsed into binary
cd
into test folder- Compile test:
gcc test.c -o test -I..
- Run tests
./test
cd
into benchmarks folder- Compile test:
gcc benchmarks.c -o bench
- Run benchmarks
./benchmarks
- Can't compile targets if there are no headers?
- Cannot reproduce in tests
- Inspiration for this project: mage
- API inspired by Premake5.
- Checksum sha1dc algorithm: sha1collisiondetection
- Argument parser: parg