]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/ocaml-http/Makefile
- bugfix: installs also cmi for modules which doesn't have mli
[helm.git] / helm / DEVEL / ocaml-http / Makefile
1 include Makefile.defs
2
3 MODULES =       \
4         http_types http_constants http_tcp_server http_parser_sanity    \
5         http_misc http_common http_parser http_message http_request             \
6         http_daemon http_response
7 THREADED_SRV = http_threaded_tcp_server
8 MODULES_MT = $(patsubst http_tcp_server, mt/$(THREADED_SRV) http_tcp_server, $(MODULES))
9 MODULES_NON_MT = $(patsubst http_tcp_server, non_mt/$(THREADED_SRV) http_tcp_server, $(MODULES))
10 PUBLIC_MODULES = http_common http_request http_daemon http_response
11 PUBLIC_IMPL = http_types
12 DESTDIR = $(shell $(OCAMLFIND) printconf stdlib) 
13
14 all: all_non_mt all_mt
15 opt: opt_non_mt opt_mt
16 all_non_mt: http.cma
17 opt_non_mt: http.cmxa
18 all_mt: http_mt.cma
19 opt_mt: http_mt.cmxa
20 world: all opt
21 doc: *.mli
22         $(OCAMLDOC) -html -d doc/html   \
23                 *.mli $(patsubst %, %.ml, $(PUBLIC_IMPL))
24
25 examples:
26         $(MAKE) -C examples/
27 examples.opt:
28         $(MAKE) -C examples/ opt
29
30 include .depend
31
32 depend:
33         $(OCAMLDEP) *.ml *.mli > .depend
34
35 %.cmi: %.mli
36         $(OCAMLC) -c $<
37 %.cmo: %.ml %.cmi
38         $(OCAMLC) -c $<
39 %.cmx: %.ml %.cmi
40         $(OCAMLOPT) -c $<
41 include Makefile.overrides
42
43 non_mt/$(THREADED_SRV).cmo: non_mt/$(THREADED_SRV).ml $(THREADED_SRV).cmi
44         cp $(THREADED_SRV).{cmi,mli} non_mt/
45         $(OCAMLC) -c $<
46 non_mt/$(THREADED_SRV).cmx: non_mt/$(THREADED_SRV).ml $(THREADED_SRV).cmi
47         cp $(THREADED_SRV).{cmi,mli} non_mt/
48         $(OCAMLOPT) -c $<
49
50 mt/$(THREADED_SRV).cmo: mt/$(THREADED_SRV).ml $(THREADED_SRV).cmi
51         cp $(THREADED_SRV).{cmi,mli} mt/
52         $(OCAMLC) $(THREADS_FLAGS) -c $<
53 mt/$(THREADED_SRV).cmx: mt/$(THREADED_SRV).ml $(THREADED_SRV).cmi
54         cp $(THREADED_SRV).{cmi,mli} mt/
55         $(OCAMLOPT) $(THREADS_FLAGS) -c $<
56
57 http.cma: $(patsubst %,%.cmo,$(MODULES_NON_MT))
58         $(OCAMLC) -a -o $@ $^
59 http.cmxa: $(patsubst %,%.cmx,$(MODULES_NON_MT))
60         $(OCAMLOPT) -a -o $@ $^
61 http_mt.cma: $(patsubst %,%.cmo,$(MODULES_MT))
62         $(OCAMLC) -a -o $@ $^
63 http_mt.cmxa: $(patsubst %,%.cmx,$(MODULES_MT))
64         $(OCAMLOPT) -a -o $@ $^
65
66 meta: META
67 META: META.in
68         cat META.in | sed -e 's/@DISTVERSION@/$(DISTVERSION)/' > META
69
70 clean:
71         $(MAKE) -C examples/ clean
72         for d in . mt non_mt; do        \
73                 rm -f $$d/*.cm[ioax] $$d/*.cmxa $$d/*.[ao] $$d/test{,.opt};     \
74         done
75         rm -f {mt,non_mt}/$(THREADED_SRV).mli
76 docclean:
77         rm -f doc/html/*.html doc/html/*.css
78 distclean: clean docclean
79         $(MAKE) -C examples/ distclean
80         -rm -f META
81 dist: distreal distrm
82 distreal: distclean depend
83         if [ -d $(DISTDIR) ]; then rm -rf $(DISTDIR); else true; fi
84         mkdir $(DISTDIR)
85         for f in        \
86                         $(patsubst %, %.ml, $(MODULES)) \
87                         $(patsubst %, %.mli, $(MODULES) $(THREADED_SRV))        \
88                         mt/ non_mt/ $(EXTRA_DIST) examples/     debian/;        \
89         do      \
90                 cp -r $$f $(DISTDIR)/;  \
91         done
92         -find $(DISTDIR)/ -type d -name CVS -exec rm -rf {} \;
93         -find $(DISTDIR)/ -type f -name ".cvs*" -exec rm -f {} \;
94         tar cvzf $(DISTDIR).tar.gz $(DISTDIR)/
95 distrm:
96         rm -rf $(DISTDIR)/
97 deb: distreal
98         (cd $(DISTDIR)/ && debuild)
99         rm -rf $(DISTDIR)/
100 install: META
101         $(OCAMLFIND) install -destdir $(DESTDIR) $(PKGNAME)     \
102                 $(patsubst %, %.mli, $(PUBLIC_MODULES)) \
103                 $(patsubst %, %.ml, $(PUBLIC_IMPL))     \
104                 $(patsubst %, %.cmi, $(PUBLIC_MODULES)) \
105                 $(patsubst %, %.cmi, $(PUBLIC_IMPL))    \
106                 http{,_mt}.cm{,x}a http{,_mt}.a META
107
108 .PHONY: \
109         all opt world all_non_mt all_mt opt_non_mt opt_mt       \
110         examples examples.opt depend clean distclean dist       \
111         install meta doc deb distreal distrm
112