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}
 8ldflags = $${LDFLAGS:-}
 9ar = $${AR:-ar}
10ranlib = $${RANLIB:-ranlib}
11prefix = $${PREFIX:-/usr/local}
12destdir = $${DESTDIR:-}
13bindir = $destdir$${BINDIR:-$prefix/bin}
14mandir = $destdir$${MANDIR:-$prefix/share/man}
15datadir = $destdir$${DATADIR:-$prefix/share}
16
17rule cc
18  command = $cc $cflags -MMD -MF $out.d -c -o $out $in
19  deps = gcc
20  depfile = $out.d
21  description = cc $out
22
23rule link
24  command = $cc $ldflags -o $out $in $libs
25  description = link $out
26
27rule ar
28  command = rm -f $out && $ar -rc $out $in && $ranlib $out
29  description = ar $out
30
31rule install1
32  command = mkdir -p $bindir $mandir/man1 && cp $bin $bindir/ && chmod 755 $bindir/$name && cp $man $mandir/man1/ && chmod 644 $mandir/man1/$manname
33  description = install $name
34
35rule install8
36  command = mkdir -p $bindir $mandir/man8 && cp $bin $bindir/ && chmod 755 $bindir/$name && cp $man $mandir/man8/ && chmod 644 $mandir/man8/$manname
37  description = install $name
38
39rule install_look
40  command = mkdir -p $bindir $mandir/man1 $datadir/dict && cp $bin $bindir/ && chmod 755 $bindir/$name && cp $man $mandir/man1/ && chmod 644 $mandir/man1/$manname && cp $dict $datadir/dict/words && chmod 644 $datadir/dict/words
41  description = install $name
42
43subninja compat/build.ninja
44subninja apply/build.ninja
45subninja col/build.ninja
46subninja ctags/build.ninja
47subninja finger/build.ninja
48subninja jot/build.ninja
49subninja look/build.ninja
50subninja makefs/build.ninja
51subninja pr/build.ninja
52subninja rs/build.ninja
53subninja script/build.ninja
54
55build all: phony compat/all apply/all col/all ctags/all finger/all jot/all look/all makefs/all pr/all rs/all script/all
56build install: phony apply/install col/install ctags/install finger/install jot/install look/install makefs/install pr/install rs/install script/install
57
58default all