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