Commit | Line | Data |
---|---|---|
d6ce1786 C |
1 | # !! This Makefile is OUTDATED |
2 | # It shows how to incorporate | |
3 | # Debian's pycaml source package | |
4 | # into coccinelle. Howver, at the | |
5 | # time of writing, that source | |
6 | # package does not work for new | |
7 | # python versions. Hence, we switched | |
8 | # to another version. | |
9 | # | |
10 | # If in the future the pycaml | |
11 | # package in Debian is upgraded, | |
12 | # it may be worth switching to it | |
13 | # again. | |
14 | ||
15 | ifneq ($(MAKECMDGOALS),distclean) | |
16 | include ../../Makefile.config | |
17 | endif | |
18 | ||
19 | PYCAMLFILE=pycaml_0.82.orig.tar.gz | |
20 | DEBIANFILE=pycaml_0.82-14.debian.tar.gz | |
21 | ||
22 | PYCAMLDIR=pycaml | |
23 | PYCAMLMARKER=$(PYCAMLDIR)/.marker | |
24 | DEBIANDIR=debian | |
25 | DEBIANMARKER=$(DEBIANDIR)/.marker | |
26 | ||
27 | SHARE_FLAGS=-shared -fpic | |
28 | OCAMLC_CMD=$(OCAMLC) -thread -ccopt "${PYTHON_CFLAGS}" -cclib "${PYTHON_LIBS}" -cc "${CC} ${CFLAGS} ${SHARE_FLAGS}" -I $(PYCAMLDIR) | |
29 | OCAMLOPT_CMD=$(OCAMLOPT) -thread -ccopt "${PYTHON_CFLAGS}" -cclib "${PYTHON_LIBS}" -I $(PYCAMLDIR) | |
30 | OCAMLMKLIB_CMD=$(OCAMLMKLIB) | |
31 | ||
32 | ||
33 | all: depend pycaml.cmi pycaml.cma | |
34 | ||
35 | $(PYCAMLDIR)/pycaml.mli: $(PYCAMLDIR)/pycaml.ml | |
36 | $(OCAMLC_CMD) -i $< > $(PYCAMLDIR)/pycaml.mli | |
37 | ||
38 | $(PYCAMLDIR)/pycaml.cmo: $(PYCAMLDIR)/pycaml.ml $(PYCAMLDIR)/pycaml.cmi | |
39 | $(OCAMLC_CMD) -c $< -o $@ | |
40 | ||
41 | $(PYCAMLDIR)/pycaml.cmi: $(PYCAMLDIR)/pycaml.mli | |
42 | $(OCAMLC_CMD) -c $< -o $@ | |
43 | ||
44 | # local copy of the interface | |
45 | pycaml.cmi: $(PYCAMLDIR)/pycaml.cmi | |
46 | cp $< $@ | |
47 | ||
48 | pycaml_ml.o: $(PYCAMLDIR)/pycaml_ml.c | |
49 | $(OCAMLC_CMD) $< -o $@ | |
50 | ||
51 | dllpycaml_stubs.so: pycaml_ml.o | |
52 | $(OCAMLMKLIB_CMD) -o pycaml_stubs $< | |
53 | ||
54 | pycaml.cma: dllpycaml_stubs.so pycaml.cmi $(PYCAMLDIR)/pycaml.cmo | |
55 | $(OCAMLC_CMD) -a -custom -linkall -o pycaml.cma pycaml.cmo -dllib -lpycaml_stubs | |
56 | ||
57 | all.opt: depend pycaml.cmi pycaml.cmxa | |
58 | ||
59 | $(PYCAMLDIR)/pycaml.cmx: $(PYCAMLDIR)/pycaml.ml $(PYCAMLDIR)/pycaml.cmi | |
60 | $(OCAMLOPT_CMD) -c $< | |
61 | ||
62 | pycaml.cmxa: dllpycaml_stubs.so $(PYCAMLDIR)/pycaml.cmx | |
63 | $(OCAMLOPT_CMD) -a -o pycaml.cmxa pycaml.cmx -cclib -lpycaml_stubs | |
64 | ||
65 | clean: | |
66 | rm -f $(PYCAMLDIR)/pycaml.mli pycaml.cm[aixo] $(PYCAMLDIR)/pycaml.cm[aixo] \ | |
67 | pycaml.[ao] libpycaml_stubs.a dllpycaml_stubs.o dllpycaml_stubs.so \ | |
68 | pycaml_ml.o pycaml.cmxa | |
69 | ||
70 | distclean: clean | |
71 | rm -rf $(PYCAMLDIR) $(DEBIANDIR) | |
72 | ||
73 | ||
74 | # construct the directories | |
75 | depend: $(PYCAMLMARKER) $(DEBIANMARKER) | |
76 | ||
77 | $(PYCAMLMARKER): $(PYCAMLFILE) $(DEBIANMARKER) | |
78 | $(TAR) xfvz $< | |
79 | set -e; for PATCH in $(shell cat debian/patches/series); do $(PATCH) -d "${PYCAMLDIR}" -p1 < "./debian/patches/$${PATCH}"; done | |
80 | touch $@ | |
81 | ||
82 | $(PYCAMLFILE): | |
83 | @echo "$@ not found. Please download it and drop it in this directory ($(pwd))." | |
84 | @false | |
85 | ||
86 | $(DEBIANMARKER): $(DEBIANFILE) | |
87 | $(TAR) xfvz $< | |
88 | touch $@ | |
89 | ||
90 | $(DEBIANFILE): | |
91 | @echo "$@ not found. Please download it and drop it in this directory ($(pwd))." | |
92 | @false |