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