Commit | Line | Data |
---|---|---|
951c7801 | 1 | |
34e49164 C |
2 | ############################################################################# |
3 | # Configuration section | |
4 | ############################################################################# | |
5 | ||
6 | -include Makefile.config | |
c3e37e97 | 7 | -include /etc/lsb-release |
34e49164 | 8 | |
b1b2de81 | 9 | VERSION=$(shell cat globals/config.ml.in |grep version |perl -p -e 's/.*"(.*)".*/$$1/;') |
951c7801 | 10 | CCVERSION=$(shell cat scripts/coccicheck/README |grep "Coccicheck version" |perl -p -e 's/.*version (.*)[ ]*/$$1/;') |
c3e37e97 C |
11 | PKGVERSION=$(shell dpkg-parsechangelog -ldebian/changelog.$(DISTRIB_CODENAME) 2> /dev/null \ |
12 | | sed -n 's/^Version: \(.*\)/\1/p' ) | |
34e49164 C |
13 | |
14 | ############################################################################## | |
15 | # Variables | |
16 | ############################################################################## | |
17 | TARGET=spatch | |
c3e37e97 | 18 | PRJNAME=coccinelle |
34e49164 C |
19 | |
20 | SRC=flag_cocci.ml cocci.ml testing.ml test.ml main.ml | |
21 | ||
34e49164 | 22 | ifeq ($(FEATURE_PYTHON),1) |
90aeb998 | 23 | PYCMA=pycaml.cma |
b1b2de81 | 24 | # the following is essential for Coccinelle to compile under gentoo (weird) |
90aeb998 | 25 | #OPTLIBFLAGS=-cclib dllpycaml_stubs.so |
34e49164 C |
26 | else |
27 | PYCMA= | |
90aeb998 | 28 | endif |
34e49164 | 29 | OPTLIBFLAGS= |
90aeb998 C |
30 | |
31 | ifeq ("$(SEXPDIR)","ocamlsexp") | |
32 | SEXPLIB=sexplib.cmo | |
33 | OPTSEXPLIB=sexplib.cmx | |
34 | else | |
35 | SEXPLIB=sexplib.cma | |
36 | OPTSEXPLIB=sexplib.cmxa | |
34e49164 C |
37 | endif |
38 | ||
88e71198 C |
39 | ifeq ("$(DYNLINK)","no") |
40 | DYNLINK= | |
41 | else | |
42 | DYNLINK=dynlink.cma | |
43 | endif | |
44 | ||
b1b2de81 | 45 | SEXPSYSCMA=bigarray.cma nums.cma |
34e49164 | 46 | |
88e71198 | 47 | SYSLIBS=str.cma unix.cma $(SEXPSYSCMA) $(PYCMA) $(DYNLINK) # threads.cma |
b1b2de81 | 48 | LIBS=commons/commons.cma \ |
90aeb998 | 49 | commons/commons_sexp.cma \ |
b1b2de81 | 50 | globals/globals.cma \ |
34e49164 C |
51 | ctl/ctl.cma \ |
52 | parsing_cocci/cocci_parser.cma parsing_c/parsing_c.cma \ | |
951c7801 | 53 | engine/cocciengine.cma popl09/popl.cma \ |
174d1640 | 54 | extra/extra.cma python/coccipython.cma ocaml/cocciocaml.cma |
90aeb998 C |
55 | |
56 | # Should we use the local version of pycaml | |
b23ff9c7 | 57 | ifeq ($(FEATURE_PYTHON),1) |
90aeb998 C |
58 | ifeq ("$(PYCAMLDIR)","pycaml") |
59 | LOCALPYCAML=pycaml | |
60 | else | |
61 | LOCALPYCAML= | |
62 | endif | |
b23ff9c7 | 63 | endif |
90aeb998 C |
64 | |
65 | # Should we use the local version of menhirLib | |
174d1640 C |
66 | ifeq ("$(MENHIRDIR)","menhirlib") |
67 | LOCALMENHIR=menhirlib | |
90aeb998 C |
68 | else |
69 | LOCALMENHIR= | |
70 | endif | |
71 | ||
72 | # Should we use the local version of ocamlsexp | |
73 | ifeq ("$(SEXPDIR)","ocamlsexp") | |
74 | LOCALSEXP=ocamlsexp | |
75 | else | |
76 | LOCALSEXP= | |
77 | endif | |
34e49164 | 78 | |
174d1640 | 79 | # used for depend: and a little for rec & rec.opt |
90aeb998 C |
80 | MAKESUBDIRS=$(LOCALPYCAML) $(LOCALSEXP) commons \ |
81 | globals $(LOCALMENHIR) ctl parsing_cocci parsing_c \ | |
174d1640 C |
82 | engine popl09 extra python ocaml |
83 | ||
84 | # used for clean: | |
85 | # It is like MAKESUBDIRS but also | |
86 | # force cleaning of local library copies | |
87 | CLEANSUBDIRS=pycaml ocamlsexp commons \ | |
88 | globals menhirlib ctl parsing_cocci parsing_c \ | |
89 | engine popl09 extra python ocaml | |
90aeb998 C |
90 | |
91 | INCLUDEDIRSDEP=commons commons/ocamlextra $(LOCALSEXP) \ | |
92 | globals $(LOCALMENHIR) $(LOCALPYCAML) ctl \ | |
174d1640 | 93 | parsing_cocci parsing_c engine popl09 extra python ocaml |
34e49164 | 94 | |
90aeb998 C |
95 | INCLUDEDIRS=$(INCLUDEDIRSDEP) $(SEXPDIR) $(MENHIRDIR) $(PYCAMLDIR) |
96 | ||
34e49164 C |
97 | ############################################################################## |
98 | # Generic variables | |
99 | ############################################################################## | |
100 | ||
101 | INCLUDES=$(INCLUDEDIRS:%=-I %) | |
102 | ||
103 | OBJS= $(SRC:.ml=.cmo) | |
104 | OPTOBJS= $(SRC:.ml=.cmx) | |
105 | ||
106 | EXEC=$(TARGET) | |
107 | ||
108 | ############################################################################## | |
109 | # Generic ocaml variables | |
110 | ############################################################################## | |
111 | ||
ae4735db | 112 | OCAMLCFLAGS= |
34e49164 C |
113 | |
114 | # for profiling add -p -inline 0 | |
115 | # but 'make forprofiling' below does that for you. | |
116 | # This flag is also used in subdirectories so don't change its name here. | |
708f4980 | 117 | # To enable backtrace support for native code, you need to put -g in OPTFLAGS |
c491d8ee C |
118 | # to also link with -g. |
119 | OPTFLAGS= -g | |
34e49164 | 120 | |
34e49164 | 121 | OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS) $(INCLUDES) |
faf9a90c | 122 | OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES) |
34e49164 C |
123 | OCAMLLEX=ocamllex #-ml # -ml for debugging lexer, but slightly slower |
124 | OCAMLYACC=ocamlyacc -v | |
90aeb998 | 125 | OCAMLDEP=ocamldep $(INCLUDEDIRSDEP:%=-I %) |
34e49164 C |
126 | OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES) |
127 | ||
128 | # can also be set via 'make static' | |
6756e19d C |
129 | CFLAGS=-pie -fPIE -fpic -fPIC -static |
130 | STATICCFLAGS=$(CFLAGS:%=-ccopt %) | |
131 | STATIC= # $(STATICCFLAGS) | |
34e49164 C |
132 | |
133 | # can also be unset via 'make purebytecode' | |
134 | BYTECODE_STATIC=-custom | |
135 | ||
136 | ############################################################################## | |
137 | # Top rules | |
138 | ############################################################################## | |
b1b2de81 C |
139 | .PHONY:: all all.opt byte opt top clean distclean configure |
140 | .PHONY:: $(MAKESUBDIRS) $(MAKESUBDIRS:%=%.opt) subdirs subdirs.opt | |
141 | ||
708f4980 | 142 | all: Makefile.config byte preinstall |
b1b2de81 C |
143 | |
144 | opt: all.opt | |
708f4980 | 145 | all.opt: opt-compil preinstall |
faf9a90c | 146 | |
708f4980 | 147 | world: preinstall |
b1b2de81 | 148 | $(MAKE) byte |
708f4980 | 149 | $(MAKE) opt-compil |
b1b2de81 C |
150 | |
151 | byte: .depend | |
faf9a90c C |
152 | $(MAKE) subdirs |
153 | $(MAKE) $(EXEC) | |
154 | ||
b1b2de81 | 155 | opt-compil: .depend |
faf9a90c C |
156 | $(MAKE) subdirs.opt |
157 | $(MAKE) $(EXEC).opt | |
158 | ||
485bce71 | 159 | top: $(EXEC).top |
34e49164 | 160 | |
0708f913 | 161 | subdirs: |
b1b2de81 | 162 | +for D in $(MAKESUBDIRS); do $(MAKE) $$D || exit 1 ; done |
90aeb998 | 163 | $(MAKE) -C commons sexp OCAMLCFLAGS="$(OCAMLCFLAGS)" |
0708f913 C |
164 | |
165 | subdirs.opt: | |
b1b2de81 | 166 | +for D in $(MAKESUBDIRS); do $(MAKE) $$D.opt || exit 1 ; done |
aba5c457 | 167 | $(MAKE) -C commons sexp.opt OPTFLAGS="$(OPTFLAGS)" |
faf9a90c C |
168 | |
169 | $(MAKESUBDIRS): | |
170 | $(MAKE) -C $@ OCAMLCFLAGS="$(OCAMLCFLAGS)" all | |
171 | ||
172 | $(MAKESUBDIRS:%=%.opt): | |
aba5c457 | 173 | $(MAKE) -C $(@:%.opt=%) OPTFLAGS="$(OPTFLAGS)" all.opt |
faf9a90c | 174 | |
b1b2de81 | 175 | #dependencies: |
0708f913 C |
176 | # commons: |
177 | # globals: | |
178 | # menhirlib: | |
179 | # parsing_cocci: commons globals menhirlib | |
180 | # parsing_c:parsing_cocci | |
181 | # ctl:globals commons | |
182 | # engine: parsing_cocci parsing_c ctl | |
951c7801 | 183 | # popl09:engine |
0708f913 C |
184 | # extra: parsing_cocci parsing_c ctl |
185 | # pycaml: | |
186 | # python:pycaml parsing_cocci parsing_c | |
faf9a90c | 187 | |
34e49164 | 188 | clean:: |
174d1640 | 189 | set -e; for i in $(CLEANSUBDIRS); do $(MAKE) -C $$i $@; done |
c3e37e97 | 190 | $(MAKE) -C demos/spp $@ |
34e49164 | 191 | |
0708f913 C |
192 | $(LIBS): $(MAKESUBDIRS) |
193 | $(LIBS:.cma=.cmxa): $(MAKESUBDIRS:%=%.opt) | |
faf9a90c C |
194 | |
195 | $(OBJS):$(LIBS) | |
196 | $(OPTOBJS):$(LIBS:.cma=.cmxa) | |
197 | ||
34e49164 | 198 | $(EXEC): $(LIBS) $(OBJS) |
90aeb998 | 199 | $(OCAMLC) $(BYTECODE_STATIC) -o $@ $(SYSLIBS) $(SEXPLIB) $^ |
34e49164 | 200 | |
faf9a90c | 201 | $(EXEC).opt: $(LIBS:.cma=.cmxa) $(OPTOBJS) |
90aeb998 | 202 | $(OCAMLOPT) $(STATIC) -o $@ $(SYSLIBS:.cma=.cmxa) $(OPTSEXPLIB) $(OPTLIBFLAGS) $^ |
34e49164 | 203 | |
faf9a90c | 204 | $(EXEC).top: $(LIBS) $(OBJS) |
90aeb998 | 205 | $(OCAMLMKTOP) -custom -o $@ $(SYSLIBS) $(SEXPLIB) $^ |
34e49164 C |
206 | |
207 | clean:: | |
208 | rm -f $(TARGET) $(TARGET).opt $(TARGET).top | |
34e49164 | 209 | |
b1b2de81 C |
210 | .PHONY:: tools configure |
211 | ||
212 | configure: | |
213 | ./configure | |
34e49164 | 214 | |
7f004419 | 215 | Makefile.config: |
708f4980 C |
216 | @echo "Makefile.config is missing. Have you run ./configure?" |
217 | @exit 1 | |
218 | ||
c491d8ee | 219 | tools: $(LIBS) |
34e49164 | 220 | $(MAKE) -C tools |
b1b2de81 | 221 | |
c491d8ee C |
222 | distclean:: |
223 | if [ -d tools ] ; then $(MAKE) -C tools distclean ; fi | |
34e49164 | 224 | |
34e49164 C |
225 | static: |
226 | rm -f spatch.opt spatch | |
6756e19d | 227 | $(MAKE) STATIC="$(STATICCFLAGS)" spatch.opt |
34e49164 C |
228 | cp spatch.opt spatch |
229 | ||
230 | purebytecode: | |
231 | rm -f spatch.opt spatch | |
232 | $(MAKE) BYTECODE_STATIC="" spatch | |
fc1ad971 | 233 | perl -p -i -e 's/^#!.*/#!\/usr\/bin\/ocamlrun/' spatch |
34e49164 C |
234 | |
235 | ||
b1b2de81 C |
236 | ############################################################################## |
237 | # Build documentation | |
238 | ############################################################################## | |
239 | .PHONY:: docs | |
240 | ||
241 | docs: | |
242 | make -C docs | |
243 | ||
244 | clean:: | |
245 | make -C docs clean | |
246 | ||
247 | distclean:: | |
248 | make -C docs distclean | |
249 | ||
250 | ############################################################################## | |
251 | # Pre-Install (customization of spatch frontend script) | |
252 | ############################################################################## | |
b1b2de81 | 253 | |
90aeb998 C |
254 | preinstall: docs/spatch.1 scripts/spatch scripts/spatch.opt scripts/spatch.byte |
255 | ||
256 | docs/spatch.1: Makefile.config | |
257 | $(MAKE) -C docs spatch.1 | |
b1b2de81 C |
258 | |
259 | # user will use spatch to run spatch.opt (native) | |
5636bb2c | 260 | scripts/spatch: Makefile.config |
b1b2de81 C |
261 | cp scripts/spatch.sh scripts/spatch.tmp2 |
262 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.tmp2 > scripts/spatch.tmp | |
263 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.tmp > scripts/spatch | |
264 | rm -f scripts/spatch.tmp2 scripts/spatch.tmp | |
265 | ||
266 | # user will use spatch to run spatch (bytecode) | |
5636bb2c | 267 | scripts/spatch.byte: Makefile.config |
708f4980 C |
268 | cp scripts/spatch.sh scripts/spatch.byte.tmp3 |
269 | sed "s|\.opt||" scripts/spatch.byte.tmp3 > scripts/spatch.byte.tmp2 | |
270 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.byte.tmp2 \ | |
271 | > scripts/spatch.byte.tmp | |
272 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.byte.tmp \ | |
273 | > scripts/spatch.byte | |
274 | rm -f scripts/spatch.byte.tmp3 \ | |
275 | scripts/spatch.byte.tmp2 \ | |
276 | scripts/spatch.byte.tmp | |
b1b2de81 C |
277 | |
278 | # user will use spatch.opt to run spatch.opt (native) | |
5636bb2c | 279 | scripts/spatch.opt: Makefile.config |
b1b2de81 | 280 | cp scripts/spatch.sh scripts/spatch.opt.tmp2 |
708f4980 C |
281 | sed "s|SHAREDIR|$(SHAREDIR)|g" scripts/spatch.opt.tmp2 \ |
282 | > scripts/spatch.opt.tmp | |
283 | sed "s|LIBDIR|$(LIBDIR)|g" scripts/spatch.opt.tmp \ | |
284 | > scripts/spatch.opt | |
b1b2de81 C |
285 | rm -f scripts/spatch.opt.tmp scripts/spatch.opt.tmp2 |
286 | ||
287 | clean:: | |
288 | rm -f scripts/spatch scripts/spatch.byte scripts/spatch.opt | |
289 | ||
34e49164 C |
290 | ############################################################################## |
291 | # Install | |
292 | ############################################################################## | |
293 | ||
294 | # don't remove DESTDIR, it can be set by package build system like ebuild | |
8ba84ae2 | 295 | # for staged installation. |
0708f913 | 296 | install-common: |
34e49164 C |
297 | mkdir -p $(DESTDIR)$(BINDIR) |
298 | mkdir -p $(DESTDIR)$(LIBDIR) | |
174d1640 | 299 | mkdir -p $(DESTDIR)$(SHAREDIR)/ocaml |
413ffc02 | 300 | mkdir -p $(DESTDIR)$(SHAREDIR)/commons |
ca417fcf | 301 | mkdir -p $(DESTDIR)$(SHAREDIR)/globals |
413ffc02 | 302 | mkdir -p $(DESTDIR)$(SHAREDIR)/parsing_c |
faf9a90c | 303 | mkdir -p $(DESTDIR)$(MANDIR)/man1 |
8ba84ae2 C |
304 | $(INSTALL_DATA) standard.h $(DESTDIR)$(SHAREDIR) |
305 | $(INSTALL_DATA) standard.iso $(DESTDIR)$(SHAREDIR) | |
174d1640 | 306 | $(INSTALL_DATA) ocaml/coccilib.cmi $(DESTDIR)$(SHAREDIR)/ocaml/ |
413ffc02 C |
307 | $(INSTALL_DATA) parsing_c/*.cmi $(DESTDIR)$(SHAREDIR)/parsing_c/ |
308 | $(INSTALL_DATA) commons/*.cmi $(DESTDIR)$(SHAREDIR)/commons/ | |
ca417fcf | 309 | $(INSTALL_DATA) globals/iteration.cmi $(DESTDIR)$(SHAREDIR)/globals/ |
8ba84ae2 C |
310 | $(INSTALL_DATA) docs/spatch.1 $(DESTDIR)$(MANDIR)/man1/ |
311 | @if [ $(FEATURE_PYTHON) -eq 1 ]; then $(MAKE) install-python; fi | |
174d1640 C |
312 | |
313 | install-bash: | |
314 | mkdir -p $(DESTDIR)$(BASH_COMPLETION_DIR) | |
315 | $(INSTALL_DATA) scripts/spatch.bash_completion \ | |
316 | $(DESTDIR)$(BASH_COMPLETION_DIR)/spatch | |
0708f913 | 317 | |
c491d8ee C |
318 | install-tools: |
319 | mkdir -p $(DESTDIR)$(BINDIR) | |
320 | $(INSTALL_PROGRAM) tools/splitpatch \ | |
321 | $(DESTDIR)$(BINDIR)/splitpatch | |
322 | $(INSTALL_PROGRAM) tools/cocci-send-email.perl \ | |
323 | $(DESTDIR)$(BINDIR)/cocci-send-email.perl | |
324 | ||
8ba84ae2 C |
325 | install-python: |
326 | mkdir -p $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
327 | $(INSTALL_DATA) python/coccilib/*.py \ | |
328 | $(DESTDIR)$(SHAREDIR)/python/coccilib | |
329 | $(INSTALL_DATA) python/coccilib/coccigui/*.py \ | |
330 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
b1b2de81 C |
331 | $(INSTALL_DATA) python/coccilib/coccigui/pygui.glade \ |
332 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
333 | $(INSTALL_DATA) python/coccilib/coccigui/pygui.gladep \ | |
334 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
90aeb998 C |
335 | if [ -f pycaml/dllpycaml_stubs.so ]; then \ |
336 | $(INSTALL_LIB) pycaml/dllpycaml_stubs.so $(DESTDIR)$(LIBDIR) ; fi | |
8ba84ae2 | 337 | |
951c7801 | 338 | install: install-common |
b1b2de81 C |
339 | @if test -x spatch -a ! -x spatch.opt ; then \ |
340 | $(MAKE) install-byte;fi | |
341 | @if test ! -x spatch -a -x spatch.opt ; then \ | |
342 | $(MAKE) install-def; $(MAKE) install-opt;fi | |
343 | @if test -x spatch -a -x spatch.opt ; then \ | |
344 | $(MAKE) install-byte; $(MAKE) install-opt;fi | |
345 | @if test ! -x spatch -a ! -x spatch.opt ; then \ | |
346 | echo "\n\n\t==> Run 'make', 'make opt', or both first. <==\n\n";fi | |
708f4980 C |
347 | @echo "" |
348 | @echo "\tYou can also install spatch by copying the program spatch" | |
349 | @echo "\t(available in this directory) anywhere you want and" | |
350 | @echo "\tgive it the right options to find its configuration files." | |
351 | @echo "" | |
b1b2de81 | 352 | |
0708f913 | 353 | # user will use spatch to run spatch.opt (native) |
708f4980 | 354 | install-def: |
8ba84ae2 | 355 | $(INSTALL_PROGRAM) spatch.opt $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 356 | $(INSTALL_PROGRAM) scripts/spatch $(DESTDIR)$(BINDIR)/spatch |
0708f913 C |
357 | |
358 | # user will use spatch to run spatch (bytecode) | |
708f4980 | 359 | install-byte: |
8ba84ae2 | 360 | $(INSTALL_PROGRAM) spatch $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 361 | $(INSTALL_PROGRAM) scripts/spatch.byte $(DESTDIR)$(BINDIR)/spatch |
0708f913 C |
362 | |
363 | # user will use spatch.opt to run spatch.opt (native) | |
708f4980 | 364 | install-opt: |
8ba84ae2 | 365 | $(INSTALL_PROGRAM) spatch.opt $(DESTDIR)$(SHAREDIR) |
b1b2de81 | 366 | $(INSTALL_PROGRAM) scripts/spatch.opt $(DESTDIR)$(BINDIR)/spatch.opt |
34e49164 C |
367 | |
368 | uninstall: | |
369 | rm -f $(DESTDIR)$(BINDIR)/spatch | |
8ba84ae2 | 370 | rm -f $(DESTDIR)$(BINDIR)/spatch.opt |
34e49164 | 371 | rm -f $(DESTDIR)$(LIBDIR)/dllpycaml_stubs.so |
90aeb998 C |
372 | rm -f $(DESTDIR)$(SHAREDIR)/spatch |
373 | rm -f $(DESTDIR)$(SHAREDIR)/spatch.opt | |
34e49164 C |
374 | rm -f $(DESTDIR)$(SHAREDIR)/standard.h |
375 | rm -f $(DESTDIR)$(SHAREDIR)/standard.iso | |
174d1640 | 376 | rm -f $(DESTDIR)$(SHAREDIR)/ocaml/coccilib.cmi |
413ffc02 | 377 | rm -f $(DESTDIR)$(SHAREDIR)/parsing_c/*.cmi |
ca417fcf C |
378 | rm -f $(DESTDIR)$(SHAREDIR)/commons/*.cmi |
379 | rm -f $(DESTDIR)$(SHAREDIR)/globals/*.cmi | |
90aeb998 C |
380 | rm -f $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui/* |
381 | rm -f $(DESTDIR)$(SHAREDIR)/python/coccilib/*.py | |
382 | rmdir --ignore-fail-on-non-empty -p \ | |
383 | $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui | |
ca417fcf C |
384 | rmdir $(DESTDIR)$(SHAREDIR)/globals |
385 | rmdir $(DESTDIR)$(SHAREDIR)/commons | |
386 | rmdir $(DESTDIR)$(SHAREDIR)/parsing_c | |
387 | rmdir $(DESTDIR)$(SHAREDIR)/ocaml | |
388 | rmdir $(DESTDIR)$(SHAREDIR) | |
faf9a90c | 389 | rm -f $(DESTDIR)$(MANDIR)/man1/spatch.1 |
34e49164 | 390 | |
aba5c457 C |
391 | uninstall-bash: |
392 | rm -f $(DESTDIR)$(BASH_COMPLETION_DIR)/spatch | |
393 | rmdir --ignore-fail-on-non-empty -p \ | |
394 | $(DESTDIR)$(BASH_COMPLETION_DIR) | |
395 | ||
c491d8ee C |
396 | uninstall-tools: |
397 | rm -f $(DESTDIR)$(BINDIR)/splitpatch | |
398 | rm -f $(DESTDIR)$(BINDIR)/cocci-send-email.perl | |
399 | ||
34e49164 | 400 | version: |
951c7801 | 401 | @echo "spatch $(VERSION)" |
c3e37e97 | 402 | @echo "spatch $(PKGVERSION) ($(DISTRIB_ID))" |
951c7801 | 403 | @echo "coccicheck $(CCVERSION)" |
34e49164 C |
404 | |
405 | ||
406 | ############################################################################## | |
5636bb2c | 407 | # Deb package (for Ubuntu) and release rules |
34e49164 C |
408 | ############################################################################## |
409 | ||
5636bb2c | 410 | include Makefile.release |
c3e37e97 | 411 | |
34e49164 C |
412 | ############################################################################## |
413 | # Developer rules | |
414 | ############################################################################## | |
415 | ||
7f004419 C |
416 | -include Makefile.dev |
417 | ||
34e49164 C |
418 | test: $(TARGET) |
419 | ./$(TARGET) -testall | |
420 | ||
421 | testparsing: | |
422 | ./$(TARGET) -D standard.h -parse_c -dir tests/ | |
423 | ||
424 | ||
425 | ||
faf9a90c C |
426 | # -inline 0 to see all the functions in the profile. |
427 | # Can also use the profile framework in commons/ and run your program | |
34e49164 C |
428 | # with -profile. |
429 | forprofiling: | |
430 | $(MAKE) OPTFLAGS="-p -inline 0 " opt | |
431 | ||
432 | clean:: | |
faf9a90c | 433 | rm -f gmon.out |
34e49164 C |
434 | |
435 | tags: | |
436 | otags -no-mli-tags -r . | |
437 | ||
438 | dependencygraph: | |
951c7801 | 439 | find -name "*.ml" |grep -v "scripts" | xargs ocamldep -I commons -I globals -I ctl -I parsing_cocci -I parsing_c -I engine -I popl09 -I extra > /tmp/dependfull.depend |
485bce71 | 440 | ocamldot -lr /tmp/dependfull.depend > /tmp/dependfull.dot |
34e49164 | 441 | dot -Tps /tmp/dependfull.dot > /tmp/dependfull.ps |
485bce71 | 442 | ps2pdf /tmp/dependfull.ps /tmp/dependfull.pdf |
34e49164 C |
443 | |
444 | ############################################################################## | |
445 | # Misc rules | |
446 | ############################################################################## | |
447 | ||
faf9a90c | 448 | # each member of the project can have its own test.ml. this file is |
34e49164 | 449 | # not under CVS. |
faf9a90c | 450 | test.ml: |
34e49164 C |
451 | echo "let foo_ctl () = failwith \"there is no foo_ctl formula\"" \ |
452 | > test.ml | |
453 | ||
454 | beforedepend:: test.ml | |
455 | ||
456 | ||
457 | #INC=$(dir $(shell which ocaml)) | |
458 | #INCX=$(INC:/=) | |
459 | #INCY=$(dir $(INCX)) | |
460 | #INCZ=$(INCY:/=)/lib/ocaml | |
461 | # | |
462 | #prim.o: prim.c | |
463 | # gcc -c -o prim.o -I $(INCZ) prim.c | |
464 | ||
465 | ||
466 | ############################################################################## | |
467 | # Generic ocaml rules | |
468 | ############################################################################## | |
469 | ||
470 | .SUFFIXES: .ml .mli .cmo .cmi .cmx | |
471 | ||
472 | .ml.cmo: | |
473 | $(OCAMLC) -c $< | |
474 | .mli.cmi: | |
475 | $(OCAMLC) -c $< | |
476 | .ml.cmx: | |
477 | $(OCAMLOPT) -c $< | |
478 | ||
faf9a90c | 479 | .ml.mldepend: |
34e49164 C |
480 | $(OCAMLC) -i $< |
481 | ||
482 | clean:: | |
483 | rm -f *.cm[iox] *.o *.annot | |
34e49164 C |
484 | rm -f *~ .*~ *.exe #*# |
485 | ||
b1b2de81 C |
486 | distclean:: clean |
487 | set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done | |
488 | rm -f .depend | |
489 | rm -f Makefile.config | |
b23ff9c7 | 490 | rm -f globals/config.ml test.ml |
b1b2de81 C |
491 | rm -f TAGS |
492 | rm -f tests/SCORE_actual.sexp | |
493 | rm -f tests/SCORE_best_of_both.sexp | |
494 | find -name ".#*1.*" | xargs rm -f | |
495 | ||
34e49164 C |
496 | beforedepend:: |
497 | ||
498 | depend:: beforedepend | |
499 | $(OCAMLDEP) *.mli *.ml > .depend | |
b1b2de81 C |
500 | set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done |
501 | ||
502 | .depend:: | |
503 | @if [ ! -f .depend ] ; then $(MAKE) depend ; fi | |
34e49164 C |
504 | |
505 | -include .depend |