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:--D_POSIX_C_SOURCE=200809L -Isource/include -O2 -std=c99}
 8ldflags = $${LDFLAGS:-}
 9# add xcb stuff if you want Xwayland:
10# libs = `pkg-config --static --libs swc wayland-server xkbcommon libinput pixman-1 libdrm wld libudev xcb xcb-composite xcb-ewmh xcb-icccm`
11# remove libudev if you don't use udev.
12# libs = `pkg-config --static --libs swc wayland-server xkbcommon libinput pixman-1 libdrm wld`
13libs = $${LIBS:-`pkg-config --static --libs swc wayland-server xkbcommon libinput pixman-1 libdrm wld libudev`}
14prefix = $${PREFIX:-/usr/local}
15destdir = $${DESTDIR:-}
16bindir = $destdir$prefix/bin
17
18rule cc
19  command = $cc $cflags -MMD -MF $out.d -c -o $out $in
20  deps = gcc
21  depfile = $out.d
22  description = cc $out
23
24rule link
25  command = $cc $ldflags -o $out $in $libs
26  description = link $out
27
28rule install
29  command = mkdir -p $bindir && cp tohu $bindir/
30  description = install tohu
31
32build source/tohu.o: cc source/tohu.c
33build source/util.o: cc source/util.c
34
35build tohu: link source/tohu.o source/util.o
36build all: phony tohu
37build install: install tohu
38
39default all