shake

minimal build system that generates Ninja build files

git clone https://9o.is/git/shake.git

commit fccb9ee79022dc073fe8d6dfd253a1cb08f351bb
parent 9ec8141cc15a9782f7968e49ebb27272cc95b631
Author: Jul <jul@9o.is>
Date:   Mon,  9 Mar 2026 19:29:34 +0800

add nested example

Diffstat:
Aexample/nested/.gitignore | 5+++++
Aexample/nested/Shakefile | 18++++++++++++++++++
Aexample/nested/bin/Shakefile | 6++++++
Aexample/nested/bin/main.c | 9+++++++++
Aexample/nested/lib/Shakefile | 6++++++
Aexample/nested/lib/lib.c | 3+++
6 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/example/nested/.gitignore b/example/nested/.gitignore @@ -0,0 +1,5 @@ +.shake/ +*.ninja +*.o +*.a +bin/hello diff --git a/example/nested/Shakefile b/example/nested/Shakefile @@ -0,0 +1,18 @@ +#!/usr/bin/env sh + +var CC ${CC:-cc} +var CFLAGS ${CFLAGS:--Wall -Wextra -g} +var PREFIX ${PREFIX:-/usr/local} +var DESTDIR ${DESTDIR:-} + +rule cc '$CC $CFLAGS -c $in -o $out' + bind description 'CC $in' + +rule link '$CC $in -o $out' + bind description 'LINK $out' + +rule ar 'ar rcs $out $in' + bind description 'AR $out' + +shake lib +shake bin diff --git a/example/nested/bin/Shakefile b/example/nested/bin/Shakefile @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +cc main.o main.c +link hello main.o $outdir/../lib/lib.a + +default hello diff --git a/example/nested/bin/main.c b/example/nested/bin/main.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +int add(int a, int b); + +int main() { + int result = add(2, 3); + printf("2 + 3 = %d\n", result); + return 0; +} diff --git a/example/nested/lib/Shakefile b/example/nested/lib/Shakefile @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +cc lib.o lib.c +ar lib.a lib.o + +default lib.a diff --git a/example/nested/lib/lib.c b/example/nested/lib/lib.c @@ -0,0 +1,3 @@ +int add(int a, int b) { + return a + b; +}