+# Copyright 2010, INRIA, University of Copenhagen
+# Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix
+# Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
+# Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix
+# This file is part of Coccinelle.
+#
+# Coccinelle is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, according to version 2 of the License.
+#
+# Coccinelle is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Coccinelle. If not, see <http://www.gnu.org/licenses/>.
+#
+# The authors reserve the right to distribute this or future versions of
+# Coccinelle under other licenses.
+
+
-include ../Makefile.config
TARGET=cocci_parser
LEXER_SOURCES = lexer_cocci.mll
+CLI_LEXER_SOURCES = lexer_cli.mll
SCRIPT_LEXER_SOURCES = lexer_script.mll
PARSER_SOURCES = parser_cocci_menhir.mly
SOURCES = flag_parsing_cocci.ml type_cocci.ml ast_cocci.ml ast0_cocci.ml \
unify_ast.ml semantic_cocci.ml data.ml free_vars.ml safe_for_multi_decls.ml \
parse_aux.ml disjdistr.ml \
$(LEXER_SOURCES:.mll=.ml) $(PARSER_SOURCES:.mly=.ml) \
-$(SCRIPT_LEXER_SOURCES:.mll=.ml) \
-get_constants2.ml id_utils.ml adjacency.ml parse_cocci.ml
+$(CLI_LEXER_SOURCES:.mll=.ml) $(SCRIPT_LEXER_SOURCES:.mll=.ml) \
+get_constants2.ml id_utils.ml adjacency.ml parse_cocci.ml command_line.ml
LIBS=../commons/commons.cma ../globals/globals.cma
SYSLIBS = str.cma unix.cma
MENHIR_PATH=$(MENHIRDIR)
endif
-INCLUDES = -I ../commons -I ../commons/ocamlextra -I ../globals \
--I $(MENHIR_PATH)
+INCLUDES = -I ../commons \
+ -I ../commons/ocamlextra \
+ -I ../globals \
+ -I $(MENHIR_PATH)
MENHIR=$(MENHIR_PATH)/menhirLib.cmo
MENHIRO=$(MENHIR_PATH)/menhirLib.cmx
OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
OCAMLLEX = ocamllex$(OPTBIN)
OCAMLYACC= menhir --table
-OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES)
+OCAMLDEP = ocamldep$(OPTBIN) #$(INCLUDES)
EXEC=$(TARGET).byte
EXEC=$(TARGET)
LIB=$(TARGET).cma
OPTLIB=$(LIB:.cma=.cmxa)
-GENERATED= $(LEXER_SOURCES:.mll=.ml) $(SCRIPT_LEXER_SOURCES:.mll=.ml) \
+GENERATED= $(LEXER_SOURCES:.mll=.ml) \
+ $(CLI_LEXER_SOURCES:.mll=.ml) $(SCRIPT_LEXER_SOURCES:.mll=.ml) \
$(PARSER_SOURCES:.mly=.ml) $(PARSER_SOURCES:.mly=.mli)
OBJS = $(SOURCES:.ml=.cmo)
OPTOBJS = $(OBJS:.cmo=.cmx)
$(PARSER_SOURCES:.mly=.ml) $(PARSER_SOURCES:.mly=.mli) : $(PARSER_SOURCES)
$(OCAMLYACC) $(PARSER_SOURCES)
+$(CLI_LEXER_SOURCES:.mll=.ml): $(CLI_LEXER_SOURCES)
+ $(OCAMLLEX) $(CLI_LEXER_SOURCES)
+
$(SCRIPT_LEXER_SOURCES:.mll=.ml): $(SCRIPT_LEXER_SOURCES)
$(OCAMLLEX) $(SCRIPT_LEXER_SOURCES)
parser_cocci_menhir.ml: parser_cocci_menhir.mly lexer_cocci.mll
parser_cocci_menhir.mli: parser_cocci_menhir.mly lexer_cocci.mll
lexer_script.ml: lexer_script.mll
+lexer_cli.ml: lexer_cli.mll