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