Version 1.0.0-rc17 has been released. Some changes are:
[bpt/coccinelle.git] / popl09 / Makefile
CommitLineData
17ba0788
C
1# Copyright 2012, INRIA
2# Julia Lawall, Gilles Muller
3# Copyright 2010-2011, INRIA, University of Copenhagen
f537ebc4
C
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
951c7801
C
25#note: if you add a file (a .mli or .ml), dont forget to do a make depend
26
feec80c3
C
27ifneq ($(MAKECMDGOALS),distclean)
28include ../Makefile.config
29endif
30
951c7801
C
31TARGET = popl
32
755320b0
C
33OCAMLCFLAGS ?= -g
34OPTFLAGS ?= -g
d6ce1786 35
951c7801
C
36SRC = ast_popl.ml asttopopl.ml insert_quantifiers.ml \
37pretty_print_popl.ml flag_popl.ml popltoctl.ml popl.ml
38
39SYSLIBS=str.cma unix.cma
40LIBS=../commons/commons.cma ../globals/globals.cma
41
42INCLUDES = -I ../commons -I ../globals \
43 -I ../ctl -I ../parsing_cocci -I ../parsing_c -I ../engine
44
45#The Caml compilers.
46#for warning: -w A
47#for profiling: -p -inline 0 with OCAMLOPT
755320b0
C
48OCAMLC_CMD=$(OCAMLC) $(OCAMLCFLAGS) $(INCLUDES)
49OCAMLOPT_CMD=$(OCAMLOPT) $(OPTFLAGS) $(INCLUDES)
feec80c3
C
50OCAMLDEP_CMD=$(OCAMLDEP) $(INCLUDES)
51OCAMLMKTOP_CMD=$(OCAMLMKTOP) -g -custom $(INCLUDES)
951c7801
C
52
53LIB=$(TARGET).cma
54OPTLIB=$(LIB:.cma=.cmxa)
55
56OBJS = $(SRC:.ml=.cmo)
57OPTOBJS = $(SRC:.ml=.cmx)
58
abad11c5 59ifneq ($(FEATURE_OCAMLBUILD),yes)
951c7801 60all: $(LIB)
d6ce1786
C
61all.opt:
62 @$(MAKE) $(OPTLIB) BUILD_OPT=yes
951c7801
C
63
64$(TARGET).top: $(LIB)
feec80c3 65 $(OCAMLMKTOP_CMD) -o $(TARGET).top $(SYSLIBS) $(LIBS) $(OBJS)
951c7801
C
66
67$(LIB): $(OBJS)
feec80c3 68 $(OCAMLC_CMD) -a -o $(LIB) $(OBJS)
951c7801
C
69
70clean::
71 rm -f $(LIB) $(TARGET).top
abad11c5
C
72else
73all:
74 cd .. && $(OCAMLBUILD) popl09/popl09.cma
75
76all.opt:
77 cd .. && $(OCAMLBUILD) popl09/popl09.cmxa
78
79clean::
80 cd .. && $(OCAMLBUILD) -clean
81endif
951c7801
C
82
83
84$(OPTLIB): $(OPTOBJS)
feec80c3 85 $(OCAMLOPT_CMD) -a -o $(OPTLIB) $(OPTOBJS)
951c7801
C
86
87# clean rule for LIB.opt
88clean::
89 rm -f $(OPTLIB) $(LIB:.cma=.a)
90
91
92.SUFFIXES:
93.SUFFIXES: .ml .mli .cmo .cmi .cmx
94
95.ml.cmo:
feec80c3 96 $(OCAMLC_CMD) -c $<
951c7801
C
97
98.mli.cmi:
feec80c3 99 $(OCAMLC_CMD) -c $<
951c7801
C
100
101.ml.cmx:
feec80c3 102 $(OCAMLOPT_CMD) -c $<
951c7801
C
103
104
105# clean rule for others files
106clean::
107 rm -f *.cm[iox] *.o *.annot
108 rm -f *~ .*~ #*#
951c7801
C
109 rm -f .depend
110
feec80c3
C
111distclean: clean
112
113.PHONEY: depend
114.depend depend:
115 $(OCAMLDEP_CMD) *.mli *.ml > .depend
951c7801 116
feec80c3
C
117ifneq ($(MAKECMDGOALS),clean)
118ifneq ($(MAKECMDGOALS),distclean)
abad11c5 119ifneq ($(FEATURE_OCAMLBUILD),yes)
951c7801 120-include .depend
feec80c3
C
121endif
122endif
abad11c5 123endif
d6ce1786
C
124
125include ../Makefile.common