Cleaned up a bit
[vsys.git] / Makefile
1 all: vsys 
2
3 include .dep
4
5 .SUFFIXES: .ml .cmo
6 .SUFFIXES: .mli .cmi
7 .SUFFIXES: .ml .cmx
8 .SUFFIXES: .mll .ml
9 .SUFFIXES: .mly .ml
10
11 .ml.cmo:
12         ocamlc -g -c $(INCLUDEDIR) $<
13
14 .mli.cmi:
15         ocamlopt -c $<
16
17 .ml.cmx: 
18         ocamlopt $(CFLAGS) -c $(INCLUDEDIR) $<
19
20 .mly.ml: 
21         ocamlyacc $< 
22
23 .mll.ml:
24         ocamllex $< 
25
26 docs: *.ml
27         ocamldoc -d . -html -o docs *.ml
28         mv *.html *.css docs
29
30 ocaml_inotify-0.4/inotify.cmxa:
31         $(MAKE) -C ocaml_inotify-0.4 && cp -f ocaml_inotify-0.4/inotify_stubs.o ./
32
33 splice_stub.o: splice_stub.c
34         gcc -c -I /usr/lib/ocaml -I /usr/lib64/ocaml splice_stub.c -o splice_stub.o
35
36 vsys: ocaml_inotify-0.4/inotify.cmxa globals.cmx fdwatcher.cmx conffile.cmx splice_stub.o splice.cmx dirwatcher.cmx fifowatcher.cmx frontend.cmx unixsocketwatcher.cmx backend.cmx main.cmx docs 
37         ocamlopt -I ocaml_inotify-0.4 str.cmxa unix.cmxa inotify.cmxa globals.cmx fdwatcher.cmx dirwatcher.cmx splice.cmx splice_stub.o directfifowatcher.cmx unixsocketwatcher.cmx  frontend.cmx backend.cmx str.cmxa conffile.cmx main.cmx -o vsys
38
39 vsys.b: ocaml_inotify-0.4/inotify.cma inotify.cmi globals.ml fdwatcher.ml dirwatcher.ml directfifowatcher.ml frontend.ml backend.ml main.ml
40         ocamlc -g str.cma unix.cma ocaml_inotify-0.4/inotify.cma globals.cmo fdwatcher.cmo dirwatcher.cmo directfifowatcher.cmo frontend.cmo backend.cmo str.cma conffile.cmo main.cmo -o vsys.b
41
42 install: vsys
43         cp vsys $(INSTALL_DIR)/usr/bin
44         cp vsys-initscript $(INSTALL_DIR)/etc/init.d/vsys 
45
46 dep:
47         ocamldep *.ml > .dep
48
49 clean:
50         $(MAKE) -C ocaml_inotify-0.4 clean
51         rm -f *.cmi *.cmx sys usys *.o vsys vsys.b *.html *.css