- Try to do better pretty printing when array elements are individually
[bpt/coccinelle.git] / bundles / pycaml / Makefile
1 ifneq ($(MAKECMDGOALS),distclean)
2 include ../../Makefile.config
3 endif
4
5 OCAMLCFLAGS ?= -g
6 OPTFLAGS ?= -g
7
8 PYCAMLDIR=chemoelectric-pycaml-8614105
9 PYCAMLFILE=$(PYCAMLDIR).tar.gz
10 PYCAMLMARKER=$(PYCAMLDIR)/.marker
11
12 # note: the extra linker flags are needed so that the produced shared
13 # library gets linked against libpython.
14 EXTRACFLAGS=$(PYTHON_CFLAGS:%=-ccopt %) $(PYTHON_LIBS:%=-cclib %)
15 EXTRALNKFLAGS=$(PYTHON_LIBS:%=-ldopt %)
16
17 export PYMAJOR=$(shell echo ${PYTHON_VERSION} | sed -e 's/\..*//')
18 OCAMLFLAGS = -pp "camlp4o -parser Camlp4MacroParser -D PYMAJOR${PYMAJOR}"
19 OCAMLC_CMD=$(OCAMLC) $(OCAMLCFLAGS) $(OCAMLFLAGS) -g $(EXTRACFLAGS) -cc "${CC} ${CFLAGS}" -I $(PYCAMLDIR)
20 OCAMLOPT_CMD=$(OCAMLOPT) $(OPTFLAGS) $(OCAMLFLAGS) -g $(EXTRACFLAGS) -I $(PYCAMLDIR)
21 OCAMLMKLIB_CMD=$(OCAMLMKLIB) -linkall $(EXTRALNKFLAGS)
22 OCAMLDEP_CMD=$(OCAMLDEP) $(OCAMLFLAGS)
23
24
25 all: $(PYCAMLMARKER)
26 @$(MAKE) all-build
27 all-build: $(PYCAMLMARKER) pycaml.cmi pycaml.cma
28
29 $(PYCAMLDIR)/pycaml.mli: $(PYCAMLDIR)/pycaml.ml
30 $(OCAMLC_CMD) -i $< > $(PYCAMLDIR)/pycaml.mli
31
32 $(PYCAMLDIR)/pycaml.cmo: $(PYCAMLDIR)/pycaml.ml $(PYCAMLDIR)/pycaml.cmi
33 $(OCAMLC_CMD) -c $< -o $@
34
35 $(PYCAMLDIR)/pycaml.cmi: $(PYCAMLDIR)/pycaml.mli
36 $(OCAMLC_CMD) -c $< -o $@
37
38 # the cmi file apparently needs to be present next to the cma file
39 pycaml.cmi: $(PYCAMLDIR)/pycaml.cmi
40 cp -f $< $@
41
42 pycaml_stubs.o: $(PYCAMLDIR)/pycaml_stubs.c
43 $(OCAMLC_CMD) -ccopt -shared -ccopt -fPIC $< -o $@
44
45 dllpycaml_stubs.so: pycaml_stubs.o
46 $(OCAMLMKLIB_CMD) -o pycaml_stubs $<
47
48 pycaml.cma: $(PYCAMLDIR)/pycaml.cmo $(PYCAMLDIR)/pycaml.cmi dllpycaml_stubs.so
49 $(OCAMLC_CMD) -I $(PYCAMLDIR) -a -o pycaml.cma $<
50
51 all.opt: $(PYCAMLMARKER)
52 @$(MAKE) all-opt-build
53 all-opt-build: $(PYCAMLMARKER) pycaml.cmi pycaml.cmxa
54
55 $(PYCAMLDIR)/pycaml.cmx: $(PYCAMLDIR)/pycaml.ml $(PYCAMLDIR)/pycaml.cmi
56 $(OCAMLOPT_CMD) -c $<
57
58 pycaml.cmxa: $(PYCAMLDIR)/pycaml.cmx $(PYCAMLDIR)/pycaml.cmi dllpycaml_stubs.so
59 $(OCAMLOPT_CMD) -I $(PYCAMLDIR) -a -o pycaml.cmxa $<
60
61 # prepares the source bundle for building.
62 .prepare: $(PYCAMLMARKER)
63 touch .prepare
64
65 clean:
66 rm -f $(PYCAMLDIR)/pycaml.mli pycaml.cm[aixo] $(PYCAMLDIR)/pycaml.cm[aixo] \
67 pycaml.[ao] libpycaml_stubs.a pycaml_stubs.o dllpycaml_stubs.so libpycaml_stubs.so \
68 pycaml_ml.o pycaml.cmxa $(PYCAMLDIR)/pycaml.annot
69
70 distclean: clean
71 rm -rf $(PYCAMLDIR)
72 rm -f .prepare
73
74 .PHONEY: all all.opt all-build all-opt-build distclean clean depend
75
76 # construct the directories
77 depend: $(PYCAMLMARKER)
78
79 $(PYCAMLMARKER): $(PYCAMLFILE)
80 $(TAR) xfvz $<
81 # $(PATCH) -d "${PYCAMLDIR}" -p1 < ./python3-compat-fix.patch
82 # $(PATCH) -d "${PYCAMLDIR}" -p1 < ./pyunicodeapichanges-fix.patch
83 $(PATCH) -d "${PYCAMLDIR}" -p2 < ./removeunicode.patch
84 $(PATCH) -d "${PYCAMLDIR}" -p1 < ./ignoreheader.patch
85 $(PATCH) -d "${PYCAMLDIR}" -p1 < ./elim-warnings.patch
86 rm -f "${PYCAMLDIR}/pycaml.mli"
87 touch $@
88
89 $(PYCAMLFILE):
90 @echo "$@ not found. Please download it and drop it in this directory ($(pwd))."
91 @false
92
93 include ../../Makefile.common