d2a67ecf983fbeb1d76fb728078f59698e8b567a
[bpt/coccinelle.git] / python / .#Makefile.1.5
1 # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
2 # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
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
113 rmlinks:
114 rm -f pycocci.ml pycocci_aux.ml
115
116 ##############################################################################
117 # Generic ocaml rules
118 ##############################################################################
119
120 .SUFFIXES:
121 .SUFFIXES: .ml .mli .cmo .cmi .cmx
122
123 .ml.cmo:
124 $(OCAMLC) -c $<
125
126 .mli.cmi:
127 $(OCAMLC) -c $<
128
129 .ml.cmx:
130 $(OCAMLOPT) -c $<
131
132
133 # clean rule for others files
134 clean::
135 rm -f *.cm[iox] *.o *.annot
136 rm -f *~ .*~ #*#
137
138 beforedepend:
139
140 depend: beforedepend
141 $(OCAMLDEP) *.mli *.ml > .depend
142
143 .depend:
144 $(OCAMLDEP) *.mli *.ml > .depend
145
146 -include .depend