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