Release coccinelle-0.1.2
[bpt/coccinelle.git] / parsing_c / Makefile
1 ##############################################################################
2 # Variables
3 ##############################################################################
4 TARGET=parsing_c
5
6
7 # - type_cocci.ml ast_cocci.ml # + unparse_hrule
8 SRC= flag_parsing_c.ml parsing_stat.ml \
9 ast_c.ml control_flow_c.ml \
10 visitor_c.ml lib_parsing_c.ml \
11 ast_to_flow.ml \
12 pretty_print_c.ml \
13 semantic_c.ml lexer_parser.ml parser_c.ml lexer_c.ml \
14 token_helpers.ml parsing_hacks.ml \
15 unparse_cocci.ml unparse_c.ml unparse_hrule.ml \
16 parse_c.ml \
17 cpp_ast_c.ml \
18 compare_c.ml type_annoter_c.ml \
19 test_parsing_c.ml
20
21
22
23 # ast_cocci.ml and unparse_cocci.ml should be deleted in the futur
24 # to make parsing_c really independent of coccinelle.
25 # control_flow_c have also coccinelle dependencies.
26 # old: parsing_c now depends on cocci_parser because in addition to decorate
27 # the token in Ast_c with some parse info, we now also make some place to
28 # welcome some mcodekind of Ast_cocci.
29 LIBS=../commons/commons.cma ../globals/globals.cma \
30 ../parsing_cocci/cocci_parser.cma
31
32 INCLUDES= -I ../commons -I ../globals -I ../parsing_cocci
33
34 #LIBS=../commons/commons.cma
35 #INCLUDES= -I ../commons
36 SYSLIBS= str.cma unix.cma
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 lexer_c.ml: lexer_c.mll
79 $(OCAMLLEX) $<
80 clean::
81 rm -f lexer_c.ml
82 beforedepend:: lexer_c.ml
83
84
85 parser_c.ml parser_c.mli: parser_c.mly
86 $(OCAMLYACC) $<
87 clean::
88 rm -f parser_c.ml parser_c.mli parser_c.output
89 beforedepend:: parser_c.ml parser_c.mli
90
91
92 ##############################################################################
93 # Pad's rules
94 ##############################################################################
95 # visitor_c.ml lib_parsing_c.ml \
96 # type_annoter_c.ml \
97 # statistics_c.ml \
98 # pretty_print_c.ml unparse_c.ml \
99 # test_parsing_c.ml
100 #toreput: compare_c.ml ast_to_flow.ml
101
102 COREPARSING= flag_parsing_c.ml parsing_stat.ml \
103 ast_cocci.ml \
104 ast_c.ml control_flow_c.ml \
105 semantic_c.ml lexer_parser.ml parser_c.mly lexer_c.mll \
106 token_helpers.ml parsing_hacks.ml parse_c.ml \
107
108 locparsing:
109 wc -l $(COREPARSING)
110
111 locindiv:
112 wc -l lexer_c.mll
113 wc -l parser_c.mly
114 wc -l parsing_hacks.ml
115 wc -l ast_c.ml
116 wc -l parse_c.ml
117
118
119 ##############################################################################
120 # Generic rules
121 ##############################################################################
122
123 .SUFFIXES: .ml .mli .cmo .cmi .cmx
124
125 .ml.cmo:
126 $(OCAMLC) -c $<
127 .mli.cmi:
128 $(OCAMLC) -c $<
129 .ml.cmx:
130 $(OCAMLOPT) -c $<
131
132 .ml.mldepend:
133 $(OCAMLC) -i $<
134
135 clean::
136 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
137 clean::
138 rm -f *~ .*~ gmon.out #*#
139
140 beforedepend::
141
142 depend:: beforedepend
143 $(OCAMLDEP) *.mli *.ml > .depend
144
145 -include .depend