Coccinelle release 1.0.0-rc13
[bpt/coccinelle.git] / globals / Makefile
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.
8 #
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.
12 #
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.
17 #
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/>.
20 #
21 # The authors reserve the right to distribute this or future versions of
22 # Coccinelle under other licenses.
23
24
25 ifneq ($(MAKECMDGOALS),distclean)
26 include ../Makefile.config
27 endif
28
29 ##############################################################################
30 # Variables
31 ##############################################################################
32 TARGET=globals
33
34 OCAMLCFLAGS ?= -g -dtypes
35 OPTFLAGS ?= -g
36
37 SRC=config.ml flag.ml iteration.ml $(REGEXP_FILE) regexp.ml
38
39 LIBS=
40 INCLUDEDIRS= ../commons $(PCREDIR)
41
42 ##############################################################################
43 # Generic variables
44 ##############################################################################
45
46 INCLUDES=$(INCLUDEDIRS:%=-I %)
47 OCAMLC_CMD=$(OCAMLC) -thread $(OCAMLCFLAGS) $(INCLUDES)
48 OCAMLOPT_CMD=$(OCAMLOPT) -thread $(OPTFLAGS) $(INCLUDES)
49 OCAMLDEP_CMD=$(OCAMLDEP) $(INCLUDES)
50 OCAMLMKTOP_CMD=$(OCAMLMKTOP) -g -custom $(INCLUDES)
51
52 OBJS= $(SRC:.ml=.cmo)
53 OPTOBJS= $(SRC:.ml=.cmx)
54
55 ##############################################################################
56 # Top rules
57 ##############################################################################
58 all: $(TARGET).cma
59
60 all.opt:
61 @$(MAKE) $(TARGET).cmxa BUILD_OPT=yes
62
63 $(TARGET).cma: $(LIBS) $(OBJS)
64 $(OCAMLC_CMD) -a -o $(TARGET).cma $(OBJS)
65
66 $(TARGET).cmxa: $(LIBS:.cma=.cmxa) $(OPTOBJS)
67 $(OCAMLOPT_CMD) -a -o $(TARGET).cmxa $(OPTOBJS)
68
69 ##############################################################################
70 # Developer rules
71 ##############################################################################
72 .SUFFIXES: .ml .mli .cmo .cmi .cmx
73
74 .ml.cmo:
75 $(OCAMLC_CMD) -c $<
76 .mli.cmi:
77 $(OCAMLC_CMD) -c $<
78 .ml.cmx:
79 $(OCAMLOPT_CMD) -c $<
80
81 .ml.mldepend:
82 $(OCAMLC_CMD) -i $<
83
84 clean:
85 rm -f *.cm[ioxa] *.o *.a *.cmxa *.annot
86 rm -f *~ .*~ gmon.out #*#
87 rm -f .depend
88
89 distclean: clean
90
91 .PHONEY: depend
92 .depend depend:
93 $(OCAMLDEP_CMD) *.mli *.ml > .depend
94
95 ifneq ($(MAKECMDGOALS),clean)
96 ifneq ($(MAKECMDGOALS),distclean)
97 -include .depend
98 endif
99 endif
100
101 include ../Makefile.common