-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
142 lines (107 loc) · 3.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Mark objects as 'ancient' so they are taken out of the OCaml heap.
include Makefile.config
CC := gcc
CFLAGS := -g -fPIC -Wall -Werror \
-DOCAML_VERSION_MAJOR=$(OCAML_VERSION_MAJOR) \
-DOCAML_VERSION_MINOR=$(OCAML_VERSION_MINOR) \
-I$(shell ocamlc -where)
OCAMLCFLAGS := -g
OCAMLCPACKAGES := -package unix
OCAMLCLIBS := -linkpkg
OCAMLOPTFLAGS :=
OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
OCAMLOPTLIBS := -linkpkg
OCAMLDOCFLAGS := -html -stars -sort $(OCAMLCPACKAGES)
TARGETS := mmalloc ancient.cma ancient.cmxa META \
test_ancient_dict_write.opt \
test_ancient_dict_verify.opt \
test_ancient_dict_read.opt
all: $(TARGETS)
ancient.cma: ancient.cmo ancient_c.o
ocamlmklib -o ancient -Lmmalloc -lmmalloc $^
ancient.cmxa: ancient.cmx ancient_c.o
ocamlmklib -o ancient -Lmmalloc -lmmalloc $^
test_ancient_dict_write.opt: ancient.cmxa test_ancient_dict_write.cmx
LIBRARY_PATH=.:$$LIBRARY_PATH \
ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) $(OCAMLOPTLIBS) -o $@ $^
test_ancient_dict_verify.opt: ancient.cmxa test_ancient_dict_verify.cmx
LIBRARY_PATH=.:$$LIBRARY_PATH \
ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) $(OCAMLOPTLIBS) -o $@ $^
test_ancient_dict_read.opt: ancient.cmxa test_ancient_dict_read.cmx
LIBRARY_PATH=.:$$LIBRARY_PATH \
ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTPACKAGES) $(OCAMLOPTLIBS) -o $@ $^
# Build the mmalloc library.
mmalloc:
$(MAKE) -C mmalloc
# Common rules for building OCaml objects.
.mli.cmi:
ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLCINCS) $(OCAMLCPACKAGES) -c $<
.ml.cmo:
ocamlfind ocamlc $(OCAMLCFLAGS) $(OCAMLCINCS) $(OCAMLCPACKAGES) -c $<
.ml.cmx:
ocamlfind ocamlopt $(OCAMLOPTFLAGS) $(OCAMLOPTINCS) $(OCAMLOPTPACKAGES) -c $<
# Findlib META file.
META: META.in Makefile.config
sed -e 's/@PACKAGE@/$(PACKAGE)/' \
-e 's/@VERSION@/$(VERSION)/' \
< $< > $@
# Clean.
clean:
rm -f *.cmi *.cmo *.cmx *.cma *.cmxa *.o *.a *.so *~ core META \
*.opt .depend
$(MAKE) -C mmalloc clean
# Dependencies.
depend: .depend
.depend: $(wildcard *.mli) $(wildcard *.ml)
rm -f .depend
ocamldep $^ > $@
ifeq ($(wildcard .depend),.depend)
include .depend
endif
# Install.
install:
rm -rf $(DESTDIR)/ancient
install -c -m 0755 -d $(DESTDIR)/ancient
install -c -m 0644 *.cmi *.mli *.cma *.cmxa *.a mmalloc/*.a META \
$(DESTDIR)/ancient
# Distribution.
dist:
$(MAKE) check-manifest
rm -rf $(PACKAGE)-$(VERSION)
mkdir $(PACKAGE)-$(VERSION)
tar -cf - -T MANIFEST | tar -C $(PACKAGE)-$(VERSION) -xf -
tar zcf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
rm -rf $(PACKAGE)-$(VERSION)
ls -l $(PACKAGE)-$(VERSION).tar.gz
check-manifest:
git ls-files | sort > .check-manifest; \
sort MANIFEST > .orig-manifest; \
diff -u .orig-manifest .check-manifest; rv=$$?; \
rm -f .orig-manifest .check-manifest; \
exit $$rv
# Debian packages.
dpkg:
@if [ 0 != `cvs -q update | wc -l` ]; then \
echo Please commit all changes to CVS first.; \
exit 1; \
fi
$(MAKE) dist
rm -rf /tmp/dbuild
mkdir /tmp/dbuild
cp $(PACKAGE)-$(VERSION).tar.gz \
/tmp/dbuild/$(PACKAGE)_$(VERSION).orig.tar.gz
export CVSROOT=`cat CVS/Root`; \
cd /tmp/dbuild && \
cvs export \
-d $(PACKAGE)-$(VERSION) \
-D now merjis/freeware/ancient
cd /tmp/dbuild/$(PACKAGE)-$(VERSION) && dpkg-buildpackage -rfakeroot
rm -rf /tmp/dbuild/$(PACKAGE)-$(VERSION)
ls -l /tmp/dbuild
# Developer documentation (in html/ subdirectory).
doc:
rm -rf html
mkdir html
-ocamlfind ocamldoc $(OCAMLDOCFLAGS) -d html ancient.mli
.PHONY: depend dist check-manifest dpkg doc mmalloc
.SUFFIXES: .cmo .cmi .cmx .ml .mli