1
0

Makefile 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(ADK_TOPDIR)/rules.mk
  4. include ../rules.mk
  5. include Makefile.inc
  6. include ${ADK_TOPDIR}/mk/buildhlp.mk
  7. BUILD_DIR_INITIAL:= $(WRKBUILD)-initial
  8. BUILD_DIR_FINAL:= $(WRKBUILD)-final
  9. LLVM_VERSION:= $(ADK_TOOLCHAIN_LLVM_VERSION)
  10. LLVM_TRIPLE:= $(ADK_TARGET_ARCH)-linux
  11. ifeq ($(ADK_TARGET_ARCH_AARCH64),y)
  12. LLVM_TARGETS:=AArch64
  13. endif
  14. ifeq ($(ADK_TARGET_ARCH_ARM),y)
  15. LLVM_TARGETS:=ARM
  16. ifeq ($(ADK_TARGET_SOFT_FLOAT),y)
  17. LLVM_TRIPLE:=arm-linux-eabi
  18. endif
  19. ifeq ($(ADK_TARGET_HARD_FLOAT),y)
  20. LLVM_TRIPLE:=arm-linux-eabihf
  21. endif
  22. endif
  23. ifeq ($(ADK_TARGET_ARCH_MIPS)$(ADK_TARGET_ARCH_MIPS64),y)
  24. LLVM_TARGETS:=Mips
  25. endif
  26. ifeq ($(ADK_TARGET_ARCH_PPC)$(ADK_TARGET_ARCH_PPC64),y)
  27. LLVM_TARGETS:=PowerPC
  28. endif
  29. ifeq ($(ADK_TARGET_ARCH_SPARC)$(ADK_TARGET_ARCH_SPARC64),y)
  30. LLVM_TARGETS:=Sparc
  31. endif
  32. ifeq ($(ADK_TARGET_ARCH_S390),y)
  33. LLVM_TARGETS:=SystemZ
  34. endif
  35. ifeq ($(ADK_TARGET_ARCH_X86)$(ADK_TARGET_ARCH_X86_64),y)
  36. LLVM_TARGETS:=X86
  37. endif
  38. $(BUILD_DIR_INITIAL)/.configured:
  39. (cd $(DL_DIR); \
  40. for file in cfe lld compiler-rt libcxx libcxxabi; do \
  41. if [ ! -f $${file}-$(LLVM_VERSION).src.tar.xz ]; then \
  42. wget http://llvm.org/releases/$(LLVM_VERSION)/$${file}-$(LLVM_VERSION).src.tar.xz ; \
  43. fi; \
  44. done; \
  45. )
  46. (cd $(WRKBUILD)/tools && tar xvf $(DL_DIR)/cfe-$(LLVM_VERSION).src.tar.xz && mv cfe-$(LLVM_VERSION).src clang)
  47. (cd $(WRKBUILD)/tools && tar xvf $(DL_DIR)/lld-$(LLVM_VERSION).src.tar.xz && mv lld-$(LLVM_VERSION).src lld)
  48. (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/compiler-rt-$(LLVM_VERSION).src.tar.xz && mv compiler-rt-$(LLVM_VERSION).src compiler-rt)
  49. (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/libcxx-$(LLVM_VERSION).src.tar.xz && mv libcxx-$(LLVM_VERSION).src libcxx)
  50. (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/libcxxabi-$(LLVM_VERSION).src.tar.xz && mv libcxxabi-$(LLVM_VERSION).src libcxxabi)
  51. mkdir -p $(BUILD_DIR_INITIAL)
  52. cd $(BUILD_DIR_INITIAL); \
  53. PATH='$(HOST_PATH)' \
  54. cmake -DCMAKE_BUILD_TYPE=Release \
  55. -DCMAKE_INSTALL_PREFIX=$(TOOLCHAIN_DIR)/usr \
  56. -DCMAKE_CXX_FLAGS="-std=c++11" \
  57. -DLLVM_ENABLE_EH=ON \
  58. -DLLVM_ENABLE_RTTI=ON \
  59. -DLLVM_DEFAULT_TARGET_TRIPLE=$(LLVM_TRIPLE) \
  60. -DLLVM_TARGETS_TO_BUILD=$(LLVM_TARGETS) \
  61. $(WRKBUILD)
  62. touch $@
  63. $(BUILD_DIR_INITIAL)/.compiled: $(BUILD_DIR_INITIAL)/.configured
  64. PATH='$(TARGET_PATH)' \
  65. $(MAKE) -j$(ADK_MAKE_JOBS) -C $(BUILD_DIR_INITIAL) all
  66. touch $@
  67. $(WRKBUILD)/.configured: $(BUILD_DIR_INITIAL)/.compiled
  68. PATH='$(TARGET_PATH)' \
  69. $(MAKE) -j$(ADK_MAKE_JOBS) -C $(BUILD_DIR_INITIAL) install
  70. touch $@
  71. $(WRKBUILD)/.compiled:
  72. touch $@
  73. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  74. touch $@
  75. $(WRKBUILD)/.final:
  76. touch $@
  77. include ${ADK_TOPDIR}/mk/toolchain.mk