Coccinelle release 1.0.0-rc12
[bpt/coccinelle.git] / bundles / extlib / Makefile
1 # This Makefile serves as a wrapper to bundle the
2 # extlib package without modifications.
3
4 # the extlib package is a conventional package that
5 # requires a plain compilation of its .ml files and
6 # then packed into an archive file.
7
8 ifneq ($(MAKECMDGOALS),distclean)
9 include ../../Makefile.config
10 endif
11
12 VERSION=1.5.2
13 EXTLIB=extlib-$(VERSION)
14 EXTMARKER=$(EXTLIB)/.marker
15
16 all: depend extLib.cma META
17 all.opt: depend extLib.cmxa META
18
19 clean:
20 rm -f .depend META extLib.cm[ioxa] extLib.[ao] \
21 $(EXTLIB)/*.cm[ioxa] extLib.cmxa \
22 .mli-marker
23
24 distclean: clean
25 rm -rf $(EXTLIB)
26
27 depend: $(EXTMARKER)
28
29 $(EXTMARKER): $(EXTLIB).tar.gz
30 $(TAR) xfvz $<
31 touch $@
32
33 $(EXTLIB).tar.gz:
34 @echo "$@ not found. Please download it and drop it in this directory ($(pwd))."
35 @false
36
37 .PHONEY: all all.opt clean distclean depend
38
39 # SOURCES
40 MODULES = \
41 enum bitSet dynArray extArray extHashtbl extList extString global IO option \
42 pMap std uChar uTF8 base64 unzip refList optParse dllist
43
44 MLI=$(MODULES:%=$(EXTLIB)/%.mli)
45 SRC=$(MODULES:%=$(EXTLIB)/%.ml) $(EXTLIB)/extLib.ml
46
47 # note: the interface files must be build at must once when compiling both 'all' and 'all.opt'
48 # otherwise errors such as 'module X makes inconsistent assumptions about interface Y' may
49 # arise. The dependencies on this marker establishes this sharing.
50 .mli-marker: $(MLI) $(SRC)
51 $(OCAMLC) -c -thread -I $(EXTLIB) $(MLI)
52 touch .mli-marker
53
54 extLib.cma: .mli-marker $(SRC)
55 $(OCAMLC) -a -custom -thread -I $(EXTLIB) -o extLib.cma $(MLI) $(SRC)
56
57 extLib.cmxa: .mli-marker $(SRC)
58 $(OCAMLOPT) -a -linkall -thread -I $(EXTLIB) -o extLib.cmxa $(SRC)
59
60 META: $(EXTLIB)/META
61 cp $< $@