[llvm-commits] [llvm-gcc-4.2] r102532 - in /llvm-gcc-4.2/trunk: GNUmakefile build_gcc

Bob Wilson bob.wilson at apple.com
Wed Apr 28 14:24:44 PDT 2010


Author: bwilson
Date: Wed Apr 28 16:24:43 2010
New Revision: 102532

URL: http://llvm.org/viewvc/llvm-project?rev=102532&view=rev
Log:
Change Apple-style build of llvmgcc to build a local copy of llvmCore and link
against that.  Build llvmCore with the option to install libLTO.dylib and then
have the llvmgcc installation copy it to the final destination.

Modified:
    llvm-gcc-4.2/trunk/GNUmakefile
    llvm-gcc-4.2/trunk/build_gcc

Modified: llvm-gcc-4.2/trunk/GNUmakefile
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/GNUmakefile?rev=102532&r1=102531&r2=102532&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/GNUmakefile (original)
+++ llvm-gcc-4.2/trunk/GNUmakefile Wed Apr 28 16:24:43 2010
@@ -54,6 +54,9 @@
 PREFIX = ${DEVELOPER_DIR}/usr/llvm-gcc-4.2
 endif
 
+# Default to not reinstall libLTO.dylib.
+INSTALL_LIBLTO := no
+
 # Unless assertions are forced on in the GMAKE command line, disable them.
 ifndef ENABLE_ASSERTIONS
 ENABLE_ASSERTIONS := no
@@ -67,6 +70,13 @@
 endif
 endif
 
+# Default is optimized build.
+ifeq ($(LLVM_DEBUG),1)
+LLVM_OPTIMIZED := no
+else
+LLVM_OPTIMIZED := yes
+endif
+
 ifndef RC_ProjectSourceVersion
 RC_ProjectSourceVersion = 9999
 endif
@@ -75,10 +85,30 @@
 RC_ProjectSourceSubversion = 00
 endif
 
-install: $(OBJROOT) $(SYMROOT) $(DSTROOT)
+install:
+	$(MAKE) OBJROOT=$(OBJROOT)/obj-llvmCore \
+	        SYMROOT=$(OBJROOT)/sym-llvmCore \
+	        DSTROOT=$(OBJROOT)/dst-llvmCore \
+	        INSTALL_LIBLTO=yes install-llvmCore
+	$(MAKE) LLVMCORE_PATH=$(OBJROOT)/dst-llvmCore/Developer/usr/local \
+	        INSTALL_LIBLTO=yes install-llvmgcc42
+
+install-llvmCore: $(OBJROOT) $(SYMROOT) $(DSTROOT)
+	if [ ! -d $(SRC)/llvmCore ]; then \
+	  echo "Error: llvmCore source directory is missing"; \
+	  exit 1; \
+	fi
+	cd $(OBJROOT) && \
+	  DEVELOPER_DIR=Developer \
+	  $(SRC)/llvmCore/utils/buildit/build_llvm "$(RC_ARCHS)" "$(TARGETS)" \
+	    $(SRC)/llvmCore /usr/local $(DSTROOT) $(SYMROOT) \
+	    $(ENABLE_ASSERTIONS) $(LLVM_OPTIMIZED) $(INSTALL_LIBLTO) \
+	    $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion) 
+
+install-llvmgcc42: $(OBJROOT) $(SYMROOT) $(DSTROOT)
 	cd $(OBJROOT) && \
 	  $(SRC)/build_gcc "$(RC_ARCHS)" "$(TARGETS)" \
-	    $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT) true \
+	    $(SRC) $(PREFIX) $(DSTROOT) $(SYMROOT) $(INSTALL_LIBLTO) \
 	    $(ENABLE_ASSERTIONS) $(LLVMCORE_PATH) \
 	    $(RC_ProjectSourceVersion) $(RC_ProjectSourceSubversion) 
 
@@ -106,6 +136,7 @@
 	                        -type f -a -name .DS_Store -o \
 				-name \*~ -o -name .\#\* \) \
 	  -exec rm -rf {} \;
+	rm -rf "$(SRCROOT)/llvmCore/test"
 
 #######################################################################
 

Modified: llvm-gcc-4.2/trunk/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=102532&r1=102531&r2=102532&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Wed Apr 28 16:24:43 2010
@@ -69,8 +69,9 @@
 SYM_DIR="$6"
 
 # LLVM LOCAL begin
-# The seventh parameter is currently unused.
-ENABLE_LLVM=true
+# The seventh parameter is a yes/no that indicates whether libLTO.dylib
+# should be installed from LLVMCORE_PATH.
+INSTALL_LIBLTO="$7"
 
 # The eighth parameter is a yes/no that indicates whether assertions should be
 # enabled in the LLVM libs/tools.
@@ -85,6 +86,8 @@
 # The eleventh parameter is the subversion number of the submission, e.g. 03.
 LLVM_SUBMIT_SUBVERSION="${11}"
 
+ENABLE_LLVM=true
+
 # LLVM LOCAL end
 
 # The current working directory is where the build will happen.
@@ -764,6 +767,22 @@
     find $DEST_DIR -name "unwind.h" -print | xargs rm || exit 1
 fi
 
+# Install libLTO.dylib
+if [ "$INSTALL_LIBLTO" == yes ]; then
+  if [ ! -r $LLVMCORE_PATH/Developer/usr/lib/libLTO.dylib ]; then
+    echo "Error: llvmCore installation is missing libLTO.dylib"
+    exit 1
+  fi
+  mkdir -p $DEST_DIR/Developer/usr/lib
+  cp $LLVMCORE_PATH/Developer/usr/lib/libLTO.dylib \
+     $DEST_DIR/Developer/usr/lib/libLTO.dylib
+
+  # Add a symlink in /usr/lib for B&I.
+  mkdir -p $DEST_DIR/usr/lib/
+  cd $DEST_DIR/usr/lib && \
+    ln -s ../../Developer/usr/lib/libLTO.dylib ./libLTO.dylib
+fi
+
 # LLVM LOCAL end
 
 find $DEST_DIR -name \*.dSYM -print | xargs rm -r || exit 1





More information about the llvm-commits mailing list