Release coccinelle-0.2.0
[bpt/coccinelle.git] / engine / 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
485bce71
C
21##############################################################################
22# Variables
23##############################################################################
24#TARGET=matcher
0708f913
C
25-include ../Makefile.config
26
34e49164
C
27TARGET=cocciengine
28CTLTARGET=engine
29
485bce71
C
30SRC= flag_matcher.ml lib_engine.ml pretty_print_engine.ml \
31 check_exhaustive_pattern.ml \
32 check_reachability.ml \
33 c_vs_c.ml isomorphisms_c_c.ml \
34 cocci_vs_c.ml pattern_c.ml sgrep.ml transformation_c.ml \
35 asttomember.ml asttoctl2.ml ctltotex.ml \
0708f913 36 postprocess_transinfo.ml ctlcocci_integration.ml
485bce71
C
37
38#c_vs_c.ml
39#SRC= flag_matcher.ml \
40# c_vs_c.ml cocci_vs_c.ml \
41# lib_engine.ml \
b1b2de81 42# pattern_c.ml transformation_c.ml
485bce71
C
43
44#LIBS=../commons/commons.cma ../parsing_c/parsing_c.cma
45#INCLUDES= -I ../commons -I ../parsing_c
46INCLUDES = -I ../commons -I ../commons/ocamlextra -I ../globals \
b1b2de81 47 -I ../ctl -I ../parsing_cocci -I ../parsing_c
485bce71
C
48LIBS=../commons/commons.cma ../globals/globals.cma \
49 ../ctl/ctl.cma ../parsing_c/parsing_c.cma ../parsing_cocci/cocci_parser.cma
50
b1b2de81 51SYSLIBS= str.cma unix.cma
485bce71 52
34e49164
C
53
54# just to test asttoctl
55# CTLSOURCES = lib_engine.ml pretty_print_engine.ml asttoctl.ml ctltotex.ml \
56# main.ml
57
485bce71
C
58##############################################################################
59# Generic variables
60##############################################################################
34e49164 61
b1b2de81 62#for warning: -w A
485bce71 63#for profiling: -p -inline 0 with OCAMLOPT
34e49164 64OCAMLCFLAGS ?= -g -dtypes
34e49164 65
485bce71
C
66OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
67OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
68OCAMLLEX=ocamllex$(OPTBIN) #-ml
69OCAMLYACC=ocamlyacc -v
0708f913 70OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES)
485bce71 71OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
34e49164 72
34e49164 73
485bce71
C
74OBJS = $(SRC:.ml=.cmo)
75OPTOBJS = $(SRC:.ml=.cmx)
34e49164 76
34e49164 77
485bce71
C
78##############################################################################
79# Top rules
80##############################################################################
81all: $(TARGET).cma
82all.opt: $(TARGET).cmxa
34e49164 83
485bce71
C
84$(TARGET).cma: $(OBJS)
85 $(OCAMLC) -a -o $(TARGET).cma $(OBJS)
34e49164 86
485bce71
C
87$(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa)
88 $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS)
34e49164 89
485bce71
C
90$(TARGET).top: $(OBJS) $(LIBS)
91 $(OCAMLMKTOP) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS)
34e49164 92
34e49164 93clean::
485bce71 94 rm -f $(TARGET).top
34e49164
C
95
96
34e49164 97
485bce71
C
98##############################################################################
99# Pad's rules
100##############################################################################
34e49164 101
485bce71
C
102##############################################################################
103# Generic rules
104##############################################################################
34e49164 105
34e49164
C
106.SUFFIXES: .ml .mli .cmo .cmi .cmx
107
108.ml.cmo:
109 $(OCAMLC) -c $<
34e49164
C
110.mli.cmi:
111 $(OCAMLC) -c $<
34e49164
C
112.ml.cmx:
113 $(OCAMLOPT) -c $<
114
b1b2de81 115.ml.mldepend:
485bce71 116 $(OCAMLC) -i $<
34e49164 117
34e49164 118clean::
485bce71 119 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
485bce71 120 rm -f *~ .*~ gmon.out #*#
34e49164 121
b1b2de81
C
122distclean::
123 rm -f .depend
124
485bce71 125beforedepend::
34e49164 126
485bce71
C
127depend:: beforedepend
128 $(OCAMLDEP) *.mli *.ml > .depend
34e49164
C
129
130-include .depend