1 # This Makefile serves as a wrapper to bundle the
2 # extlib module without modifications.
4 ifneq ($(MAKECMDGOALS
),distclean)
5 include ..
/..
/Makefile.config
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
)
14 PCRE_DIR
=pcre-ocaml-release-
$(PCRE_VERSION
)
15 PCRE_LIB
=$(PCRE_DIR
)/lib
16 PCRE_MARKER
=$(PCRE_DIR
)/.marker
18 all: depend pcre.cma META
19 all.opt
: depend pcre.cmxa META
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
29 depend
: $(PCRE_MARKER
)
31 .PHONEY
: all all.opt
clean distclean depend
33 # prepare the pcre directory
34 $(PCRE_MARKER
): $(PCRE_DIR
).
tar.gz
39 @echo
"$@ not found. Please download it and drop it in this directory ($(pwd))."
42 # handle the building of pcre ourselves
44 pcre.cmi
: $(PCRE_LIB
)/pcre.mli
45 $(OCAMLC_CMD
) -c
-o
$@
$^
47 pcre.cmo
: $(PCRE_LIB
)/pcre.ml pcre.cmi
48 $(OCAMLC_CMD
) -c
-o
$@
$<
50 pcre.cma
: pcre.cmo dllpcre_stubs.so
51 $(OCAMLC_CMD
) -a
-custom
-linkall
-dllib
-lpcre_stubs
-o
$@
$<
53 pcre.cmx
: $(PCRE_LIB
)/pcre.ml pcre.cmi
54 $(OCAMLOPT_CMD
) -c
-o
$@
$<
56 pcre.cmxa
: pcre.cmx dllpcre_stubs.so
57 $(OCAMLOPT_CMD
) -a
-cclib
-lpcre_stubs
-o pcre.cmxa
$<
59 pcre_stubs.o
: $(PCRE_LIB
)/pcre_stubs.c
62 dllpcre_stubs.so
: pcre_stubs.o
63 $(OCAMLMKLIB_CMD
) -o pcre_stubs
$<
65 META
: $(PCRE_LIB
)/META
66 cp
"${PCRE_LIB}/META" .
/META