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:--lexpat}
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 proto $bindir/
26 description = install proto
27
28build parse.o: cc parse.c
29build proto.o: cc proto.c
30build protocol.o: cc protocol.c
31build util.o: cc util.c
32
33build proto: link parse.o proto.o protocol.o util.o
34build all: phony proto
35build install: install proto
36
37default all