- Try to do better pretty printing when array elements are individually
[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
abad11c5 25
34e49164
C
26#############################################################################
27# Configuration section
28#############################################################################
feec80c3
C
29ifneq ($(MAKECMDGOALS),distclean)
30include ../Makefile.config
31endif
34e49164
C
32
33##############################################################################
34# Variables
35##############################################################################
36TARGET=coccipython
37
755320b0
C
38OCAMLCFLAGS ?= -g
39OPTFLAGS ?= -g
d6ce1786 40
17ba0788 41SOURCES= pycocci_aux.ml $(PYCOCCI_FILE) pycocci.ml
34e49164 42
413ffc02
C
43INCLUDEDIRS_LOCAL = ../commons ../commons/ocamlextra ../globals \
44 ../parsing_c ../parsing_cocci
45
413ffc02 46INCLUDEDIRS = $(INCLUDEDIRS_LOCAL) $(PYCAMLDIR)
34e49164 47
90aeb998 48SYSLIBS = str.cma unix.cma pycaml.cma
b1b2de81 49LIBS=../commons/commons.cma ../globals/globals.cma
34e49164 50
34e49164
C
51##############################################################################
52# Generic variables
53##############################################################################
54
55INCLUDES=$(INCLUDEDIRS:%=-I %) $(INCLUDESEXTRA)
413ffc02 56INCLUDES_DEPEND=$(INCLUDEDIRS_LOCAL:%=-I %) $(INCLUDESEXTRA)
34e49164
C
57
58##############################################################################
59# Generic ocaml variables
60##############################################################################
61
62# The Caml compilers.
755320b0
C
63OCAMLC_CMD=$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES)
64OCAMLOPT_CMD=$(OCAMLOPT) $(OPTFLAGS) $(INCLUDES)
feec80c3
C
65OCAMLDEP_CMD=$(OCAMLDEP) $(INCLUDES_DEPEND)
66OCAMLMKTOP_CMD=$(OCAMLMKTOP) -g -custom $(INCLUDES)
34e49164
C
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
abad11c5 84ifneq ($(FEATURE_OCAMLBUILD),yes)
34e49164
C
85all: $(LIB)
86
d6ce1786
C
87all.opt:
88 @$(MAKE) $(OPTLIB) BUILD_OPT=yes
34e49164
C
89
90ctl: $(CTLEXEC)
91
92
93$(LIB): $(OBJS)
feec80c3 94 $(OCAMLC_CMD) -a -o $(LIB) $(OBJS)
34e49164
C
95
96clean::
abad11c5 97 rm -f $(TARGET).cma $(TARGET).a $(TARGET).o $(TARGET).cmxa
34e49164
C
98
99
b1b2de81 100$(OPTLIB): $(OPTOBJS)
feec80c3 101 $(OCAMLOPT_CMD) -a -o $(OPTLIB) $(OPTOBJS)
34e49164
C
102
103
104$(EXEC): $(OBJS) main.cmo $(LIBS)
feec80c3 105 $(OCAMLC_CMD) -o $(EXEC) $(SYSLIBS) $(LIBS) $(OBJS) main.cmo
34e49164
C
106
107$(CTLEXEC): $(CTLOBJS) $(LIBS)
feec80c3 108 $(OCAMLC_CMD) -o $(CTLEXEC) $(SYSLIBS) $(LIBS) $(CTLOBJS)
abad11c5
C
109else
110all:
111 cd .. && $(OCAMLBUILD) python/python.cma
112all.opt:
113 cd .. && $(OCAMLBUILD) python/python.cmxa
114clean::
115 cd .. && $(OCAMLBUILD) -clean
116endif
34e49164
C
117
118clean::
b1b2de81 119 rm -f $(OPTLIB) $(LIB:.cma=.a)
c491d8ee
C
120 rm -f $(TARGET)
121 rm -f $(TARGET).byte
34e49164 122 rm -f $(CTLTARGET)
feec80c3 123 rm -f .depend
abad11c5 124 rm -f coccipython.cmxa coccipython.a
34e49164 125
c491d8ee
C
126distclean::
127 $(MAKE) -C coccilib $@
c491d8ee 128 rm -f pycocci.ml
abad11c5 129 rm -f *.cm[ioxa] *.o *.annot
34e49164
C
130
131##############################################################################
132# Generic ocaml rules
133##############################################################################
134
135.SUFFIXES:
136.SUFFIXES: .ml .mli .cmo .cmi .cmx
137
138.ml.cmo:
feec80c3 139 $(OCAMLC_CMD) -c $<
34e49164
C
140
141.mli.cmi:
feec80c3 142 $(OCAMLC_CMD) -c $<
34e49164
C
143
144.ml.cmx:
feec80c3 145 $(OCAMLOPT_CMD) -c $<
34e49164
C
146
147
148# clean rule for others files
149clean::
150 rm -f *.cm[iox] *.o *.annot
b1b2de81
C
151 rm -f *~ .*~ #*#
152
feec80c3
C
153.PHONEY: depend
154.depend depend:
155 $(OCAMLDEP_CMD) *.mli *.ml > .depend
34e49164 156
feec80c3
C
157ifneq ($(MAKECMDGOALS),clean)
158ifneq ($(MAKECMDGOALS),distclean)
abad11c5 159ifneq ($(FEATURE_OCAMLBUILD),yes)
34e49164 160-include .depend
feec80c3
C
161endif
162endif
abad11c5 163endif
d6ce1786
C
164
165include ../Makefile.common