Restore the ability to configure/build outside of the source tree
[llpp.git] / build.ninja
blob80cb574dac2d08fd22693a35b4cbbccdc03e33d0
1 cc = gcc
2 include .config
3 ocamlflags = -warn-error +a -w +a -g -safe-string
4 libs = -lmupdf -lz -lfreetype -ljpeg -ljbig2dec -lopenjpeg $
5      $mujs -lpthread -L$srcdir/mupdf/build/$buildtype
7 cflags = $cflags -Wall -Werror -I$srcdir/mupdf/include -g $
8        -std=c99 -pedantic-errors -Wunused-parameter -Wsign-compare -Wshadow $
9        -I $srcdir/mupdf/thirdparty/freetype/include
11 rule cc
12      deps = gcc
13      depfile = $out.d
14      command = $ocamlc -cc "$cc" -ccopt "$cflags -MMD -MF $out.d -o $out" -c $in
15      description = cc $out
17 rule ocamlc
18      command = env incs="$incs" pp="$pp" /bin/sh $srcdir/doocaml.sh $
19              $ocamlc $out $in -c $ocamlflags
20      description = ocamlc $out
22 rule genhelp
23      command = /bin/sh $srcdir/mkhelp.sh $srcdir/KEYS >$out
24      description = genhelp
26 build $builddir/help.ml: genhelp $srcdir/mkhelp.sh $srcdir/KEYS
27 build $builddir/link.o: cc $srcdir/link.c
28       cflags = $cflags -D_GNU_SOURCE -DFFP
29 build $builddir/help$cmo: ocamlc $builddir/help.ml
30 build $builddir/utils$cmo: ocamlc $srcdir/utils.ml
31 build $builddir/bo$cmo: ocamlc $srcdir/le/bo.ml
32 build $builddir/wsi.cmi: ocamlc $srcdir/wsi.mli $
33       | $builddir/utils$cmo
34 build $builddir/wsi$cmo: ocamlc $srcdir/wsi.ml $
35       | $builddir/bo$cmo $builddir/utils$cmo $builddir/wsi.cmi
36 build $builddir/parser$cmo: ocamlc $srcdir/parser.ml
37 build $builddir/config$cmo: ocamlc $srcdir/config.ml $
38       | $builddir/wsi.cmi $builddir/utils$cmo $
39         $builddir/parser$cmo $builddir/help$cmo
40       incs = $lablglcflags
41 build $builddir/main$cmo: ocamlc $srcdir/main.ml $
42       | $builddir/wsi.cmi $builddir/utils$cmo $builddir/config$cmo $
43         $builddir/help$cmo $srcdir/doocaml.sh $srcdir/pp.sed
44         incs = $lablglcflags
45         pp = sed -f $srcdir/pp.sed
47 rule linkso
48      command = $cc -g -o $out -shared $in $libs $lflags
49      description = linkso $out
51 build $builddir/link.so: linkso $builddir/link.o
53 rule link
54      command = $ocamlc -g -o $out $lablglcflags $
55              str$cma unix$cma lablgl$cma $in $
56              $ocamllflags
57      description = link $out
59 build $builddir/llpp.custom: link $
60      $builddir/help$cmo $
61      $builddir/utils$cmo $
62      $builddir/parser$cmo $
63      $builddir/bo$cmo $
64      $builddir/wsi$cmo $
65      $builddir/config$cmo $
66      $builddir/main$cmo $
67      $builddir/link.o
68      ocamllflags = $customflag -cclib "$libs -lX11 $lflags"
70 build $builddir/llpp: link $
71      $builddir/help$cmo $
72      $builddir/utils$cmo $
73      $builddir/parser$cmo $
74      $builddir/bo$cmo $
75      $builddir/wsi$cmo $
76      $builddir/config$cmo $
77      $builddir/main$cmo $
78      | $builddir/link.so
79      ocamllflags = $linksocclib $builddir/link.so
81 default $builddir/llpp