Release coccinelle-0.2.0
[bpt/coccinelle.git] / python / Makefile
CommitLineData
9f8e26f4
C
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
34e49164
C
21#############################################################################
22# Configuration section
23#############################################################################
24-include ../Makefile.config
25
26##############################################################################
27# Variables
28##############################################################################
29TARGET=coccipython
30
b1b2de81 31SOURCES= pycocci_aux.ml pycocci.ml
34e49164
C
32
33INCLUDEDIRS = ../commons ../commons/ocamlextra ../globals ../pycaml \
34 ../parsing_c ../parsing_cocci
35
36SYSLIBS = str.cma unix.cma
b1b2de81 37LIBS=../commons/commons.cma ../globals/globals.cma
34e49164
C
38
39# ../ctl/ctl.cma \
b1b2de81
C
40# ../parsing_c/c_parser.cma ../parsing_cocci/cocci_parser.cma
41#pycaml/pycaml.cma
34e49164
C
42
43
44##############################################################################
45# Generic variables
46##############################################################################
47
48INCLUDES=$(INCLUDEDIRS:%=-I %) $(INCLUDESEXTRA)
49
50##############################################################################
51# Generic ocaml variables
52##############################################################################
53
54# The Caml compilers.
55OCAMLCFLAGS ?= -g -dtypes
56OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
57OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
0708f913 58OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES)
34e49164
C
59
60
61##############################################################################
62# Top rules
63##############################################################################
64
65EXEC=$(TARGET).byte
66LIB=$(TARGET).cma
67OPTLIB=$(LIB:.cma=.cmxa)
68
69CTLEXEC=$(CTLTARGET)
70
71OBJS = $(SOURCES:.ml=.cmo)
72OPTOBJS = $(OBJS:.cmo=.cmx)
73
74CTLOBJS = $(CTLSOURCES:.ml=.cmo)
75CTLOPTOBJS = $(CTLOBJS:.cmo=.cmx)
76
77
78#all: $(EXEC) $(LIB)
79all: $(LIB)
80
81all.opt: $(OPTLIB)
82
83ctl: $(CTLEXEC)
84
85
86$(LIB): $(OBJS)
87 $(OCAMLC) -a -o $(LIB) $(OBJS)
88
89clean::
90 rm -f $(LIB)
91
92
b1b2de81 93$(OPTLIB): $(OPTOBJS)
34e49164
C
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
104clean::
b1b2de81 105 rm -f $(OPTLIB) $(LIB:.cma=.a)
34e49164
C
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
b1b2de81
C
112pycocci_aux.ml:
113 @echo "\n\n\t*** pycocci_aux.ml not found ! ***\n\n\tRun 'configure && make depend' first.\n\n"
34e49164
C
114
115rmlinks:
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
136clean::
137 rm -f *.cm[iox] *.o *.annot
b1b2de81
C
138 rm -f *~ .*~ #*#
139
140distclean::
141 rm -f .depend
34e49164
C
142
143beforedepend:
144
145depend: beforedepend
146 $(OCAMLDEP) *.mli *.ml > .depend
147
b1b2de81 148.depend:
34e49164
C
149 $(OCAMLDEP) *.mli *.ml > .depend
150
151-include .depend