88e8937457d74fc89bc30a3dd01632f01eba434d
[bpt/coccinelle.git] / bundles / pcre / Makefile
1 # This Makefile serves as a wrapper to bundle the
2 # extlib module without modifications.
3
4 ifneq ($(MAKECMDGOALS),distclean)
5 include ../../Makefile.config
6 endif
7
8 SHARE_FLAGS=-shared -fpic
9 OCAMLC_CMD=$(OCAMLC) -thread -ccopt "${PCRE_CFLAGS}" -cclib "${PCRE_LIBS}" -cc "${CC} ${CFLAGS} ${SHARE_FLAGS}"
10 OCAMLOPT_CMD=$(OCAMLOPT) -thread -ccopt "${PCRE_CFLAGS}" -cclib "${PCRE_LIBS}"
11 OCAMLMKLIB_CMD=$(OCAMLMKLIB)
12
13 PCRE_VERSION=6.2.5
14 PCRE_DIR=pcre-ocaml-release-$(PCRE_VERSION)
15 PCRE_LIB=$(PCRE_DIR)/lib
16 PCRE_MARKER=$(PCRE_DIR)/.marker
17
18 all: depend pcre.cma META
19 all.opt: depend pcre.cmxa META
20
21 clean:
22 rm -f dllpcre_stubs.so libpcre_stubs.a pcre_stubs.o \
23 pcre.cma pcre.cmi pcre.cmo META \
24 pcre.a pcre.cmx pcre.cmxa pcre.o
25
26 distclean: clean
27 rm -rf $(PCRE_DIR)
28
29 depend: $(PCRE_MARKER)
30
31 .PHONEY: all all.opt clean distclean depend
32
33 # prepare the pcre directory
34 $(PCRE_MARKER): $(PCRE_DIR).tar.gz
35 $(TAR) xfvz $<
36 touch $@
37
38 $(PCRE_DIR).tar.gz:
39 @echo "$@ not found. Please download it and drop it in this directory ($(pwd))."
40 @false
41
42 # handle the building of pcre ourselves
43
44 pcre.cmi: $(PCRE_LIB)/pcre.mli
45 $(OCAMLC_CMD) -c -o $@ $^
46
47 pcre.cmo: $(PCRE_LIB)/pcre.ml pcre.cmi
48 $(OCAMLC_CMD) -c -o $@ $<
49
50 pcre.cma: pcre.cmo dllpcre_stubs.so
51 $(OCAMLC_CMD) -a -custom -linkall -dllib -lpcre_stubs -o $@ $<
52
53 pcre.cmx: $(PCRE_LIB)/pcre.ml pcre.cmi
54 $(OCAMLOPT_CMD) -c -o $@ $<
55
56 pcre.cmxa: pcre.cmx dllpcre_stubs.so
57 $(OCAMLOPT_CMD) -a -cclib -lpcre_stubs -o pcre.cmxa $<
58
59 pcre_stubs.o: $(PCRE_LIB)/pcre_stubs.c
60 $(OCAMLC_CMD) $<
61
62 dllpcre_stubs.so: pcre_stubs.o
63 $(OCAMLMKLIB_CMD) -o pcre_stubs $<
64
65 META: $(PCRE_LIB)/META
66 cp "${PCRE_LIB}/META" ./META