1 # Copyright 2005-2008, 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.
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.
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.
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/>.
17 # The authors reserve the right to distribute this or future versions of
18 # Coccinelle under other licenses.
21 ##############################################################################
23 ##############################################################################
28 SRC= flag_matcher.ml lib_engine.ml pretty_print_engine.ml \
29 check_exhaustive_pattern.ml \
30 check_reachability.ml \
31 c_vs_c.ml isomorphisms_c_c.ml \
32 cocci_vs_c.ml pattern_c.ml sgrep.ml transformation_c.ml \
33 asttomember.ml asttoctl2.ml ctltotex.ml \
34 postprocess_transinfo.ml ctlcocci_integration.ml
37 #SRC= flag_matcher.ml \
38 # c_vs_c.ml cocci_vs_c.ml \
40 # pattern_c.ml transformation_c.ml
42 #LIBS=../commons/commons.cma ../parsing_c/parsing_c.cma
43 #INCLUDES= -I ../commons -I ../parsing_c
44 INCLUDES = -I ../commons -I ../commons/ocamlextra -I ../globals \
45 -I ../ctl -I ../parsing_cocci -I ../parsing_c
46 LIBS=../commons/commons.cma ../globals/globals.cma \
47 ../ctl/ctl.cma ../parsing_c/c_parser.cma ../parsing_cocci/cocci_parser.cma
49 SYSLIBS= str.cma unix.cma
52 # just to test asttoctl
53 # CTLSOURCES = lib_engine.ml pretty_print_engine.ml asttoctl.ml ctltotex.ml \
56 ##############################################################################
58 ##############################################################################
61 #for profiling: -p -inline 0 with OCAMLOPT
62 OCAMLCFLAGS ?= -g -dtypes
64 OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
65 OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
66 OCAMLLEX=ocamllex$(OPTBIN) #-ml
67 OCAMLYACC=ocamlyacc -v
68 OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES)
69 OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
72 OBJS = $(SRC:.ml=.cmo)
73 OPTOBJS = $(SRC:.ml=.cmx)
76 ##############################################################################
78 ##############################################################################
80 all.opt: $(TARGET).cmxa
82 $(TARGET).cma: $(OBJS)
83 $(OCAMLC) -a -o $(TARGET).cma $(OBJS)
85 $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa)
86 $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS)
88 $(TARGET).top: $(OBJS) $(LIBS)
89 $(OCAMLMKTOP) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS)
96 ##############################################################################
98 ##############################################################################
100 ##############################################################################
102 ##############################################################################
104 .SUFFIXES: .ml .mli .cmo .cmi .cmx
117 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
119 rm -f *~ .*~ gmon.out #*#
123 depend:: beforedepend
124 $(OCAMLDEP) *.mli *.ml > .depend