Autark
autark.dev- Category
- Developer Tools
- Rank
- No. 1518Tools index
Previous survey · No. 1482 ·
- Pricing
- Open Source
- Type
- TOOL
- Use case
- Coding
- Interfaces
- CLI
- GitHub
- 15 stars
- Latest release
- v0.9.19
- Date
About
Autark is a self-bootstrapping C/C++ build system distributed as embedded C source inside a single build.sh script, requiring only a C99 compiler to compile itself and then build a project. It uses a declarative DSL for build rules, tracks internal and external dependencies, supports parallel compilation, generates compile_commands.json, and can package source distributions for isolated builds.
What it does
Autark is a make replacement for C and C++ code that ships inside your repository as one shell script. The script carries the whole tool as C source: on first run it finds clang or gcc, compiles a small binary into a hidden cache folder, then reuses that binary until the version changes. You describe targets in a brace-delimited rule file with conditionals, variables and includes, and small shell scripts probe the system for libraries and compilers. All outputs land in a separate cache folder that mirrors your tree, so the checked-out code stays untouched.
Why it's ranked here
The pitch holds up in the code. The only thing a user needs is a C compiler, the license is MIT, and the tool builds itself with its own rule language, so its own build file doubles as a real-world example. Rebuild decisions are concrete: it records file modification times, environment values and compiler-reported header dependencies, and recompiles only the changed sources unless a non-source input moved. The weak side is reach. It is still pre-1.0, every showcase project comes from the same company, and the CI pipeline in the repository tests one platform with one compiler.
What's good
Nothing has to be installed first. A fresh clone plus any C compiler is enough, which suits source tarballs and odd build hosts. Compilation runs four jobs in parallel by default, adjustable by flag. It can emit a compilation database for editor tooling such as clangd, and can assemble a source distribution with external dependencies bundled for offline builds. Every external command is echoed before it runs, and failed sources are marked stale so the next run retries exactly them. Syntax highlighting exists for Vim, Neovim, VSCode and TextMate.
Tradeoffs
Process launching is built on POSIX primitives such as fork, poll and glob, and nothing in the files read handles Windows. System checks are shell scripts, so portability depends on how carefully you write them. The bootstrap compiles with native CPU tuning, which is fine locally but worth knowing on shared build images. The rule language is deliberately not a programming language, so complex logic moves into those shell scripts. Rule files over one megabyte are refused, and macro recursion stops at 128 levels. The project is young, with frequent fix releases for memory and dependency-tracking bugs.
How to use it well
Pick it for a C library or small C or C++ application you want buildable anywhere with only a compiler, especially when you ship source to people who will not install CMake or Meson. Start from the sample project the README links, keep detection logic in check scripts, and pass build options on the command line rather than editing rule files. Turn on the compilation database flag for editor support. Skip it if you need Windows builds, IDE project generation, or a large ecosystem of community recipes, since the tool provides none of these.
Technical notes+
build.sh is an amalgamated wrapper: it compares META_VERSION.META_REVISION against the cached autark-cache/.autark-dist/autark -v output, otherwise picks $CC, then clang, then gcc, and compiles the embedded C heredoc with --std=c99 -O1 -march=native; MACRO_MAX_RECURSIVE_CALLS is 128. main.c calls autark_init/autark_run/autark_dispose declared in autark.h. script.c maps rule keywords (set, check, cc/cxx, run, include, foreach, macro, fetch-url and others) to node types, strips comment lines before parsing, and reads scripts with a 1 MiB cap. node_cc.c spawns compiles with -MMD, parses the resulting .d files into alias deps, runs up to max_parallel_jobs children via wait(), and appends compilation-database entries. deps.c stores type, flags, resource and mtime serial per line and treats a newer mtime or changed env value as outdated. spawn.c prepends the cache dir to PATH and prints each command. node_check.c resolves check scripts under .autark/ by walking the unit stack. The root Autark file builds the tool itself; tests/test1.c compares a parse dump; .github/workflows/ci-macos.yml runs build.sh with RUN_TESTS=1 on macos-14 with clang.
Observed
- License
- MIT (LICENSE)
- Language
- C, with a POSIX shell bootstrap wrapper (build.sh)
- Install surface
- Single script copied into the project; requires only a C99 compiler (clang or gcc auto-detected)
- Interface
- CLI with build, clean, install, compile-commands and source-distribution flags (autark_core.c usage text)
- Platform
- POSIX process spawning via fork/execve/poll (spawn.c); FreeBSD-specific pkgconfig default; no Windows path in files read
- Incremental builds
- mtime, environment-value and compiler -MMD header tracking (deps.c, node_cc.c)
- Tests and CI
- C test programs under tests/; CI workflow runs on macOS 14 with clang only (.github/workflows/ci-macos.yml)
- Self-hosting
- The tool's own build is an Autark rule file (Autark)
Read from README.md, autark.h, main.c, autark_core.c, script.c, node_cc.c, node_check.c, spawn.c, deps.c, Autark, CHANGELOG.md, LICENSE, build.sh, tests/test1.c, .github/workflows/ci-macos.yml.
What it can do
Compile its own embedded C source using a C99 compiler
C99 compiler → Autark build system binary
Build a project using a declarative DSL for build rules
Build rule definitions → Compiled project
Track internal and external dependencies
Project source and dependency files → Dependency graph
Compile source files in parallel
Source files → Compiled objects
Generate compile_commands.json
Build configuration → compile_commands.json file
Package source distributions for isolated builds
Project source → Source distribution package
Tags
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.