diff --git a/Makefile b/Makefile index 2da00d48217931ad478bb595b9e00227c3553d3a..e84f04bc549da3b4d08e0b9e4c28c29de0d33529 100644 --- a/Makefile +++ b/Makefile @@ -448,7 +448,7 @@ endif ##### Store SVN revision number ##### -ifeq ($(findstring $(MAKECMDGOALS),clean distclean maintainer-clean dist),) +ifeq ($(findstring $(MAKECMDGOALS),clean distclean maintainer-clean dist distsrc),) ifeq ($(findstring clean-,$(MAKECMDGOALS)),) ifeq ($(shell which svn 2>&1 | sed -ne "s@.*/svn@svn@p"),svn) SVNREV := $(shell bash $(ROOT_SRCDIR)/build/unix/svninfo.sh $(ROOT_SRCDIR)) diff --git a/build/unix/svninfollvm.sh b/build/unix/svninfollvm.sh new file mode 100755 index 0000000000000000000000000000000000000000..ee8a1abf9303061c9ee0804ba6c626825f41e7c5 --- /dev/null +++ b/build/unix/svninfollvm.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +# Check version of interpreter/llvm directory and if it is changed force +# a make in the LLVM tree. It creates the file +# interpreter/llvm/obj/llvmrev.txt +# containing the current interpreter/llvm rev number. +# If the current rev is different from the stored rev, force a make +# in the LLVM tree. Script returns 1 when make has to be forced, 0 otherwise. +# Exit status is always 0. + +ret=0 +dir= +dotsvn=".svn" +svn=svn +if [ $# = 1 ]; then + if [ -x /bin/cygpath ]; then + dir=`cygpath -u $1` + svn=/usr/bin/svn + else + dir=$1 + fi + dotsvn="$dir/.svn" +fi + +# if we don't see the .svn directory, just return +if test ! -d $dotsvn; then + echo $ret + exit 0; +fi + +OUT=interpreter/llvm/obj/llvmrev.txt +revold= +rev=`$svn info $dir | awk '/Last Changed Rev:/ { print $4 }'` + +if [ -f $OUT ]; then + revold=`cat $OUT` + if [ $rev -ne $revold ]; then + ret=1 + fi +else + ret=1 +fi + +echo $rev > $OUT +echo $ret + +exit 0 diff --git a/interpreter/llvm/Module.mk b/interpreter/llvm/Module.mk index ccf58ace6fe93d7c5a951026b66760700af5ad42..5a6718ea806a8604987d768d2adc069bc1494389 100644 --- a/interpreter/llvm/Module.mk +++ b/interpreter/llvm/Module.mk @@ -49,12 +49,21 @@ LLVMOPTFLAGS := --enable-optimized --disable-assertions else LLVMOPTFLAGS := --disable-optimized endif -ifneq ($(FORCELLVM),) + +ifeq ($(findstring $(MAKECMDGOALS),clean distclean maintainer-clean dist distsrc),) +ifeq ($(findstring clean-,$(MAKECMDGOALS)),) +ifeq ($(shell which svn 2>&1 | sed -ne "s@.*/svn@svn@p"),svn) +FORCELLVM := $(shell bash $(ROOT_SRCDIR)/build/unix/svninfollvm.sh $(ROOT_SRCDIR)/interpreter/llvm) +endif +endif +endif + +ifneq ($(FORCELLVM),0) FORCELLVMTARGET := FORCELLVMTARGET endif ##### local rules ##### -.PHONY: all-$(MODNAME) clean-$(MODNAME) distclean-$(MODNAME) FORCELLVMTARGET +.PHONY: all-$(MODNAME) clean-$(MODNAME) distclean-$(MODNAME) FORCELLVMTARGET # clang resource directory gets copied to lib/clang/ # clang version extraction as in tools/clang/lib/Headers/Makefile @@ -127,6 +136,7 @@ $(LLVMDEPO): $(LLVMDEPS) $$LLVM_HOST \ --prefix=$(ROOT_OBJDIR)/$(LLVMDIRI) \ --disable-docs --disable-bindings \ + --disable-visibility-inlines-hidden \ $(LLVMOPTFLAGS) \ --enable-targets=host \ CC=$$LLVMCC CXX=$$LLVMCXX \