Coccinelle release 1.0.0-rc15
[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 OCAMLCFLAGS ?= -g
13 OPTFLAGS ?= -g
14
15 VERSION=1.5.2
16 EXTLIB=extlib-$(VERSION)
17 EXTMARKER=$(EXTLIB)/.marker
18
19 all: $(EXTMARKER)
20 @$(MAKE) all-build
21 all-build: $(EXTMARKER) extLib.cma META
22
23 all.opt: $(EXTMARKER)
24 @$(MAKE) all-opt-build
25 all-opt-build: $(EXTMARKER) extLib.cmxa META
26
27 clean:
28 rm -f .depend META extLib.cm[ioxa] extLib.[ao] \
29 $(EXTLIB)/*.cm[ioxa] extLib.cmxa \
30 .mli-marker
31
32 distclean: clean
33 rm -rf $(EXTLIB)
34
35 depend: $(EXTMARKER)
36
37 $(EXTMARKER): $(EXTLIB).tar.gz hashtable-ocaml4-compat.patch
38 $(TAR) xfvz $<
39 $(PATCH) -d $(EXTLIB) -p1 < ./hashtable-ocaml4-compat.patch
40 touch $@
41
42 $(EXTLIB).tar.gz:
43 @echo "$@ not found. Please download it and drop it in this directory ($(pwd))."
44 @false
45
46 .PHONEY: all all.opt all-build all-opt-build clean distclean depend
47
48 # SOURCES
49 MODULES = \
50 enum bitSet dynArray extArray extHashtbl extList extString global IO option \
51 pMap std uChar uTF8 base64 unzip refList optParse dllist
52
53 MLI=$(MODULES:%=$(EXTLIB)/%.mli)
54 SRC=$(MODULES:%=$(EXTLIB)/%.ml) $(EXTLIB)/extLib.ml
55
56 # note: the interface files must be build at must once when compiling both 'all' and 'all.opt'
57 # otherwise errors such as 'module X makes inconsistent assumptions about interface Y' may
58 # arise. The dependencies on this marker establishes this sharing.
59 .mli-marker: $(MLI) $(SRC)
60 $(OCAMLC) $(OCAMLCFLAGS) -c -I $(EXTLIB) $(MLI)
61 touch .mli-marker
62
63 extLib.cma: .mli-marker $(SRC)
64 $(OCAMLC) $(OCAMLCFLAGS) -a -I $(EXTLIB) -o extLib.cma $(MLI) $(SRC)
65
66 extLib.cmxa: .mli-marker $(SRC)
67 $(OCAMLOPT) $(OPTFLAGS) -a -I $(EXTLIB) -o extLib.cmxa $(SRC)
68
69 META: $(EXTLIB)/META
70 cp $< $@
71
72 include ../../Makefile.common