Commit | Line | Data |
---|---|---|
c491d8ee C |
1 | # Copyright 2010, INRIA, University of Copenhagen |
2 | # Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix | |
3 | # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen | |
4 | # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix | |
5 | # This file is part of Coccinelle. | |
6 | # | |
7 | # Coccinelle is free software: you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation, according to version 2 of the License. | |
10 | # | |
11 | # Coccinelle is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>. | |
18 | # | |
19 | # The authors reserve the right to distribute this or future versions of | |
20 | # Coccinelle under other licenses. | |
21 | ||
22 | ||
485bce71 C |
23 | ############################################################################## |
24 | # Variables | |
25 | ############################################################################## | |
26 | #TARGET=matcher | |
0708f913 C |
27 | -include ../Makefile.config |
28 | ||
34e49164 C |
29 | TARGET=cocciengine |
30 | CTLTARGET=engine | |
31 | ||
485bce71 C |
32 | SRC= flag_matcher.ml lib_engine.ml pretty_print_engine.ml \ |
33 | check_exhaustive_pattern.ml \ | |
34 | check_reachability.ml \ | |
35 | c_vs_c.ml isomorphisms_c_c.ml \ | |
36 | cocci_vs_c.ml pattern_c.ml sgrep.ml transformation_c.ml \ | |
37 | asttomember.ml asttoctl2.ml ctltotex.ml \ | |
0708f913 | 38 | postprocess_transinfo.ml ctlcocci_integration.ml |
485bce71 C |
39 | |
40 | #c_vs_c.ml | |
41 | #SRC= flag_matcher.ml \ | |
42 | # c_vs_c.ml cocci_vs_c.ml \ | |
43 | # lib_engine.ml \ | |
b1b2de81 | 44 | # pattern_c.ml transformation_c.ml |
485bce71 C |
45 | |
46 | #LIBS=../commons/commons.cma ../parsing_c/parsing_c.cma | |
47 | #INCLUDES= -I ../commons -I ../parsing_c | |
48 | INCLUDES = -I ../commons -I ../commons/ocamlextra -I ../globals \ | |
b1b2de81 | 49 | -I ../ctl -I ../parsing_cocci -I ../parsing_c |
485bce71 C |
50 | LIBS=../commons/commons.cma ../globals/globals.cma \ |
51 | ../ctl/ctl.cma ../parsing_c/parsing_c.cma ../parsing_cocci/cocci_parser.cma | |
52 | ||
b1b2de81 | 53 | SYSLIBS= str.cma unix.cma |
485bce71 | 54 | |
34e49164 C |
55 | |
56 | # just to test asttoctl | |
57 | # CTLSOURCES = lib_engine.ml pretty_print_engine.ml asttoctl.ml ctltotex.ml \ | |
58 | # main.ml | |
59 | ||
485bce71 C |
60 | ############################################################################## |
61 | # Generic variables | |
62 | ############################################################################## | |
34e49164 | 63 | |
b1b2de81 | 64 | #for warning: -w A |
485bce71 | 65 | #for profiling: -p -inline 0 with OCAMLOPT |
34e49164 | 66 | OCAMLCFLAGS ?= -g -dtypes |
34e49164 | 67 | |
485bce71 C |
68 | OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) |
69 | OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) | |
70 | OCAMLLEX=ocamllex$(OPTBIN) #-ml | |
71 | OCAMLYACC=ocamlyacc -v | |
0708f913 | 72 | OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES) |
485bce71 | 73 | OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) |
34e49164 | 74 | |
34e49164 | 75 | |
485bce71 C |
76 | OBJS = $(SRC:.ml=.cmo) |
77 | OPTOBJS = $(SRC:.ml=.cmx) | |
34e49164 | 78 | |
34e49164 | 79 | |
485bce71 C |
80 | ############################################################################## |
81 | # Top rules | |
82 | ############################################################################## | |
83 | all: $(TARGET).cma | |
84 | all.opt: $(TARGET).cmxa | |
34e49164 | 85 | |
485bce71 C |
86 | $(TARGET).cma: $(OBJS) |
87 | $(OCAMLC) -a -o $(TARGET).cma $(OBJS) | |
34e49164 | 88 | |
485bce71 C |
89 | $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa) |
90 | $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS) | |
34e49164 | 91 | |
485bce71 C |
92 | $(TARGET).top: $(OBJS) $(LIBS) |
93 | $(OCAMLMKTOP) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS) | |
34e49164 | 94 | |
34e49164 | 95 | clean:: |
485bce71 | 96 | rm -f $(TARGET).top |
34e49164 C |
97 | |
98 | ||
34e49164 | 99 | |
485bce71 C |
100 | ############################################################################## |
101 | # Pad's rules | |
102 | ############################################################################## | |
34e49164 | 103 | |
485bce71 C |
104 | ############################################################################## |
105 | # Generic rules | |
106 | ############################################################################## | |
34e49164 | 107 | |
34e49164 C |
108 | .SUFFIXES: .ml .mli .cmo .cmi .cmx |
109 | ||
110 | .ml.cmo: | |
111 | $(OCAMLC) -c $< | |
34e49164 C |
112 | .mli.cmi: |
113 | $(OCAMLC) -c $< | |
34e49164 C |
114 | .ml.cmx: |
115 | $(OCAMLOPT) -c $< | |
116 | ||
b1b2de81 | 117 | .ml.mldepend: |
485bce71 | 118 | $(OCAMLC) -i $< |
34e49164 | 119 | |
34e49164 | 120 | clean:: |
485bce71 | 121 | rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot |
485bce71 | 122 | rm -f *~ .*~ gmon.out #*# |
34e49164 | 123 | |
b1b2de81 C |
124 | distclean:: |
125 | rm -f .depend | |
126 | ||
485bce71 | 127 | beforedepend:: |
34e49164 | 128 | |
485bce71 C |
129 | depend:: beforedepend |
130 | $(OCAMLDEP) *.mli *.ml > .depend | |
34e49164 C |
131 | |
132 | -include .depend |