Release coccinelle-0.1.6
[bpt/coccinelle.git] / parsing_cocci / .#Makefile.1.50
CommitLineData
0708f913
C
1# Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
2# Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
3# This file is part of Coccinelle.
4#
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.
8#
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.
13#
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/>.
16#
17# The authors reserve the right to distribute this or future versions of
18# Coccinelle under other licenses.
19
20
21TARGET=cocci_parser
22
23LEXER_SOURCES = lexer_cocci.mll
24SCRIPT_LEXER_SOURCES = lexer_script.mll
25PARSER_SOURCES = parser_cocci_menhir.mly
26SOURCES = flag_parsing_cocci.ml type_cocci.ml ast_cocci.ml ast0_cocci.ml \
27pretty_print_cocci.ml unparse_ast0.ml \
28visitor_ast.ml visitor_ast0.ml compute_lines.ml comm_assoc.ml \
29iso_pattern.ml iso_compile.ml single_statement.ml simple_assignments.ml \
30ast0toast.ml check_meta.ml top_level.ml type_infer.ml test_exps.ml \
31unitary_ast0.ml arity.ml index.ml context_neg.ml \
32insert_plus.ml function_prototypes.ml \
33unify_ast.ml semantic_cocci.ml data.ml free_vars.ml parse_aux.ml disjdistr.ml \
34$(LEXER_SOURCES:.mll=.ml) $(PARSER_SOURCES:.mly=.ml) \
35$(SCRIPT_LEXER_SOURCES:.mll=.ml) \
36get_constants.ml get_constants2.ml parse_cocci.ml
37
38LIBS=../commons/commons.cma ../globals/globals.cma
39SYSLIBS = str.cma unix.cma
40
41#MENHIR_PATH=$(shell ocamlfind query menhirLib)
42MENHIR_PATH=../menhirlib
43
44INCLUDES = -I ../commons -I ../commons/ocamlextra -I ../globals \
45-I $(MENHIR_PATH)
46
47MENHIR=$(MENHIR_PATH)/menhirLib.cmo
48MENHIRO=$(MENHIR_PATH)/menhirLib.cmx
49
50
51# The Caml compilers.
52OCAMLCFLAGS ?= -g -dtypes
53OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES)
54OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
55OCAMLLEX = ocamllex$(OPTBIN)
56OCAMLYACC= menhir --table
57OCAMLDEP = ocamldep$(OPTBIN) #$(INCLUDES)
58EXEC=$(TARGET).byte
59EXEC=$(TARGET)
60LIB=$(TARGET).cma
61OPTLIB=$(LIB:.cma=.cmxa)
62
63GENERATED= $(LEXER_SOURCES:.mll=.ml) $(SCRIPT_LEXER_SOURCES:.mll=.ml) \
64 $(PARSER_SOURCES:.mly=.ml) $(PARSER_SOURCES:.mly=.mli)
65OBJS = $(SOURCES:.ml=.cmo)
66OPTOBJS = $(OBJS:.cmo=.cmx)
67
68
69all: $(LIB)
70local: $(EXEC)
71
72all.opt: $(OPTLIB)
73
74$(LIB): $(GENERATED) $(OBJS)
75 $(OCAMLC) -I $(MENHIR_PATH) -a -o $(LIB) $(MENHIR) $(OBJS)
76
77
78$(OPTLIB): $(GENERATED) $(OPTOBJS)
79 $(OCAMLOPT) -I $(MENHIR_PATH) -a -o $(OPTLIB) $(MENHIRO) $(OPTOBJS)
80
81
82$(EXEC): $(OBJS) main.cmo $(LIBS)
83 $(OCAMLC) -o $(EXEC) $(SYSLIBS) $(LIBS) $(OBJS) main.cmo
84
85
86
87
88clean::
89 rm -f $(LIB)
90 rm -f $(OPTLIB) $(LIB:.cma=.a)
91 rm -f $(TARGET)
92
93
94
95
96.SUFFIXES:
97.SUFFIXES: .ml .mli .cmo .cmi .cmx
98
99.ml.cmo:
100 $(OCAMLC) -c $<
101
102.mli.cmi:
103 $(OCAMLC) -c $<
104
105.ml.cmx:
106 $(OCAMLOPT) -c $<
107
108$(LEXER_SOURCES:.mll=.ml) : $(LEXER_SOURCES)
109 $(OCAMLLEX) $(LEXER_SOURCES)
110
111$(PARSER_SOURCES:.mly=.ml) $(PARSER_SOURCES:.mly=.mli) : $(PARSER_SOURCES)
112 $(OCAMLYACC) $(PARSER_SOURCES)
113
114$(SCRIPT_LEXER_SOURCES:.mll=.ml): $(SCRIPT_LEXER_SOURCES)
115 $(OCAMLLEX) $(SCRIPT_LEXER_SOURCES)
116
117clean::
118 rm -f $(GENERATED)
119
120# clean rule for others files
121clean::
122 rm -f *.cm[iox] *.o *.annot
123 rm -f *~ .*~ #*#
124
125depend: $(GENERATED)
126 $(OCAMLDEP) *.mli *.ml > .depend
127
128.depend:
129 $(OCAMLDEP) *.mli *.ml > .depend
130
131-include .depend
132
133lexer_cocci.ml: lexer_cocci.mll
134parser_cocci_menhir.ml: parser_cocci_menhir.mly lexer_cocci.mll
135parser_cocci_menhir.mli: parser_cocci_menhir.mly lexer_cocci.mll
136lexer_script.ml: lexer_script.mll