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