[llvm-branch-commits] [cfe-branch] r102344 - in /cfe/branches/Apple/palisade-IB: Makefile clang/Makefile

Daniel Dunbar daniel at zuster.org
Mon Apr 26 10:31:39 PDT 2010


Author: ddunbar
Date: Mon Apr 26 12:31:39 2010
New Revision: 102344

URL: http://llvm.org/viewvc/llvm-project?rev=102344&view=rev
Log:
Add support for cross compiling to integration branch Makefiles (patch by Jim Grosbach).

Modified:
    cfe/branches/Apple/palisade-IB/Makefile
    cfe/branches/Apple/palisade-IB/clang/Makefile

Modified: cfe/branches/Apple/palisade-IB/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/palisade-IB/Makefile?rev=102344&r1=102343&r2=102344&view=diff
==============================================================================
--- cfe/branches/Apple/palisade-IB/Makefile (original)
+++ cfe/branches/Apple/palisade-IB/Makefile Mon Apr 26 12:31:39 2010
@@ -171,6 +171,12 @@
 OSL		= $(DSTROOT)/usr/local/OpenSourceLicenses
 
 ##
+# Cross-builds need wrapper scripts on the path, so have a local directory
+# available for them.
+
+PATH:=${OBJROOT}/bin:${PATH}
+
+##
 # Build Logic
 
 .PHONY: install installsrc installhdrs build configure lazy_install_source install_source clean
@@ -181,6 +187,70 @@
 
 installhdrs:
 
+
+install-cross:: build-cross
+	$(_v) for arch in $(RC_ARCHS) ; do \
+		echo "Installing $(Project) for $$arch..." && \
+		$(MKDIR) $(OBJROOT)/install-$$arch && \
+		umask 0022 && \
+		$(MAKE) -C $(OBJROOT)/$$arch \
+		  $(Install_Flags) $(Install_Target) || exit 1 ; \
+	done
+	$(_v) rm -rf $(DSTROOT)
+	$(_v) mkdir -p $(DSTROOT)
+	$(_v) for arch in $(filter-out $(firstword $(RC_ARCHS)),$(RC_ARCHS)); do \
+		rm -rf $(OBJROOT)/install-$$arch$(Install_Prefix)/lib/clang/*/lib; \
+	done
+	./merge-lipo `for arch in $(RC_ARCHS) ; do echo $(OBJROOT)/install-$$arch ; done` $(DSTROOT)
+	$(_v) $(FIND) $(DSTROOT) $(Find_Cruft) | $(XARGS) $(RMDIR)
+	$(_v) $(FIND) $(SYMROOT) $(Find_Cruft) | $(XARGS) $(RMDIR)
+	$(_v) $(FIND) $(DSTROOT) -perm -0111 ! -name ccc -type f -print | $(XARGS) -n 1 -P $(SYSCTL) dsymutil
+	$(_v) cd $(DSTROOT) && find . -path \*.dSYM/\* -print | cpio -pdml $(SYMROOT)
+	$(_v) find $(DSTROOT) -perm -0111 ! -name ccc -type f -print | xargs -P $(SYSCTL) strip
+	$(_v) find $(DSTROOT) -name \*.dSYM -print | xargs rm -r
+	$(_v)- $(CHOWN) -R root:wheel $(DSTROOT) $(SYMROOT)
+	$(_v) $(MAKE) post-install
+
+
+build-cross:: configure-cross
+	$(_v) for arch in $(RC_ARCHS) ; do \
+		echo "Building (Cross) $(Project) for $$arch..." && \
+		$(MAKE) -j$(SYSCTL) -C $(OBJROOT)/$$arch $(Build_Target) CFLAGS="-arch $$arch $(CFLAGS)" CXXFLAGS="-arch $$arch $(CXXFLAGS)" OPTIONAL_DIRS= || exit 1; \
+	done
+
+configure-cross:: setup-tools-cross
+	$(_v) for arch in $(RC_ARCHS) ; do \
+		echo "Configuring (Cross) $(Project) for $$arch..." && \
+		$(MKDIR) $(OBJROOT)/$$arch && \
+		cd $(OBJROOT)/$$arch && \
+		$(Configure) --prefix="$(Install_Prefix)" $(Configure_Flags) \
+			--host=arm-apple-darwin10 \
+			--target=arm-apple-darwin10 \
+			--build=i686-apple-darwin10 \
+		  || exit 1 ; \
+	done
+
+# A cross-compiler configure will expect to find tools under names like
+# arm-apple-darwin10-gcc, so make sure we have them. Note that -marm
+# is added to the gcc/g++ command line due to rdar://7353031
+setup-tools-cross::
+	$(_v) $(MKDIR) $(OBJROOT)/bin
+	$(_v) for prog in ar nm ranlib strip lipo ld as ; do \
+	  echo '#!/bin/sh' > $(OBJROOT)/bin/arm-apple-darwin10-$$prog && \
+	  echo 'exec '`xcrun -sdk $(SDKROOT) -find $$prog` '"$$@"' \
+	    >> $(OBJROOT)/bin/arm-apple-darwin10-$$prog && \
+	  chmod a+x $(OBJROOT)/bin/arm-apple-darwin10-$$prog || exit 1; \
+	done
+	$(_v) for prog in gcc g++ ; do \
+	  echo '#!/bin/sh' > $(OBJROOT)/bin/arm-apple-darwin10-$$prog && \
+	  echo "ARCH='-arch armv6'" >> $(OBJROOT)/bin/arm-apple-darwin10-$$prog && \
+	  echo 'for i in $$@ ; do if [ "$$i" == "-arch" ] ; then ARCH= ; fi ; done' >> $(OBJROOT)/bin/arm-apple-darwin10-$$prog && \
+	  echo 'exec '`xcrun -find $$prog` \
+	    ' $$ARCH -isysroot '$(SDKROOT)' "$$@" -marm' \
+	    >> $(OBJROOT)/bin/arm-apple-darwin10-$$prog && \
+	  chmod a+x $(OBJROOT)/bin/arm-apple-darwin10-$$prog || exit 1 ; \
+	done
+
 install:: build
 	$(_v) for arch in $(RC_ARCHS) ; do \
 		echo "Installing $(Project) for $$arch..." && \

Modified: cfe/branches/Apple/palisade-IB/clang/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/palisade-IB/clang/Makefile?rev=102344&r1=102343&r2=102344&view=diff
==============================================================================
--- cfe/branches/Apple/palisade-IB/clang/Makefile (original)
+++ cfe/branches/Apple/palisade-IB/clang/Makefile Mon Apr 26 12:31:39 2010
@@ -110,6 +110,8 @@
 	  ENABLE_COVERAGE=$(ENABLE_COVERAGE) \
 	  DISABLE_ASSERTIONS=$(DISABLE_ASSERTIONS) \
 	  ENABLE_EXPENSIVE_CHECKS=$(ENABLE_EXPENSIVE_CHECKS) \
+	  CFLAGS= \
+	  CXXFLAGS= \
 	) || exit 1;
 endif
 





More information about the llvm-branch-commits mailing list