Coccinelle release 1.0.0-rc15
[bpt/coccinelle.git] / bundles / pcre / Makefile
CommitLineData
feec80c3
C
1# This Makefile serves as a wrapper to bundle the
2# extlib module without modifications.
3
4ifneq ($(MAKECMDGOALS),distclean)
5include ../../Makefile.config
6endif
7
755320b0
C
8OCAMLCFLAGS ?= -g
9OPTFLAGS ?= -g
d6ce1786
C
10
11# note: the extra linker flags are needed so that the produced shared
12# library gets dynamically linked to libpcre.
13EXTRACFLAGS=$(PCRE_CFLAGS:%=-ccopt %) $(PCRE_LIBS:%=-ccopt %)
14EXTRALNKFLAGS=$(PCRE_LIBS:%=-ldopt %)
15
755320b0
C
16OCAMLC_CMD=$(OCAMLC) $(OCAMLCFLAGS) $(EXTRACFLAGS) -cc "${CC} ${CFLAGS}"
17OCAMLOPT_CMD=$(OCAMLOPT) $(OPTFLAGS) $(EXTRACFLAGS)
d6ce1786 18OCAMLMKLIB_CMD=$(OCAMLMKLIB) $(EXTRALNKFLAGS)
feec80c3
C
19
20PCRE_VERSION=6.2.5
21PCRE_DIR=pcre-ocaml-release-$(PCRE_VERSION)
22PCRE_LIB=$(PCRE_DIR)/lib
23PCRE_MARKER=$(PCRE_DIR)/.marker
24
d6ce1786
C
25all: $(PCRE_MARKER)
26 @$(MAKE) all-build
27all-build: $(PCRE_MARKER) pcre.cma META
28all.opt: $(PCRE_MARKER)
29 @$(MAKE) all-opt-build
30all-opt-build: $(PCRE_MARKER) pcre.cmxa META
feec80c3
C
31
32clean:
33 rm -f dllpcre_stubs.so libpcre_stubs.a pcre_stubs.o \
34 pcre.cma pcre.cmi pcre.cmo META \
d6ce1786 35 pcre.a pcre.cmx pcre.cmxa pcre.o pcre.annot
feec80c3
C
36
37distclean: clean
38 rm -rf $(PCRE_DIR)
39
40depend: $(PCRE_MARKER)
41
d6ce1786 42.PHONEY: all all.opt clean distclean depend all-build all-opt-build
feec80c3
C
43
44# prepare the pcre directory
45$(PCRE_MARKER): $(PCRE_DIR).tar.gz
46 $(TAR) xfvz $<
47 touch $@
48
49$(PCRE_DIR).tar.gz:
50 @echo "$@ not found. Please download it and drop it in this directory ($(pwd))."
51 @false
52
53# handle the building of pcre ourselves
54
55pcre.cmi: $(PCRE_LIB)/pcre.mli
56 $(OCAMLC_CMD) -c -o $@ $^
57
58pcre.cmo: $(PCRE_LIB)/pcre.ml pcre.cmi
59 $(OCAMLC_CMD) -c -o $@ $<
60
61pcre.cma: pcre.cmo dllpcre_stubs.so
d6ce1786 62 $(OCAMLC_CMD) -a -o $@ $<
feec80c3
C
63
64pcre.cmx: $(PCRE_LIB)/pcre.ml pcre.cmi
65 $(OCAMLOPT_CMD) -c -o $@ $<
66
67pcre.cmxa: pcre.cmx dllpcre_stubs.so
d6ce1786 68 $(OCAMLOPT_CMD) -a -o pcre.cmxa $<
feec80c3
C
69
70pcre_stubs.o: $(PCRE_LIB)/pcre_stubs.c
d6ce1786 71 $(OCAMLC_CMD) -ccopt -shared -ccopt -fPIC $<
feec80c3
C
72
73dllpcre_stubs.so: pcre_stubs.o
74 $(OCAMLMKLIB_CMD) -o pcre_stubs $<
75
76META: $(PCRE_LIB)/META
77 cp "${PCRE_LIB}/META" ./META
d6ce1786
C
78
79include ../../Makefile.common