1 # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
2 # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
3 # This file is part of Coccinelle.
5 # Coccinelle is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, according to version 2 of the License.
9 # Coccinelle is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
17 # The authors reserve the right to distribute this or future versions of
18 # Coccinelle under other licenses.
21 -include ..
/Makefile.config
25 LEXER_SOURCES
= lexer_cocci.mll
26 SCRIPT_LEXER_SOURCES
= lexer_script.mll
27 PARSER_SOURCES
= parser_cocci_menhir.mly
28 SOURCES
= flag_parsing_cocci.ml type_cocci.ml ast_cocci.ml ast0_cocci.ml \
29 pretty_print_cocci.ml unparse_ast0.ml visitor_ast0_types.ml \
30 visitor_ast.ml visitor_ast0.ml compute_lines.ml comm_assoc.ml \
31 iso_pattern.ml iso_compile.ml single_statement.ml simple_assignments.ml \
32 ast0toast.ml check_meta.ml top_level.ml type_infer.ml \
33 test_exps.ml unitary_ast0.ml arity.ml index.ml context_neg.ml \
34 adjust_pragmas.ml insert_plus.ml function_prototypes.ml \
35 unify_ast.ml semantic_cocci.ml data.ml free_vars.ml parse_aux.ml disjdistr.ml \
36 $(LEXER_SOURCES
:.mll
=.ml
) $(PARSER_SOURCES
:.mly
=.ml
) \
37 $(SCRIPT_LEXER_SOURCES
:.mll
=.ml
) \
38 get_constants.ml get_constants2.ml adjacency.ml parse_cocci.ml
40 LIBS
=..
/commons
/commons.cma ..
/globals
/globals.cma
41 SYSLIBS
= str.cma unix.cma
43 #MENHIR_PATH=$(shell ocamlfind query menhirLib)
44 MENHIR_PATH
=..
/menhirlib
46 INCLUDES
= -I ..
/commons
-I ..
/commons
/ocamlextra
-I ..
/globals \
49 MENHIR
=$(MENHIR_PATH
)/menhirLib.cmo
50 MENHIRO
=$(MENHIR_PATH
)/menhirLib.cmx
54 OCAMLCFLAGS ?
= -g
-dtypes
55 OCAMLC
=ocamlc
$(OPTBIN
) $(OCAMLCFLAGS
) $(INCLUDES
)
56 OCAMLOPT
= ocamlopt
$(OPTBIN
) $(OPTFLAGS
) $(INCLUDES
)
57 OCAMLLEX
= ocamllex
$(OPTBIN
)
58 OCAMLYACC
= menhir
--table
59 OCAMLDEP
= ocamldep
$(OPTBIN
) $(INCLUDES
)
63 OPTLIB
=$(LIB
:.cma
=.cmxa
)
65 GENERATED
= $(LEXER_SOURCES
:.mll
=.ml
) $(SCRIPT_LEXER_SOURCES
:.mll
=.ml
) \
66 $(PARSER_SOURCES
:.mly
=.ml
) $(PARSER_SOURCES
:.mly
=.mli
)
67 OBJS
= $(SOURCES
:.ml
=.cmo
)
68 OPTOBJS
= $(OBJS
:.cmo
=.cmx
)
76 $(LIB
): $(GENERATED
) $(OBJS
)
77 $(OCAMLC
) -I
$(MENHIR_PATH
) -a
-o
$(LIB
) $(MENHIR
) $(OBJS
)
80 $(OPTLIB
): $(GENERATED
) $(OPTOBJS
)
81 $(OCAMLOPT
) -I
$(MENHIR_PATH
) -a
-o
$(OPTLIB
) $(MENHIRO
) $(OPTOBJS
)
84 $(EXEC
): $(OBJS
) main.cmo
$(LIBS
)
85 $(OCAMLC
) -o
$(EXEC
) $(SYSLIBS
) $(LIBS
) $(OBJS
) main.cmo
92 rm -f
$(OPTLIB
) $(LIB
:.cma
=.a
)
99 .SUFFIXES
: .ml .mli .cmo .cmi .cmx
110 $(LEXER_SOURCES
:.mll
=.ml
) : $(LEXER_SOURCES
)
111 $(OCAMLLEX
) $(LEXER_SOURCES
)
113 $(PARSER_SOURCES
:.mly
=.ml
) $(PARSER_SOURCES
:.mly
=.mli
) : $(PARSER_SOURCES
)
114 $(OCAMLYACC
) $(PARSER_SOURCES
)
116 $(SCRIPT_LEXER_SOURCES
:.mll
=.ml
): $(SCRIPT_LEXER_SOURCES
)
117 $(OCAMLLEX
) $(SCRIPT_LEXER_SOURCES
)
122 # clean rule for others files
124 rm -f
*.cm
[iox
] *.o
*.annot
131 $(OCAMLDEP
) *.mli
*.ml
> .depend
134 $(OCAMLDEP
) *.mli
*.ml
> .depend
138 lexer_cocci.ml
: lexer_cocci.mll
139 parser_cocci_menhir.ml
: parser_cocci_menhir.mly lexer_cocci.mll
140 parser_cocci_menhir.mli
: parser_cocci_menhir.mly lexer_cocci.mll
141 lexer_script.ml
: lexer_script.mll