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