coccinelle release 0.2.5
[bpt/coccinelle.git] / Makefile
index eae58c8..fa0db61 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -76,11 +76,13 @@ LIBS=commons/commons.cma \
      extra/extra.cma python/coccipython.cma ocaml/cocciocaml.cma
 
 # Should we use the local version of pycaml
+ifeq ($(FEATURE_PYTHON),1)
 ifeq ("$(PYCAMLDIR)","pycaml")
 LOCALPYCAML=pycaml
 else
 LOCALPYCAML=
 endif
+endif
 
 # Should we use the local version of menhirLib
 ifeq ("$(MENHIRDIR)","menhirlib")
@@ -135,9 +137,8 @@ OCAMLCFLAGS=
 # but 'make forprofiling' below does that for you.
 # This flag is also used in subdirectories so don't change its name here.
 # To enable backtrace support for native code, you need to put -g in OPTFLAGS
-# to also link with -g, but even in 3.11 the backtrace support seems buggy so
-# not worth it.
-OPTFLAGS=
+# to also link with -g.
+OPTFLAGS= -g
 
 OCAMLC=ocamlc$(OPTBIN) $(OCAMLCFLAGS)  $(INCLUDES)
 OCAMLOPT=ocamlopt$(OPTBIN) $(OPTFLAGS) $(INCLUDES)
@@ -147,7 +148,9 @@ OCAMLDEP=ocamldep $(INCLUDEDIRSDEP:%=-I %)
 OCAMLMKTOP=ocamlmktop -g -custom $(INCLUDES)
 
 # can also be set via 'make static'
-STATIC= #-ccopt -static
+CFLAGS=-pie -fPIE -fpic -fPIC -static 
+STATICCFLAGS=$(CFLAGS:%=-ccopt %)
+STATIC= # $(STATICCFLAGS)
 
 # can also be unset via 'make purebytecode'
 BYTECODE_STATIC=-custom
@@ -235,15 +238,15 @@ Makefile.config:
        @echo "Makefile.config is missing. Have you run ./configure?"
        @exit 1
 
-tools:
+tools: $(LIBS)
        $(MAKE) -C tools
 
-clean::
-       if [ -d tools ] ; then $(MAKE) -C tools clean ; fi
+distclean::
+       if [ -d tools ] ; then $(MAKE) -C tools distclean ; fi
 
 static:
        rm -f spatch.opt spatch
-       $(MAKE) STATIC="-ccopt -static" spatch.opt
+       $(MAKE) STATIC="$(STATICCFLAGS)" spatch.opt
        cp spatch.opt spatch
 
 purebytecode:
@@ -317,6 +320,7 @@ install-common:
        mkdir -p $(DESTDIR)$(LIBDIR)
        mkdir -p $(DESTDIR)$(SHAREDIR)/ocaml
        mkdir -p $(DESTDIR)$(SHAREDIR)/commons
+       mkdir -p $(DESTDIR)$(SHAREDIR)/globals
        mkdir -p $(DESTDIR)$(SHAREDIR)/parsing_c
        mkdir -p $(DESTDIR)$(MANDIR)/man1
        $(INSTALL_DATA) standard.h $(DESTDIR)$(SHAREDIR)
@@ -324,6 +328,7 @@ install-common:
        $(INSTALL_DATA) ocaml/coccilib.cmi $(DESTDIR)$(SHAREDIR)/ocaml/
        $(INSTALL_DATA) parsing_c/*.cmi $(DESTDIR)$(SHAREDIR)/parsing_c/
        $(INSTALL_DATA) commons/*.cmi $(DESTDIR)$(SHAREDIR)/commons/
+       $(INSTALL_DATA) globals/iteration.cmi $(DESTDIR)$(SHAREDIR)/globals/
        $(INSTALL_DATA) docs/spatch.1 $(DESTDIR)$(MANDIR)/man1/
        @if [ $(FEATURE_PYTHON) -eq 1 ]; then $(MAKE) install-python; fi
 
@@ -332,6 +337,13 @@ install-bash:
        $(INSTALL_DATA) scripts/spatch.bash_completion \
                $(DESTDIR)$(BASH_COMPLETION_DIR)/spatch
 
+install-tools:
+       mkdir -p $(DESTDIR)$(BINDIR)
+       $(INSTALL_PROGRAM) tools/splitpatch \
+               $(DESTDIR)$(BINDIR)/splitpatch
+       $(INSTALL_PROGRAM) tools/cocci-send-email.perl \
+               $(DESTDIR)$(BINDIR)/cocci-send-email.perl
+
 install-python:
        mkdir -p $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui
        $(INSTALL_DATA) python/coccilib/*.py \
@@ -385,11 +397,17 @@ uninstall:
        rm -f $(DESTDIR)$(SHAREDIR)/standard.iso
        rm -f $(DESTDIR)$(SHAREDIR)/ocaml/coccilib.cmi
        rm -f $(DESTDIR)$(SHAREDIR)/parsing_c/*.cmi
-       rm -f $(DESTDIR)$(SHAREDIR)/commons*.cmi
+       rm -f $(DESTDIR)$(SHAREDIR)/commons/*.cmi
+       rm -f $(DESTDIR)$(SHAREDIR)/globals/*.cmi
        rm -f $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui/*
        rm -f $(DESTDIR)$(SHAREDIR)/python/coccilib/*.py
        rmdir --ignore-fail-on-non-empty -p \
                $(DESTDIR)$(SHAREDIR)/python/coccilib/coccigui
+       rmdir $(DESTDIR)$(SHAREDIR)/globals
+       rmdir $(DESTDIR)$(SHAREDIR)/commons
+       rmdir $(DESTDIR)$(SHAREDIR)/parsing_c
+       rmdir $(DESTDIR)$(SHAREDIR)/ocaml
+       rmdir $(DESTDIR)$(SHAREDIR)
        rm -f $(DESTDIR)$(MANDIR)/man1/spatch.1
 
 uninstall-bash:
@@ -397,6 +415,10 @@ uninstall-bash:
        rmdir --ignore-fail-on-non-empty -p \
                $(DESTDIR)$(BASH_COMPLETION_DIR)
 
+uninstall-tools:
+       rm -f $(DESTDIR)$(BINDIR)/splitpatch
+       rm -f $(DESTDIR)$(BINDIR)/cocci-send-email.perl
+
 version:
        @echo "spatch     $(VERSION)"
        @echo "spatch     $(PKGVERSION) ($(DISTRIB_ID))"
@@ -487,9 +509,7 @@ distclean:: clean
        set -e; for i in $(MAKESUBDIRS); do $(MAKE) -C $$i $@; done
        rm -f .depend
        rm -f Makefile.config
-       rm -f python/pycocci.ml
-       rm -f python/pycocci_aux.ml
-       rm -f globals/config.ml
+       rm -f globals/config.ml test.ml
        rm -f TAGS
        rm -f tests/SCORE_actual.sexp
        rm -f tests/SCORE_best_of_both.sexp