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