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