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