First stab at ocaml dependencies
[llpp.git] / build.ninja
blob1c1b02c63013a18abb4741ae8cda790d99b455ef
1 cc = gcc
2 include .config
3 ocamlc = ocamlc.opt
4 ocamlflags = -w a -I $builddir
5 libs = -lmupdf $mujs -lpthread -L$mupdf/build/$buildtype
7 cflags =$cflags  -Wall -Werror -I$mupdf/include -I$freetype $
8        -I$mupdf/include
10 rule cc
11      deps = gcc
12      depfile = $out.d
13      command = $ocamlc -cc $cc -ccopt "$cflags -MMD -MF $out.d -o $out" -c $in
14      description = cc $out
16 rule ocamlc
17      deps = gcc
18      depfile = $out.d
19      command = sh $srcdir/doocaml $out $in $depfile -c $ocamlflags
20      description = ocamlc $out
22 rule genhelp
23      command = sh $srcdir/mkhelp.sh $srcdir/keystoml.ml $srcdir/KEYS >$out
24      description = genhelp
26 sedcmd = sed -f $srcdir/pp.sed
28 build $builddir/help.ml: genhelp
29 build $builddir/link.o: cc $srcdir/link.c
30       cflags = $cflags -D_GNU_SOURCE -DOBSCURED_OPT -DFFP $
31              -DUSE_FONTCONFIGg
32 build $builddir/help.cmo: ocamlc $builddir/help.ml
33 build $builddir/utils.cmo: ocamlc $srcdir/utils.ml
34 build $builddir/bo.cmo: ocamlc $srcdir/le/bo.ml
35 build $builddir/wsi.cmi: ocamlc $srcdir/wsi.mli
36 build $builddir/wsi.cmo: ocamlc $srcdir/wsi.ml | $
37       $builddir/wsi.cmi $builddir/bo.cmo
38 build $builddir/parser.cmo: ocamlc $srcdir/parser.ml
39 build $builddir/config.cmo: ocamlc $srcdir/config.ml
40       ocamlflags = $ocamlflags -I +lablGL
41 build $builddir/main.cmo: ocamlc $srcdir/main.ml
42       ocamlflags = $ocamlflags -I +lablGL -pp "$sedcmd"
44 cmos = $builddir/help.cmo $
45      $builddir/utils.cmo $
46      $builddir/parser.cmo $
47      $builddir/bo.cmo $
48      $builddir/wsi.cmo $
49      $builddir/config.cmo $
50      $builddir/main.cmo
52 rule linkso
53      command = $cc -o $out -shared $in $libs
54      description = linkso $out
56 build $builddir/link.so: linkso $builddir/link.o
58 rule link
59      command = $ocamlc -custom $
60              -cclib "$absbuilddir/link.so $lflags" $
61              -o $out -I +lablGL str.cma unix.cma lablgl.cma $cmos
62      description = link $out
64 build $builddir/llpp: link | $
65       $builddir/help.cmo $
66       $builddir/utils.cmo $
67       $builddir/parser.cmo $
68       $builddir/bo.cmo $
69       $builddir/wsi.cmo $
70       $builddir/config.cmo $
71       $builddir/main.cmo $
72       $builddir/link.so
74 default $builddir/llpp