main shrubtools / peek / build.ninja
 1# i know this is a ninja file, but you're allowed to edit it.
 2# you can also pass things on the command line if you like, eg
 3#
 4#     CC=clang ninja
 5
 6cc = $${CC:-cc}
 7cflags = $${CFLAGS:--O2 -std=c99}
 8ldflags = $${LDFLAGS:-}
 9libs = $${LIBS:-}
10prefix = $${PREFIX:-/usr/local}
11destdir = $${DESTDIR:-}
12bindir = $${BINDIR:-$${DESTDIR:-}$${PREFIX:-/usr/local}/bin}
13
14rule cc
15  command = $cc $cflags -MMD -MF $out.d -c -o $out $in
16  deps = gcc
17  depfile = $out.d
18  description = cc $out
19
20rule link
21  command = $cc $ldflags -o $out $in $libs
22  description = link $out
23
24rule install
25  command = mkdir -p $bindir && cp peek $bindir/
26  description = install peek
27
28build peek.o: cc peek.c
29
30build peek: link peek.o
31build all: phony peek
32build install: install peek
33
34default all