Release coccinelle-0.2.0
[bpt/coccinelle.git] / python / Makefile
1 # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
2 # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
3 # This file is part of Coccinelle.
4 #
5 # Coccinelle is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, according to version 2 of the License.
8 #
9 # Coccinelle is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
16 #
17 # The authors reserve the right to distribute this or future versions of
18 # Coccinelle under other licenses.
19
20
21 #############################################################################
22 # Configuration section
23 #############################################################################
24 -include ../Makefile.config
25
26 ##############################################################################
27 # Variables
28 ##############################################################################
29 TARGET=coccipython
30
31 SOURCES= pycocci_aux.ml pycocci.ml
32
33 INCLUDEDIRS = ../commons ../commons/ocamlextra ../globals ../pycaml \
34 ../parsing_c ../parsing_cocci
35
36 SYSLIBS = str.cma unix.cma
37 LIBS=../commons/commons.cma ../globals/globals.cma
38
39 # ../ctl/ctl.cma \
40 # ../parsing_c/c_parser.cma ../parsing_cocci/cocci_parser.cma
41 #pycaml/pycaml.cma
42
43
44 ##############################################################################
45 # Generic variables
46 ##############################################################################
47
48 INCLUDES=$(INCLUDEDIRS:%=-I %) $(INCLUDESEXTRA)
49
50 ##############################################################################
51 # Generic ocaml variables
52 ##############################################################################
53
54 # The Caml compilers.
55 OCAMLCFLAGS ?= -g -dtypes
56 OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
57 OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
58 OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES)
59
60
61 ##############################################################################
62 # Top rules
63 ##############################################################################
64
65 EXEC=$(TARGET).byte
66 LIB=$(TARGET).cma
67 OPTLIB=$(LIB:.cma=.cmxa)
68
69 CTLEXEC=$(CTLTARGET)
70
71 OBJS = $(SOURCES:.ml=.cmo)
72 OPTOBJS = $(OBJS:.cmo=.cmx)
73
74 CTLOBJS = $(CTLSOURCES:.ml=.cmo)
75 CTLOPTOBJS = $(CTLOBJS:.cmo=.cmx)
76
77
78 #all: $(EXEC) $(LIB)
79 all: $(LIB)
80
81 all.opt: $(OPTLIB)
82
83 ctl: $(CTLEXEC)
84
85
86 $(LIB): $(OBJS)
87 $(OCAMLC) -a -o $(LIB) $(OBJS)
88
89 clean::
90 rm -f $(LIB)
91
92
93 $(OPTLIB): $(OPTOBJS)
94 $(OCAMLOPT) -a -o $(OPTLIB) $(OPTOBJS)
95
96
97 $(EXEC): $(OBJS) main.cmo $(LIBS)
98 $(OCAMLC) -o $(EXEC) $(SYSLIBS) $(LIBS) $(OBJS) main.cmo
99
100 $(CTLEXEC): $(CTLOBJS) $(LIBS)
101 $(OCAMLC) -o $(CTLEXEC) $(SYSLIBS) $(LIBS) $(CTLOBJS)
102
103
104 clean::
105 rm -f $(OPTLIB) $(LIB:.cma=.a)
106 rm -f $(TARGET) rm -f $(TARGET).byte
107 rm -f $(CTLTARGET)
108
109
110 #pycocci.ml: ../pycaml/pycaml.ml ../pycaml/pycaml_ml.c
111 #pycocci_aux.ml: ../pycaml/pycaml.ml ../pycaml/pycaml_ml.c
112 pycocci_aux.ml:
113 @echo "\n\n\t*** pycocci_aux.ml not found ! ***\n\n\tRun 'configure && make depend' first.\n\n"
114
115 rmlinks:
116 rm -f pycocci.ml pycocci_aux.ml
117
118 ##############################################################################
119 # Generic ocaml rules
120 ##############################################################################
121
122 .SUFFIXES:
123 .SUFFIXES: .ml .mli .cmo .cmi .cmx
124
125 .ml.cmo:
126 $(OCAMLC) -c $<
127
128 .mli.cmi:
129 $(OCAMLC) -c $<
130
131 .ml.cmx:
132 $(OCAMLOPT) -c $<
133
134
135 # clean rule for others files
136 clean::
137 rm -f *.cm[iox] *.o *.annot
138 rm -f *~ .*~ #*#
139
140 distclean::
141 rm -f .depend
142
143 beforedepend:
144
145 depend: beforedepend
146 $(OCAMLDEP) *.mli *.ml > .depend
147
148 .depend:
149 $(OCAMLDEP) *.mli *.ml > .depend
150
151 -include .depend