1 # Copyright 2012, INRIA
2 # Julia Lawall, Gilles Muller
3 # Copyright 2010-2011, INRIA, University of Copenhagen
4 # Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
5 # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
6 # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
7 # This file is part of Coccinelle.
9 # Coccinelle is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, according to version 2 of the License.
13 # Coccinelle is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
21 # The authors reserve the right to distribute this or future versions of
22 # Coccinelle under other licenses.
25 -include ..
/Makefile.config
29 LEXER_SOURCES
= lexer_cocci.mll
30 CLI_LEXER_SOURCES
= lexer_cli.mll
31 SCRIPT_LEXER_SOURCES
= lexer_script.mll
32 PARSER_SOURCES
= parser_cocci_menhir.mly
33 SOURCES
= flag_parsing_cocci.ml type_cocci.ml ast_cocci.ml ast0_cocci.ml \
34 pretty_print_cocci.ml unparse_ast0.ml visitor_ast0_types.ml \
35 visitor_ast.ml visitor_ast0.ml compute_lines.ml comm_assoc.ml \
36 iso_pattern.ml iso_compile.ml single_statement.ml simple_assignments.ml \
37 get_metas.ml ast0toast.ml check_meta.ml top_level.ml type_infer.ml \
38 test_exps.ml unitary_ast0.ml arity.ml index.ml context_neg.ml \
39 adjust_pragmas.ml insert_plus.ml function_prototypes.ml \
40 unify_ast.ml semantic_cocci.ml data.ml free_vars.ml safe_for_multi_decls.ml \
41 parse_aux.ml disjdistr.ml \
42 $(LEXER_SOURCES
:.mll
=.ml
) $(PARSER_SOURCES
:.mly
=.ml
) \
43 $(CLI_LEXER_SOURCES
:.mll
=.ml
) $(SCRIPT_LEXER_SOURCES
:.mll
=.ml
) \
44 get_constants2.ml id_utils.ml adjacency.ml parse_cocci.ml command_line.ml
46 LIBS
=..
/commons
/commons.cma ..
/globals
/globals.cma
47 SYSLIBS
= str.cma unix.cma
49 ifeq ("$(MENHIRDIR)","menhirlib")
50 MENHIR_PATH
=..
/$(MENHIRDIR
)
52 MENHIR_PATH
=$(MENHIRDIR
)
55 INCLUDES
= -I ..
/commons \
56 -I ..
/commons
/ocamlextra \
60 MENHIR
=$(MENHIR_PATH
)/menhirLib.cmo
61 MENHIRO
=$(MENHIR_PATH
)/menhirLib.cmx
65 OCAMLCFLAGS ?
= -g
-dtypes
66 OCAMLC
=ocamlc
$(OPTBIN
) $(OCAMLCFLAGS
) $(INCLUDES
)
67 OCAMLOPT
= ocamlopt
$(OPTBIN
) $(OPTFLAGS
) $(INCLUDES
)
68 OCAMLLEX
= ocamllex
$(OPTBIN
)
69 OCAMLYACC
= menhir
--table
70 OCAMLDEP
= ocamldep
$(OPTBIN
) #$(INCLUDES)
74 OPTLIB
=$(LIB
:.cma
=.cmxa
)
76 GENERATED
= $(LEXER_SOURCES
:.mll
=.ml
) \
77 $(CLI_LEXER_SOURCES
:.mll
=.ml
) $(SCRIPT_LEXER_SOURCES
:.mll
=.ml
) \
78 $(PARSER_SOURCES
:.mly
=.ml
) $(PARSER_SOURCES
:.mly
=.mli
)
79 OBJS
= $(SOURCES
:.ml
=.cmo
)
80 OPTOBJS
= $(OBJS
:.cmo
=.cmx
)
88 $(LIB
): $(GENERATED
) $(OBJS
)
89 $(OCAMLC
) -I
$(MENHIR_PATH
) -a
-o
$(LIB
) $(MENHIR
) $(OBJS
)
92 $(OPTLIB
): $(GENERATED
) $(OPTOBJS
)
93 $(OCAMLOPT
) -I
$(MENHIR_PATH
) -a
-o
$(OPTLIB
) $(MENHIRO
) $(OPTOBJS
)
96 $(EXEC
): $(OBJS
) main.cmo
$(LIBS
)
97 $(OCAMLC
) -o
$(EXEC
) $(SYSLIBS
) $(LIBS
) $(OBJS
) main.cmo
104 rm -f
$(OPTLIB
) $(LIB
:.cma
=.a
)
111 .SUFFIXES
: .ml .mli .cmo .cmi .cmx
122 $(LEXER_SOURCES
:.mll
=.ml
) : $(LEXER_SOURCES
)
123 $(OCAMLLEX
) $(LEXER_SOURCES
)
125 $(PARSER_SOURCES
:.mly
=.ml
) $(PARSER_SOURCES
:.mly
=.mli
) : $(PARSER_SOURCES
)
126 $(OCAMLYACC
) $(PARSER_SOURCES
)
128 $(CLI_LEXER_SOURCES
:.mll
=.ml
): $(CLI_LEXER_SOURCES
)
129 $(OCAMLLEX
) $(CLI_LEXER_SOURCES
)
131 $(SCRIPT_LEXER_SOURCES
:.mll
=.ml
): $(SCRIPT_LEXER_SOURCES
)
132 $(OCAMLLEX
) $(SCRIPT_LEXER_SOURCES
)
137 # clean rule for others files
139 rm -f
*.cm
[iox
] *.o
*.annot
146 $(OCAMLDEP
) *.mli
*.ml
> .depend
149 $(OCAMLDEP
) *.mli
*.ml
> .depend
153 lexer_cocci.ml
: lexer_cocci.mll
154 parser_cocci_menhir.ml
: parser_cocci_menhir.mly lexer_cocci.mll
155 parser_cocci_menhir.mli
: parser_cocci_menhir.mly lexer_cocci.mll
156 lexer_script.ml
: lexer_script.mll
157 lexer_cli.ml
: lexer_cli.mll