Release coccinelle-0.1.8
[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
485bce71 9
b1b2de81 10# - type_cocci.ml ast_cocci.ml # + unparse_hrule
485bce71 11SRC= flag_parsing_c.ml parsing_stat.ml \
708f4980 12 token_c.ml ast_c.ml control_flow_c.ml \
34e49164 13 visitor_c.ml lib_parsing_c.ml \
708f4980 14 control_flow_c_build.ml \
485bce71
C
15 pretty_print_c.ml \
16 semantic_c.ml lexer_parser.ml parser_c.ml lexer_c.ml \
708f4980
C
17 token_helpers.ml token_views_c.ml \
18 cpp_token_c.ml parsing_hacks.ml \
485bce71 19 unparse_cocci.ml unparse_c.ml unparse_hrule.ml \
708f4980 20 parse_c.ml type_c.ml \
485bce71 21 cpp_ast_c.ml \
0708f913
C
22 type_annoter_c.ml comment_annotater_c.ml \
23 compare_c.ml \
34e49164
C
24 test_parsing_c.ml
25
26
34e49164 27
485bce71 28# ast_cocci.ml and unparse_cocci.ml should be deleted in the futur
b1b2de81 29# to make parsing_c really independent of coccinelle.
485bce71 30# control_flow_c have also coccinelle dependencies.
b1b2de81 31# old: parsing_c now depends on cocci_parser because in addition to decorate
485bce71 32# the token in Ast_c with some parse info, we now also make some place to
34e49164
C
33# welcome some mcodekind of Ast_cocci.
34LIBS=../commons/commons.cma ../globals/globals.cma \
35 ../parsing_cocci/cocci_parser.cma
36
91eba41f 37INCLUDES= -I ../commons -I ../commons/ocamlextra -I ../commons/ocollection \
b1b2de81 38 -I ../globals -I ../parsing_cocci
34e49164 39
485bce71
C
40#LIBS=../commons/commons.cma
41#INCLUDES= -I ../commons
708f4980 42SYSLIBS= str.cma unix.cma num.cma
34e49164
C
43
44##############################################################################
45# Generic variables
46##############################################################################
47
b1b2de81 48#for warning: -w A
34e49164
C
49#for profiling: -p -inline 0 with OCAMLOPT
50OCAMLCFLAGS ?= -g -dtypes
51
52OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
53OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
54OCAMLLEX=ocamllex$(OPTBIN) #-ml
55OCAMLYACC=ocamlyacc -v
0708f913 56OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES)
34e49164
C
57OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
58
59
60OBJS = $(SRC:.ml=.cmo)
61OPTOBJS = $(SRC:.ml=.cmx)
62
63
64##############################################################################
65# Top rules
66##############################################################################
67all: $(TARGET).cma
68all.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
79clean::
80 rm -f $(TARGET).top
81
34e49164
C
82lexer_c.ml: lexer_c.mll
83 $(OCAMLLEX) $<
84clean::
85 rm -f lexer_c.ml
86beforedepend:: lexer_c.ml
87
88
89parser_c.ml parser_c.mli: parser_c.mly
90 $(OCAMLYACC) $<
91clean::
92 rm -f parser_c.ml parser_c.mli parser_c.output
93beforedepend:: parser_c.ml parser_c.mli
94
95
485bce71
C
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
106COREPARSING= 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
112locparsing:
113 wc -l $(COREPARSING)
114
115locindiv:
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
34e49164
C
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
b1b2de81 136.ml.mldepend:
34e49164
C
137 $(OCAMLC) -i $<
138
139clean::
140 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
34e49164
C
141 rm -f *~ .*~ gmon.out #*#
142
b1b2de81
C
143distclean::
144 rm -f .depend
145
34e49164
C
146beforedepend::
147
708f4980
C
148distclean::
149 rm -f .depend
150
34e49164
C
151depend:: beforedepend
152 $(OCAMLDEP) *.mli *.ml > .depend
153
154-include .depend