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