shake
minimal build system that generates Ninja build files
git clone https://9o.is/git/shake.git
commit 46536c06080d5f9e260d4ec2c1250f0bd7e02fa9 parent 30746a722bfc55023d1644d3ef96c44ad88b2beb Author: Jul <jul@9o.is> Date: Mon, 9 Mar 2026 16:23:15 +0800 add simple example Diffstat:
| A | example/simple/.gitignore | | | 5 | +++++ |
| A | example/simple/Shakefile | | | 24 | ++++++++++++++++++++++++ |
| A | example/simple/hello.c | | | 6 | ++++++ |
| A | example/simple/hello.h | | | 6 | ++++++ |
| A | example/simple/main.c | | | 6 | ++++++ |
5 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/example/simple/.gitignore b/example/simple/.gitignore @@ -0,0 +1,5 @@ +*.ninja +.ninja_log +.ninja_deps +*.o +/hello diff --git a/example/simple/Shakefile b/example/simple/Shakefile @@ -0,0 +1,24 @@ +#!/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 cp 'cp -f $in $out' + bind description 'CP $in' + +cc main.o main.c +cc hello.o hello.c +link hello main.o hello.o + +cp $DESTDIR$PREFIX/bin/hello hello +phony install $DESTDIR$PREFIX/bin/hello + +default hello diff --git a/example/simple/hello.c b/example/simple/hello.c @@ -0,0 +1,6 @@ +#include <stdio.h> +#include "hello.h" + +void hello(void) { + printf("Hello, shake!\n"); +} diff --git a/example/simple/hello.h b/example/simple/hello.h @@ -0,0 +1,6 @@ +#ifndef HELLO_H +#define HELLO_H + +void hello(void); + +#endif diff --git a/example/simple/main.c b/example/simple/main.c @@ -0,0 +1,6 @@ +void hello(void); + +int main(void) { + hello(); + return 0; +}