main 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:--ltinfo}
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 yap $bindir/
26  description = install yap
27
28build ansi.o: cc ansi.c
29build commands.o: cc commands.c
30build display.o: cc display.c
31build getcomm.o: cc getcomm.c
32build getline.o: cc getline.c
33build help.o: cc help.c
34build keys.o: cc keys.c
35build machine.o: cc machine.c
36build main.o: cc main.c
37build options.o: cc options.c
38build output.o: cc output.c
39build pattern.o: cc pattern.c
40build process.o: cc process.c
41build prompt.o: cc prompt.c
42build rune.o: cc rune.c
43build term.o: cc term.c
44
45build yap: link ansi.o commands.o display.o getcomm.o getline.o help.o keys.o machine.o main.o options.o output.o pattern.o process.o prompt.o rune.o term.o
46build all: phony yap
47build install: install yap
48
49default all