[llvm-branch-commits] [cfe-branch] r102564 - /cfe/branches/Apple/williamson-IB/Makefile
Daniel Dunbar
daniel at zuster.org
Wed Apr 28 16:50:14 PDT 2010
Author: ddunbar
Date: Wed Apr 28 18:50:13 2010
New Revision: 102564
URL: http://llvm.org/viewvc/llvm-project?rev=102564&view=rev
Log:
Add support for cross compiling to integration branch Makefiles (patch by Jim Grosbach).
- Additional tweak by me to disable Clang runtime bits instead of relying on
them being removed.
Modified:
cfe/branches/Apple/williamson-IB/Makefile
Modified: cfe/branches/Apple/williamson-IB/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/williamson-IB/Makefile?rev=102564&r1=102563&r2=102564&view=diff
==============================================================================
--- cfe/branches/Apple/williamson-IB/Makefile (original)
+++ cfe/branches/Apple/williamson-IB/Makefile Wed Apr 28 18:50:13 2010
@@ -178,6 +178,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 \
@@ -191,6 +197,75 @@
installhdrs:
+##
+# Cross Compilation Build Support
+
+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) CLANG_NO_RUNTIME=1 || 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= CLANG_NO_RUNTIME=1 || 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
+
+##
+# Standard Build Support
+
install:: build
$(_v) for arch in $(RC_ARCHS) ; do \
echo "Installing $(Project) for $$arch..." && \
More information about the llvm-branch-commits
mailing list