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