Release coccinelle-0.1.8
[bpt/coccinelle.git] / parsing_c / Makefile
1
2 -include ../Makefile.config
3
4 ##############################################################################
5 # Variables
6 ##############################################################################
7 TARGET=parsing_c
8
9
10 # - type_cocci.ml ast_cocci.ml # + unparse_hrule
11 SRC= flag_parsing_c.ml parsing_stat.ml \
12 token_c.ml ast_c.ml control_flow_c.ml \
13 visitor_c.ml lib_parsing_c.ml \
14 control_flow_c_build.ml \
15 pretty_print_c.ml \
16 semantic_c.ml lexer_parser.ml parser_c.ml lexer_c.ml \
17 token_helpers.ml token_views_c.ml \
18 cpp_token_c.ml parsing_hacks.ml \
19 unparse_cocci.ml unparse_c.ml unparse_hrule.ml \
20 parse_c.ml type_c.ml \
21 cpp_ast_c.ml \
22 type_annoter_c.ml comment_annotater_c.ml \
23 compare_c.ml \
24 test_parsing_c.ml
25
26
27
28 # ast_cocci.ml and unparse_cocci.ml should be deleted in the futur
29 # to make parsing_c really independent of coccinelle.
30 # control_flow_c have also coccinelle dependencies.
31 # old: parsing_c now depends on cocci_parser because in addition to decorate
32 # the token in Ast_c with some parse info, we now also make some place to
33 # welcome some mcodekind of Ast_cocci.
34 LIBS=../commons/commons.cma ../globals/globals.cma \
35 ../parsing_cocci/cocci_parser.cma
36
37 INCLUDES= -I ../commons -I ../commons/ocamlextra -I ../commons/ocollection \
38 -I ../globals -I ../parsing_cocci
39
40 #LIBS=../commons/commons.cma
41 #INCLUDES= -I ../commons
42 SYSLIBS= str.cma unix.cma num.cma
43
44 ##############################################################################
45 # Generic variables
46 ##############################################################################
47
48 #for warning: -w A
49 #for profiling: -p -inline 0 with OCAMLOPT
50 OCAMLCFLAGS ?= -g -dtypes
51
52 OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
53 OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
54 OCAMLLEX=ocamllex$(OPTBIN) #-ml
55 OCAMLYACC=ocamlyacc -v
56 OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES)
57 OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
58
59
60 OBJS = $(SRC:.ml=.cmo)
61 OPTOBJS = $(SRC:.ml=.cmx)
62
63
64 ##############################################################################
65 # Top rules
66 ##############################################################################
67 all: $(TARGET).cma
68 all.opt: $(TARGET).cmxa
69
70 $(TARGET).cma: $(OBJS)
71 $(OCAMLC) -a -o $(TARGET).cma $(OBJS)
72
73 $(TARGET).cmxa: $(OPTOBJS) $(LIBS:.cma=.cmxa)
74 $(OCAMLOPT) -a -o $(TARGET).cmxa $(OPTOBJS)
75
76 $(TARGET).top: $(OBJS) $(LIBS)
77 $(OCAMLMKTOP) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS)
78
79 clean::
80 rm -f $(TARGET).top
81
82 lexer_c.ml: lexer_c.mll
83 $(OCAMLLEX) $<
84 clean::
85 rm -f lexer_c.ml
86 beforedepend:: lexer_c.ml
87
88
89 parser_c.ml parser_c.mli: parser_c.mly
90 $(OCAMLYACC) $<
91 clean::
92 rm -f parser_c.ml parser_c.mli parser_c.output
93 beforedepend:: parser_c.ml parser_c.mli
94
95
96 ##############################################################################
97 # Pad's rules
98 ##############################################################################
99 # visitor_c.ml lib_parsing_c.ml \
100 # type_annoter_c.ml \
101 # statistics_c.ml \
102 # pretty_print_c.ml unparse_c.ml \
103 # test_parsing_c.ml
104 #toreput: compare_c.ml ast_to_flow.ml
105
106 COREPARSING= flag_parsing_c.ml parsing_stat.ml \
107 ast_cocci.ml \
108 ast_c.ml control_flow_c.ml \
109 semantic_c.ml lexer_parser.ml parser_c.mly lexer_c.mll \
110 token_helpers.ml parsing_hacks.ml parse_c.ml \
111
112 locparsing:
113 wc -l $(COREPARSING)
114
115 locindiv:
116 wc -l lexer_c.mll
117 wc -l parser_c.mly
118 wc -l parsing_hacks.ml
119 wc -l ast_c.ml
120 wc -l parse_c.ml
121
122
123 ##############################################################################
124 # Generic rules
125 ##############################################################################
126
127 .SUFFIXES: .ml .mli .cmo .cmi .cmx
128
129 .ml.cmo:
130 $(OCAMLC) -c $<
131 .mli.cmi:
132 $(OCAMLC) -c $<
133 .ml.cmx:
134 $(OCAMLOPT) -c $<
135
136 .ml.mldepend:
137 $(OCAMLC) -i $<
138
139 clean::
140 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
141 rm -f *~ .*~ gmon.out #*#
142
143 distclean::
144 rm -f .depend
145
146 beforedepend::
147
148 distclean::
149 rm -f .depend
150
151 depend:: beforedepend
152 $(OCAMLDEP) *.mli *.ml > .depend
153
154 -include .depend