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