Makefile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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:=4.0.0
  10. ifeq ($(ADK_TARGET_ARCH_ARM),y)
  11. LLVM_TARGETS:=ARM
  12. ifeq ($(ADK_TARGET_SOFT_FLOAT),y)
  13. LLVM_TRIPLE:=arm-linux-eabi
  14. endif
  15. ifeq ($(ADK_TARGET_HARD_FLOAT),y)
  16. LLVM_TRIPLE:=arm-linux-eabihf
  17. endif
  18. endif
  19. $(BUILD_DIR_INITIAL)/.configured:
  20. (cd $(DL_DIR); \
  21. for file in cfe lld compiler-rt libcxx libcxxabi; do \
  22. if [ ! -f $${file}-$(LLVM_VERSION).src.tar.xz ]; then \
  23. wget http://llvm.org/releases/$(LLVM_VERSION)/$${file}-$(LLVM_VERSION).src.tar.xz ; \
  24. fi; \
  25. done; \
  26. )
  27. (cd $(WRKBUILD)/tools && tar xvf $(DL_DIR)/cfe-$(LLVM_VERSION).src.tar.xz && mv cfe-$(LLVM_VERSION).src clang)
  28. (cd $(WRKBUILD)/tools && tar xvf $(DL_DIR)/lld-$(LLVM_VERSION).src.tar.xz && mv lld-$(LLVM_VERSION).src lld)
  29. (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/compiler-rt-$(LLVM_VERSION).src.tar.xz && mv compiler-rt-$(LLVM_VERSION).src compiler-rt)
  30. (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/libcxx-$(LLVM_VERSION).src.tar.xz && mv libcxx-$(LLVM_VERSION).src libcxx)
  31. (cd $(WRKBUILD)/projects && tar xvf $(DL_DIR)/libcxxabi-$(LLVM_VERSION).src.tar.xz && mv libcxxabi-$(LLVM_VERSION).src libcxxabi)
  32. mkdir -p $(BUILD_DIR_INITIAL)
  33. cd $(BUILD_DIR_INITIAL); \
  34. PATH='$(HOST_PATH)' \
  35. cmake -DCMAKE_BUILD_TYPE=Release \
  36. -DCMAKE_INSTALL_PREFIX=$(TOOLCHAIN_DIR)/usr \
  37. -DCMAKE_CXX_FLAGS="-std=c++11" \
  38. -DLLVM_ENABLE_EH=ON \
  39. -DLLVM_ENABLE_RTTI=ON \
  40. -DLLVM_DEFAULT_TARGET_TRIPLE=$(LLVM_TRIPLE) \
  41. -DLLVM_TARGETS_TO_BUILD=$(LLVM_TARGETS) \
  42. $(WRKBUILD)
  43. touch $@
  44. $(BUILD_DIR_INITIAL)/.compiled: $(BUILD_DIR_INITIAL)/.configured
  45. PATH='$(TARGET_PATH)' \
  46. $(MAKE) -j$(ADK_MAKE_JOBS) -C $(BUILD_DIR_INITIAL) all
  47. touch $@
  48. $(WRKBUILD)/.configured: $(BUILD_DIR_INITIAL)/.compiled
  49. PATH='$(TARGET_PATH)' \
  50. $(MAKE) -j$(ADK_MAKE_JOBS) -C $(BUILD_DIR_INITIAL) install
  51. touch $@
  52. $(WRKBUILD)/.compiled:
  53. touch $@
  54. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  55. touch $@
  56. $(WRKBUILD)/.final:
  57. touch $@
  58. include ${ADK_TOPDIR}/mk/toolchain.mk