Release coccinelle-0.2.4rc6
[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
1eddfd50
C
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
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 \
34e49164 25 visitor_c.ml lib_parsing_c.ml \
708f4980 26 control_flow_c_build.ml \
485bce71
C
27 pretty_print_c.ml \
28 semantic_c.ml lexer_parser.ml parser_c.ml lexer_c.ml \
708f4980 29 token_helpers.ml token_views_c.ml \
978fd7e5
C
30 cpp_token_c.ml \
31 parsing_hacks.ml \
32 cpp_analysis_c.ml \
485bce71 33 unparse_cocci.ml unparse_c.ml unparse_hrule.ml \
978fd7e5 34 parsing_recovery_c.ml parsing_consistency_c.ml \
708f4980 35 parse_c.ml type_c.ml \
485bce71 36 cpp_ast_c.ml \
0708f913
C
37 type_annoter_c.ml comment_annotater_c.ml \
38 compare_c.ml \
34e49164
C
39 test_parsing_c.ml
40
41
34e49164 42
485bce71 43# ast_cocci.ml and unparse_cocci.ml should be deleted in the futur
b1b2de81 44# to make parsing_c really independent of coccinelle.
485bce71 45# control_flow_c have also coccinelle dependencies.
b1b2de81 46# old: parsing_c now depends on cocci_parser because in addition to decorate
485bce71 47# the token in Ast_c with some parse info, we now also make some place to
34e49164
C
48# welcome some mcodekind of Ast_cocci.
49LIBS=../commons/commons.cma ../globals/globals.cma \
50 ../parsing_cocci/cocci_parser.cma
51
90aeb998 52INCLUDESDEP= -I ../commons -I ../commons/ocamlextra -I ../commons/ocollection \
b1b2de81 53 -I ../globals -I ../parsing_cocci
34e49164 54
90aeb998
C
55INCLUDES=$(INCLUDESDEP) $(TARZANINCLUDE)
56
485bce71
C
57#LIBS=../commons/commons.cma
58#INCLUDES= -I ../commons
708f4980 59SYSLIBS= str.cma unix.cma num.cma
34e49164
C
60
61##############################################################################
62# Generic variables
63##############################################################################
64
b1b2de81 65#for warning: -w A
34e49164
C
66#for profiling: -p -inline 0 with OCAMLOPT
67OCAMLCFLAGS ?= -g -dtypes
68
69OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
70OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
71OCAMLLEX=ocamllex$(OPTBIN) #-ml
72OCAMLYACC=ocamlyacc -v
90aeb998 73OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDESDEP)
34e49164
C
74OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
75
76
77OBJS = $(SRC:.ml=.cmo)
78OPTOBJS = $(SRC:.ml=.cmx)
79
80
81##############################################################################
82# Top rules
83##############################################################################
84all: $(TARGET).cma
85all.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
96clean::
97 rm -f $(TARGET).top
98
34e49164
C
99lexer_c.ml: lexer_c.mll
100 $(OCAMLLEX) $<
101clean::
102 rm -f lexer_c.ml
103beforedepend:: lexer_c.ml
104
105
106parser_c.ml parser_c.mli: parser_c.mly
107 $(OCAMLYACC) $<
108clean::
109 rm -f parser_c.ml parser_c.mli parser_c.output
110beforedepend:: parser_c.ml parser_c.mli
111
112
485bce71
C
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
123COREPARSING= 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
129locparsing:
130 wc -l $(COREPARSING)
131
132locindiv:
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
978fd7e5
C
139##############################################################################
140# Literate Programming rules
141##############################################################################
142
485bce71 143
34e49164
C
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
b1b2de81 157.ml.mldepend:
34e49164
C
158 $(OCAMLC) -i $<
159
160clean::
161 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
34e49164
C
162 rm -f *~ .*~ gmon.out #*#
163
b1b2de81
C
164distclean::
165 rm -f .depend
166
34e49164
C
167beforedepend::
168
708f4980
C
169distclean::
170 rm -f .depend
171
34e49164
C
172depend:: beforedepend
173 $(OCAMLDEP) *.mli *.ml > .depend
174
175-include .depend