Commit | Line | Data |
---|---|---|
0708f913 C |
1 | |
2 | -include ../Makefile.config | |
3 | ||
34e49164 C |
4 | ############################################################################## |
5 | # Variables | |
6 | ############################################################################## | |
7 | TARGET=parsing_c | |
8 | ||
485bce71 | 9 | |
b1b2de81 | 10 | # - type_cocci.ml ast_cocci.ml # + unparse_hrule |
485bce71 | 11 | SRC= 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. |
34 | LIBS=../commons/commons.cma ../globals/globals.cma \ | |
35 | ../parsing_cocci/cocci_parser.cma | |
36 | ||
91eba41f | 37 | INCLUDES= -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 | 42 | SYSLIBS= 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 |
50 | OCAMLCFLAGS ?= -g -dtypes | |
51 | ||
52 | OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) | |
53 | OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) | |
54 | OCAMLLEX=ocamllex$(OPTBIN) #-ml | |
55 | OCAMLYACC=ocamlyacc -v | |
0708f913 | 56 | OCAMLDEP=ocamldep$(OPTBIN) $(INCLUDES) |
34e49164 C |
57 | OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) |
58 | ||
59 | ||
60 | OBJS = $(SRC:.ml=.cmo) | |
61 | OPTOBJS = $(SRC:.ml=.cmx) | |
62 | ||
63 | ||
64 | ############################################################################## | |
65 | # Top rules | |
66 | ############################################################################## | |
67 | all: $(TARGET).cma | |
68 | all.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 | ||
79 | clean:: | |
80 | rm -f $(TARGET).top | |
81 | ||
34e49164 C |
82 | lexer_c.ml: lexer_c.mll |
83 | $(OCAMLLEX) $< | |
84 | clean:: | |
85 | rm -f lexer_c.ml | |
86 | beforedepend:: lexer_c.ml | |
87 | ||
88 | ||
89 | parser_c.ml parser_c.mli: parser_c.mly | |
90 | $(OCAMLYACC) $< | |
91 | clean:: | |
92 | rm -f parser_c.ml parser_c.mli parser_c.output | |
93 | beforedepend:: 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 | ||
106 | COREPARSING= 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 | ||
112 | locparsing: | |
113 | wc -l $(COREPARSING) | |
114 | ||
115 | locindiv: | |
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 | ||
139 | clean:: | |
140 | rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot | |
34e49164 C |
141 | rm -f *~ .*~ gmon.out #*# |
142 | ||
b1b2de81 C |
143 | distclean:: |
144 | rm -f .depend | |
145 | ||
34e49164 C |
146 | beforedepend:: |
147 | ||
708f4980 C |
148 | distclean:: |
149 | rm -f .depend | |
150 | ||
34e49164 C |
151 | depend:: beforedepend |
152 | $(OCAMLDEP) *.mli *.ml > .depend | |
153 | ||
154 | -include .depend |