More cosmetics
[llpp.git] / build.ninja
blob76076e5d01797c90f65d108cccc2d804c82754e6
1 cc = gcc
2 include .config
3 ocamlflags = -warn-error +a -w +a -g -safe-string
4 libs = -lmupdf $mujs -lpthread -Lmupdf/build/$buildtype
6 cflags = $cflags -Wall -Werror -Imupdf/include -g $
7        -std=c99 -pedantic-errors -Wunused-parameter -Wsign-compare -Wshadow
9 rule cc
10      deps = gcc
11      depfile = $out.d
12      command = $ocamlc -cc "$cc" -ccopt "$cflags -MMD -MF $out.d -o $out" -c $in
13      description = cc $out
15 rule ocamlc
16      command = env incs="$incs" pp="$pp" /bin/sh $srcdir/doocaml.sh $
17              $ocamlc $out $in -c $ocamlflags
18      description = ocamlc $out
20 rule genhelp
21      command = sh $srcdir/mkhelp.sh $srcdir/keystoml.ml $srcdir/KEYS >$out
22      description = genhelp
24 build $builddir/help.ml: genhelp $
25       $srcdir/mkhelp.sh $srcdir/keystoml.ml $srcdir/KEYS
26 build $builddir/link.o: cc $srcdir/link.c
27       cflags = $cflags -D_GNU_SOURCE -DFFP
28 build $builddir/help$cmo: ocamlc $builddir/help.ml
29 build $builddir/utils$cmo: ocamlc $srcdir/utils.ml
30 build $builddir/bo$cmo: ocamlc $srcdir/le/bo.ml
31 build $builddir/wsi.cmi: ocamlc $srcdir/wsi.mli $
32       | $builddir/utils$cmo
33 build $builddir/wsi$cmo: ocamlc $srcdir/wsi.ml $
34       | $builddir/bo$cmo $builddir/utils$cmo $builddir/wsi.cmi
35 build $builddir/parser$cmo: ocamlc $srcdir/parser.ml
36 build $builddir/config$cmo: ocamlc $srcdir/config.ml $
37       | $builddir/wsi.cmi $builddir/utils$cmo $
38         $builddir/parser$cmo $builddir/help$cmo
39       incs = $lablglcflags
40 build $builddir/main$cmo: ocamlc $srcdir/main.ml $
41       | $builddir/wsi.cmi $builddir/utils$cmo $builddir/config$cmo $
42         $builddir/help$cmo $srcdir/doocaml.sh $srcdir/pp.sed
43         incs = $lablglcflags
44         pp = sed -f $srcdir/pp.sed
46 rule linkso
47      command = $cc -g -o $out -shared $in $libs $lflags
48      description = linkso $out
50 build $builddir/link.so: linkso $builddir/link.o
52 rule link
53      command = $ocamlc -g -o $out $lablglcflags $
54              str$cma unix$cma lablgl$cma $in $
55              $ocamllflags
56      description = link $out
58 build $builddir/llpp.custom: link $
59      $builddir/help$cmo $
60      $builddir/utils$cmo $
61      $builddir/parser$cmo $
62      $builddir/bo$cmo $
63      $builddir/wsi$cmo $
64      $builddir/config$cmo $
65      $builddir/main$cmo $
66      $builddir/link.o
67      ocamllflags = $customflag -cclib "$libs -lX11 $lflags"
69 build $builddir/llpp: link $
70      $builddir/help$cmo $
71      $builddir/utils$cmo $
72      $builddir/parser$cmo $
73      $builddir/bo$cmo $
74      $builddir/wsi$cmo $
75      $builddir/config$cmo $
76      $builddir/main$cmo $
77      | $builddir/link.so
78      ocamllflags = $linksocclib $builddir/link.so
80 default $builddir/llpp