'Ancient' generation in garbage collector.
[ocaml-ancient.git] / Makefile
1 # Mark objects as 'ancient' so they are taken out of the OCaml heap.
2 # $Id: Makefile,v 1.1 2006-09-27 12:07:07 rich Exp $
3
4 CC      := gcc
5 CFLAGS  := -g -fPIC -Wall -Werror
6
7 OCAMLCFLAGS     := -g
8 OCAMLCPACKAGES  := 
9 OCAMLCLIBS      := 
10
11 OCAMLOPTFLAGS   :=
12 OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
13 OCAMLOPTLIBS    := 
14
15 OCAMLDOCFLAGS := -html -stars -sort $(OCAMLCPACKAGES)
16
17 all:    ancient.cma ancient.cmxa test_ancient.opt META
18
19 ancient.cma: ancient.cmo ancient_c.o
20         ocamlmklib -o ancient $^
21
22 ancient.cmxa: ancient.cmx ancient_c.o
23         ocamlmklib -o ancient $^
24
25 test_ancient.opt: ancient.cmxa test_ancient.cmx
26         LIBRARY_PATH=.:$$LIBRARY_PATH \
27         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) -o $@ $^
28
29 # Common rules for building OCaml objects.
30
31 .mli.cmi:
32         ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLCINCS) $(OCAMLCPACKAGES) -c $<
33 .ml.cmo:
34         ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLCINCS) $(OCAMLCPACKAGES) -c $<
35 .ml.cmx:
36         ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTINCS) $(OCAMLOPTPACKAGES) -c $<
37
38 # Findlib META file.
39
40 META:   META.in Makefile.config
41         $(SED)  -e 's/@PACKAGE@/$(PACKAGE)/' \
42                 -e 's/@VERSION@/$(VERSION)/' \
43                 < $< > $@
44
45 # Clean.
46
47 clean:
48         rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so *~ core META *.opt
49
50 # Dependencies.
51
52 depend: .depend
53
54 .depend: $(wildcard *.mli) $(wildcard *.ml)
55         rm -f .depend
56         ocamldep $^ > $@
57
58 ifeq ($(wildcard .depend),.depend)
59 include .depend
60 endif
61
62 # Install.
63
64 install:
65         rm -rf $(DESTDIR)$(OCAMLLIBDIR)/ancient
66         install -c -m 0755 -d $(DESTDIR)$(OCAMLLIBDIR)/weblogs
67         install -c -m 0644 *.cmi *.mli *.cma *.cmxa *.a META \
68           $(DESTDIR)$(OCAMLLIBDIR)/ancient
69
70 # Distribution.
71
72 dist:
73         $(MAKE) check-manifest
74         rm -rf $(PACKAGE)-$(VERSION)
75         mkdir $(PACKAGE)-$(VERSION)
76         tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
77         tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
78         rm -rf $(PACKAGE)-$(VERSION)
79         ls -l $(PACKAGE)-$(VERSION).tar.gz
80
81 check-manifest:
82         @for d in `find -type d -name CVS | grep -v '^\./debian/'`; \
83         do \
84         b=`dirname $$d`/; \
85         awk -F/ '$$1 != "D" {print $$2}' $$d/Entries | \
86         sed -e "s|^|$$b|" -e "s|^\./||"; \
87         done | sort > .check-manifest; \
88         sort MANIFEST > .orig-manifest; \
89         diff -u .orig-manifest .check-manifest; rv=$$?; \
90         rm -f .orig-manifest .check-manifest; \
91         exit $$rv
92
93 # Debian packages.
94
95 dpkg:
96         @if [ 0 != `cvs -q update | wc -l` ]; then \
97         echo Please commit all changes to CVS first.; \
98         exit 1; \
99         fi
100         $(MAKE) dist
101         rm -rf /tmp/dbuild
102         mkdir /tmp/dbuild
103         cp $(PACKAGE)-$(VERSION).tar.gz \
104           /tmp/dbuild/$(PACKAGE)_$(VERSION).orig.tar.gz
105         export CVSROOT=`cat CVS/Root`; \
106           cd /tmp/dbuild && \
107           cvs export \
108           -d $(PACKAGE)-$(VERSION) \
109           -D now merjis/freeware/ancient
110         cd /tmp/dbuild/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot
111         rm -rf /tmp/dbuild/$(PACKAGE)-$(VERSION)
112         ls -l /tmp/dbuild
113
114 # Developer documentation (in html/ subdirectory).
115
116 doc:
117         rm -rf html
118         mkdir html
119         -ocamlfind ocamldoc $(OCAMLDOCFLAGS) -d html ancient.ml{i,}
120
121 .PHONY: depend dist check-manifest dpkg doc
122
123 .SUFFIXES:      .cmo .cmi .cmx .ml .mli