Commit | Line | Data |
---|---|---|
c491d8ee C |
1 | # Copyright 2010, INRIA, University of Copenhagen |
2 | # Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix | |
3 | # Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen | |
4 | # Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix | |
5 | # This file is part of Coccinelle. | |
6 | # | |
7 | # Coccinelle is free software: you can redistribute it and/or modify | |
8 | # it under the terms of the GNU General Public License as published by | |
9 | # the Free Software Foundation, according to version 2 of the License. | |
10 | # | |
11 | # Coccinelle is distributed in the hope that it will be useful, | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | # GNU General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with Coccinelle. If not, see <http://www.gnu.org/licenses/>. | |
18 | # | |
19 | # The authors reserve the right to distribute this or future versions of | |
20 | # Coccinelle under other licenses. | |
21 | ||
22 | ||
34e49164 C |
23 | ############################################################################# |
24 | # Configuration section | |
25 | ############################################################################# | |
26 | -include ../Makefile.config | |
27 | ||
28 | ############################################################################## | |
29 | # Variables | |
30 | ############################################################################## | |
31 | TARGET=coccipython | |
32 | ||
b1b2de81 | 33 | SOURCES= pycocci_aux.ml pycocci.ml |
34e49164 | 34 | |
413ffc02 C |
35 | INCLUDEDIRS_LOCAL = ../commons ../commons/ocamlextra ../globals \ |
36 | ../parsing_c ../parsing_cocci | |
37 | ||
90aeb998 | 38 | ifeq ("$(PYCAMLDIR)", "pycaml") |
413ffc02 C |
39 | INCLUDEDIRS_LOCAL += ../$(PYCAMLDIR) |
40 | INCLUDEDIRS = $(INCLUDEDIRS_LOCAL) | |
90aeb998 | 41 | else |
413ffc02 | 42 | INCLUDEDIRS = $(INCLUDEDIRS_LOCAL) $(PYCAMLDIR) |
90aeb998 | 43 | endif |
34e49164 | 44 | |
90aeb998 | 45 | SYSLIBS = str.cma unix.cma pycaml.cma |
b1b2de81 | 46 | LIBS=../commons/commons.cma ../globals/globals.cma |
34e49164 | 47 | |
34e49164 C |
48 | ############################################################################## |
49 | # Generic variables | |
50 | ############################################################################## | |
51 | ||
52 | INCLUDES=$(INCLUDEDIRS:%=-I %) $(INCLUDESEXTRA) | |
413ffc02 | 53 | INCLUDES_DEPEND=$(INCLUDEDIRS_LOCAL:%=-I %) $(INCLUDESEXTRA) |
34e49164 C |
54 | |
55 | ############################################################################## | |
56 | # Generic ocaml variables | |
57 | ############################################################################## | |
58 | ||
59 | # The Caml compilers. | |
60 | OCAMLCFLAGS ?= -g -dtypes | |
61 | OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) | |
62 | OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) | |
413ffc02 | 63 | OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES_DEPEND) |
34e49164 C |
64 | |
65 | ||
66 | ############################################################################## | |
67 | # Top rules | |
68 | ############################################################################## | |
69 | ||
70 | EXEC=$(TARGET).byte | |
71 | LIB=$(TARGET).cma | |
72 | OPTLIB=$(LIB:.cma=.cmxa) | |
73 | ||
74 | CTLEXEC=$(CTLTARGET) | |
75 | ||
76 | OBJS = $(SOURCES:.ml=.cmo) | |
77 | OPTOBJS = $(OBJS:.cmo=.cmx) | |
78 | ||
79 | CTLOBJS = $(CTLSOURCES:.ml=.cmo) | |
80 | CTLOPTOBJS = $(CTLOBJS:.cmo=.cmx) | |
81 | ||
82 | ||
83 | #all: $(EXEC) $(LIB) | |
84 | all: $(LIB) | |
85 | ||
86 | all.opt: $(OPTLIB) | |
87 | ||
88 | ctl: $(CTLEXEC) | |
89 | ||
90 | ||
91 | $(LIB): $(OBJS) | |
92 | $(OCAMLC) -a -o $(LIB) $(OBJS) | |
93 | ||
94 | clean:: | |
95 | rm -f $(LIB) | |
96 | ||
97 | ||
b1b2de81 | 98 | $(OPTLIB): $(OPTOBJS) |
34e49164 C |
99 | $(OCAMLOPT) -a -o $(OPTLIB) $(OPTOBJS) |
100 | ||
101 | ||
102 | $(EXEC): $(OBJS) main.cmo $(LIBS) | |
103 | $(OCAMLC) -o $(EXEC) $(SYSLIBS) $(LIBS) $(OBJS) main.cmo | |
104 | ||
105 | $(CTLEXEC): $(CTLOBJS) $(LIBS) | |
106 | $(OCAMLC) -o $(CTLEXEC) $(SYSLIBS) $(LIBS) $(CTLOBJS) | |
107 | ||
108 | ||
109 | clean:: | |
b1b2de81 | 110 | rm -f $(OPTLIB) $(LIB:.cma=.a) |
c491d8ee C |
111 | rm -f $(TARGET) |
112 | rm -f $(TARGET).byte | |
34e49164 C |
113 | rm -f $(CTLTARGET) |
114 | ||
c491d8ee C |
115 | distclean:: |
116 | $(MAKE) -C coccilib $@ | |
117 | rm -f .depend | |
118 | rm -f pycocci.ml | |
34e49164 C |
119 | |
120 | ############################################################################## | |
121 | # Generic ocaml rules | |
122 | ############################################################################## | |
123 | ||
124 | .SUFFIXES: | |
125 | .SUFFIXES: .ml .mli .cmo .cmi .cmx | |
126 | ||
127 | .ml.cmo: | |
128 | $(OCAMLC) -c $< | |
129 | ||
130 | .mli.cmi: | |
131 | $(OCAMLC) -c $< | |
132 | ||
133 | .ml.cmx: | |
134 | $(OCAMLOPT) -c $< | |
135 | ||
136 | ||
137 | # clean rule for others files | |
138 | clean:: | |
139 | rm -f *.cm[iox] *.o *.annot | |
b1b2de81 C |
140 | rm -f *~ .*~ #*# |
141 | ||
34e49164 C |
142 | beforedepend: |
143 | ||
144 | depend: beforedepend | |
145 | $(OCAMLDEP) *.mli *.ml > .depend | |
146 | ||
b1b2de81 | 147 | .depend: |
34e49164 C |
148 | $(OCAMLDEP) *.mli *.ml > .depend |
149 | ||
150 | -include .depend |