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 #############################################################################
26 # Configuration section
27 #############################################################################
28 -include ..
/Makefile.config
30 ##############################################################################
32 ##############################################################################
35 SOURCES
= pycocci_aux.ml
$(PYCOCCI_FILE
) pycocci.ml
37 INCLUDEDIRS_LOCAL
= ..
/commons ..
/commons
/ocamlextra ..
/globals \
38 ..
/parsing_c ..
/parsing_cocci
40 ifeq ("$(PYCAMLDIR)", "pycaml")
41 INCLUDEDIRS_LOCAL
+= ..
/$(PYCAMLDIR
)
42 INCLUDEDIRS
= $(INCLUDEDIRS_LOCAL
)
44 INCLUDEDIRS
= $(INCLUDEDIRS_LOCAL
) $(PYCAMLDIR
)
47 SYSLIBS
= str.cma unix.cma pycaml.cma
48 LIBS
=..
/commons
/commons.cma ..
/globals
/globals.cma
50 ##############################################################################
52 ##############################################################################
54 INCLUDES
=$(INCLUDEDIRS
:%=-I
%) $(INCLUDESEXTRA
)
55 INCLUDES_DEPEND
=$(INCLUDEDIRS_LOCAL
:%=-I
%) $(INCLUDESEXTRA
)
57 ##############################################################################
58 # Generic ocaml variables
59 ##############################################################################
62 OCAMLCFLAGS ?
= -g
-dtypes
63 OCAMLC
=ocamlc
$(OPTBIN
) $(OCAMLCFLAGS
) $(INCLUDES
)
64 OCAMLOPT
= ocamlopt
$(OPTBIN
) $(OPTFLAGS
) $(INCLUDES
)
65 OCAMLDEP
= ocamldep
$(OPTBIN
) $(INCLUDES_DEPEND
)
68 ##############################################################################
70 ##############################################################################
74 OPTLIB
=$(LIB
:.cma
=.cmxa
)
78 OBJS
= $(SOURCES
:.ml
=.cmo
)
79 OPTOBJS
= $(OBJS
:.cmo
=.cmx
)
81 CTLOBJS
= $(CTLSOURCES
:.ml
=.cmo
)
82 CTLOPTOBJS
= $(CTLOBJS
:.cmo
=.cmx
)
94 $(OCAMLC
) -a
-o
$(LIB
) $(OBJS
)
100 $(OPTLIB
): $(OPTOBJS
)
101 $(OCAMLOPT
) -a
-o
$(OPTLIB
) $(OPTOBJS
)
104 $(EXEC
): $(OBJS
) main.cmo
$(LIBS
)
105 $(OCAMLC
) -o
$(EXEC
) $(SYSLIBS
) $(LIBS
) $(OBJS
) main.cmo
107 $(CTLEXEC
): $(CTLOBJS
) $(LIBS
)
108 $(OCAMLC
) -o
$(CTLEXEC
) $(SYSLIBS
) $(LIBS
) $(CTLOBJS
)
112 rm -f
$(OPTLIB
) $(LIB
:.cma
=.a
)
118 $(MAKE
) -C coccilib
$@
122 ##############################################################################
123 # Generic ocaml rules
124 ##############################################################################
127 .SUFFIXES
: .ml .mli .cmo .cmi .cmx
139 # clean rule for others files
141 rm -f
*.cm
[iox
] *.o
*.annot
147 $(OCAMLDEP
) *.mli
*.ml
> .depend
150 $(OCAMLDEP
) *.mli
*.ml
> .depend