Commit | Line | Data |
---|---|---|
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 | ||
34e49164 C |
25 | ############################################################################# |
26 | # Configuration section | |
27 | ############################################################################# | |
28 | -include ../Makefile.config | |
29 | ||
30 | ############################################################################## | |
31 | # Variables | |
32 | ############################################################################## | |
33 | TARGET=coccipython | |
34 | ||
17ba0788 | 35 | SOURCES= pycocci_aux.ml $(PYCOCCI_FILE) pycocci.ml |
34e49164 | 36 | |
413ffc02 C |
37 | INCLUDEDIRS_LOCAL = ../commons ../commons/ocamlextra ../globals \ |
38 | ../parsing_c ../parsing_cocci | |
39 | ||
90aeb998 | 40 | ifeq ("$(PYCAMLDIR)", "pycaml") |
413ffc02 C |
41 | INCLUDEDIRS_LOCAL += ../$(PYCAMLDIR) |
42 | INCLUDEDIRS = $(INCLUDEDIRS_LOCAL) | |
90aeb998 | 43 | else |
413ffc02 | 44 | INCLUDEDIRS = $(INCLUDEDIRS_LOCAL) $(PYCAMLDIR) |
90aeb998 | 45 | endif |
34e49164 | 46 | |
90aeb998 | 47 | SYSLIBS = str.cma unix.cma pycaml.cma |
b1b2de81 | 48 | LIBS=../commons/commons.cma ../globals/globals.cma |
34e49164 | 49 | |
34e49164 C |
50 | ############################################################################## |
51 | # Generic variables | |
52 | ############################################################################## | |
53 | ||
54 | INCLUDES=$(INCLUDEDIRS:%=-I %) $(INCLUDESEXTRA) | |
413ffc02 | 55 | INCLUDES_DEPEND=$(INCLUDEDIRS_LOCAL:%=-I %) $(INCLUDESEXTRA) |
34e49164 C |
56 | |
57 | ############################################################################## | |
58 | # Generic ocaml variables | |
59 | ############################################################################## | |
60 | ||
61 | # The Caml compilers. | |
62 | OCAMLCFLAGS ?= -g -dtypes | |
63 | OCAMLC =ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) | |
64 | OCAMLOPT = ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) | |
413ffc02 | 65 | OCAMLDEP = ocamldep$(OPTBIN) $(INCLUDES_DEPEND) |
34e49164 C |
66 | |
67 | ||
68 | ############################################################################## | |
69 | # Top rules | |
70 | ############################################################################## | |
71 | ||
72 | EXEC=$(TARGET).byte | |
73 | LIB=$(TARGET).cma | |
74 | OPTLIB=$(LIB:.cma=.cmxa) | |
75 | ||
76 | CTLEXEC=$(CTLTARGET) | |
77 | ||
78 | OBJS = $(SOURCES:.ml=.cmo) | |
79 | OPTOBJS = $(OBJS:.cmo=.cmx) | |
80 | ||
81 | CTLOBJS = $(CTLSOURCES:.ml=.cmo) | |
82 | CTLOPTOBJS = $(CTLOBJS:.cmo=.cmx) | |
83 | ||
84 | ||
85 | #all: $(EXEC) $(LIB) | |
86 | all: $(LIB) | |
87 | ||
88 | all.opt: $(OPTLIB) | |
89 | ||
90 | ctl: $(CTLEXEC) | |
91 | ||
92 | ||
93 | $(LIB): $(OBJS) | |
94 | $(OCAMLC) -a -o $(LIB) $(OBJS) | |
95 | ||
96 | clean:: | |
97 | rm -f $(LIB) | |
98 | ||
99 | ||
b1b2de81 | 100 | $(OPTLIB): $(OPTOBJS) |
34e49164 C |
101 | $(OCAMLOPT) -a -o $(OPTLIB) $(OPTOBJS) |
102 | ||
103 | ||
104 | $(EXEC): $(OBJS) main.cmo $(LIBS) | |
105 | $(OCAMLC) -o $(EXEC) $(SYSLIBS) $(LIBS) $(OBJS) main.cmo | |
106 | ||
107 | $(CTLEXEC): $(CTLOBJS) $(LIBS) | |
108 | $(OCAMLC) -o $(CTLEXEC) $(SYSLIBS) $(LIBS) $(CTLOBJS) | |
109 | ||
110 | ||
111 | clean:: | |
b1b2de81 | 112 | rm -f $(OPTLIB) $(LIB:.cma=.a) |
c491d8ee C |
113 | rm -f $(TARGET) |
114 | rm -f $(TARGET).byte | |
34e49164 C |
115 | rm -f $(CTLTARGET) |
116 | ||
c491d8ee C |
117 | distclean:: |
118 | $(MAKE) -C coccilib $@ | |
119 | rm -f .depend | |
120 | rm -f pycocci.ml | |
34e49164 C |
121 | |
122 | ############################################################################## | |
123 | # Generic ocaml rules | |
124 | ############################################################################## | |
125 | ||
126 | .SUFFIXES: | |
127 | .SUFFIXES: .ml .mli .cmo .cmi .cmx | |
128 | ||
129 | .ml.cmo: | |
130 | $(OCAMLC) -c $< | |
131 | ||
132 | .mli.cmi: | |
133 | $(OCAMLC) -c $< | |
134 | ||
135 | .ml.cmx: | |
136 | $(OCAMLOPT) -c $< | |
137 | ||
138 | ||
139 | # clean rule for others files | |
140 | clean:: | |
141 | rm -f *.cm[iox] *.o *.annot | |
b1b2de81 C |
142 | rm -f *~ .*~ #*# |
143 | ||
34e49164 C |
144 | beforedepend: |
145 | ||
146 | depend: beforedepend | |
147 | $(OCAMLDEP) *.mli *.ml > .depend | |
148 | ||
b1b2de81 | 149 | .depend: |
34e49164 C |
150 | $(OCAMLDEP) *.mli *.ml > .depend |
151 | ||
152 | -include .depend |