X-Git-Url: https://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/174d164065f16d4a54fd565b9cae251e89a5095e..8f657093d128c6436330659d273c2762ac9cbf79:/Makefile diff --git a/Makefile b/Makefile index 6e07dfa..fa0db61 100644 --- a/Makefile +++ b/Makefile @@ -58,9 +58,15 @@ SEXPLIB=sexplib.cma OPTSEXPLIB=sexplib.cmxa endif +ifeq ("$(DYNLINK)","no") +DYNLINK= +else +DYNLINK=dynlink.cma +endif + SEXPSYSCMA=bigarray.cma nums.cma -SYSLIBS=str.cma unix.cma $(SEXPSYSCMA) $(PYCMA) dynlink.cma +SYSLIBS=str.cma unix.cma $(SEXPSYSCMA) $(PYCMA) $(DYNLINK) # threads.cma LIBS=commons/commons.cma \ commons/commons_sexp.cma \ globals/globals.cma \ @@ -70,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") @@ -129,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) @@ -141,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 @@ -172,24 +181,18 @@ opt-compil: .depend top: $(EXEC).top subdirs: -# $(MAKE) -C commons OCAMLCFLAGS="$(OCAMLCFLAGS)" -# if [ "$(LOCALSEXP)" != "" ]; then \ -# $(MAKE) -C ocamlsexp OCAMLCFLAGS="$(OCAMLCFLAGS)" ; fi +for D in $(MAKESUBDIRS); do $(MAKE) $$D || exit 1 ; done $(MAKE) -C commons sexp OCAMLCFLAGS="$(OCAMLCFLAGS)" subdirs.opt: -# $(MAKE) -C commons all.opt OCAMLCFLAGS="$(OCAMLCFLAGS)" -# if [ "$(LOCALSEXP)" != "" ]; then \ -# $(MAKE) -C ocamlsexp all.opt OCAMLCFLAGS="$(OCAMLCFLAGS)"; fi +for D in $(MAKESUBDIRS); do $(MAKE) $$D.opt || exit 1 ; done - $(MAKE) -C commons sexp.opt OCAMLCFLAGS="$(OCAMLCFLAGS)" + $(MAKE) -C commons sexp.opt OPTFLAGS="$(OPTFLAGS)" $(MAKESUBDIRS): $(MAKE) -C $@ OCAMLCFLAGS="$(OCAMLCFLAGS)" all $(MAKESUBDIRS:%=%.opt): - $(MAKE) -C $(@:%.opt=%) OCAMLCFLAGS="$(OCAMLCFLAGS)" all.opt + $(MAKE) -C $(@:%.opt=%) OPTFLAGS="$(OPTFLAGS)" all.opt #dependencies: # commons: @@ -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: @@ -316,19 +319,31 @@ install-common: mkdir -p $(DESTDIR)$(BINDIR) 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) $(INSTALL_DATA) standard.iso $(DESTDIR)$(SHAREDIR) $(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 - @if [ -d $(BASH_COMPLETION_DIR) ]; then $(MAKE) install-bash; fi install-bash: mkdir -p $(DESTDIR)$(BASH_COMPLETION_DIR) $(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 \ @@ -381,12 +396,29 @@ uninstall: rm -f $(DESTDIR)$(SHAREDIR)/standard.h 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)/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: + rm -f $(DESTDIR)$(BASH_COMPLETION_DIR)/spatch + 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))" @@ -477,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