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.
26 #############################################################################
27 # Configuration section
28 #############################################################################
29 ifneq ($(MAKECMDGOALS
),distclean)
30 include ..
/Makefile.config
33 ##############################################################################
35 ##############################################################################
41 SOURCES
= pycocci_aux.ml
$(PYCOCCI_FILE
) pycocci.ml
43 INCLUDEDIRS_LOCAL
= ..
/commons ..
/commons
/ocamlextra ..
/globals \
44 ..
/parsing_c ..
/parsing_cocci
46 INCLUDEDIRS
= $(INCLUDEDIRS_LOCAL
) $(PYCAMLDIR
)
48 SYSLIBS
= str.cma unix.cma pycaml.cma
49 LIBS
=..
/commons
/commons.cma ..
/globals
/globals.cma
51 ##############################################################################
53 ##############################################################################
55 INCLUDES
=$(INCLUDEDIRS
:%=-I
%) $(INCLUDESEXTRA
)
56 INCLUDES_DEPEND
=$(INCLUDEDIRS_LOCAL
:%=-I
%) $(INCLUDESEXTRA
)
58 ##############################################################################
59 # Generic ocaml variables
60 ##############################################################################
63 OCAMLC_CMD
=$(OCAMLC
) $(OCAMLCFLAGS
) $(INCLUDES
)
64 OCAMLOPT_CMD
=$(OCAMLOPT
) $(OPTFLAGS
) $(INCLUDES
)
65 OCAMLDEP_CMD
=$(OCAMLDEP
) $(INCLUDES_DEPEND
)
66 OCAMLMKTOP_CMD
=$(OCAMLMKTOP
) -g
-custom
$(INCLUDES
)
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
)
84 ifneq ($(FEATURE_OCAMLBUILD
),yes
)
88 @
$(MAKE
) $(OPTLIB
) BUILD_OPT
=yes
94 $(OCAMLC_CMD
) -a
-o
$(LIB
) $(OBJS
)
97 rm -f
$(TARGET
).cma
$(TARGET
).a
$(TARGET
).o
$(TARGET
).cmxa
100 $(OPTLIB
): $(OPTOBJS
)
101 $(OCAMLOPT_CMD
) -a
-o
$(OPTLIB
) $(OPTOBJS
)
104 $(EXEC
): $(OBJS
) main.cmo
$(LIBS
)
105 $(OCAMLC_CMD
) -o
$(EXEC
) $(SYSLIBS
) $(LIBS
) $(OBJS
) main.cmo
107 $(CTLEXEC
): $(CTLOBJS
) $(LIBS
)
108 $(OCAMLC_CMD
) -o
$(CTLEXEC
) $(SYSLIBS
) $(LIBS
) $(CTLOBJS
)
111 cd ..
&& $(OCAMLBUILD
) python
/python.cma
113 cd ..
&& $(OCAMLBUILD
) python
/python.cmxa
115 cd ..
&& $(OCAMLBUILD
) -clean
119 rm -f
$(OPTLIB
) $(LIB
:.cma
=.a
)
124 rm -f coccipython.cmxa coccipython.a
127 $(MAKE
) -C coccilib
$@
129 rm -f
*.cm
[ioxa
] *.o
*.annot
131 ##############################################################################
132 # Generic ocaml rules
133 ##############################################################################
136 .SUFFIXES
: .ml .mli .cmo .cmi .cmx
145 $(OCAMLOPT_CMD
) -c
$<
148 # clean rule for others files
150 rm -f
*.cm
[iox
] *.o
*.annot
155 $(OCAMLDEP_CMD
) *.mli
*.ml
> .depend
157 ifneq ($(MAKECMDGOALS
),clean)
158 ifneq ($(MAKECMDGOALS
),distclean)
159 ifneq ($(FEATURE_OCAMLBUILD
),yes
)
165 include ..
/Makefile.common