1 include $(SRCDIR)/config/aros.cfg
2 -include $(SRCDIR)/tools/crosstools/$(AROS_TOOLCHAIN).cfg
8 ifeq ($(TARGET_LLVM_VER),)
9 LLVM_BUILD_VERSION:=$(LLVM_VERSION)
11 LLVM_BUILD_VERSION:=$(TARGET_LLVM_VER)
14 LLVM_REPOSITORY := http://llvm.org/releases/$(LLVM_VERSION)
15 LLVM_ARCHBASE := llvm-$(LLVM_VERSION).src
16 LLVMLLD_ARCHBASE := lld-$(LLVM_VERSION).src
17 CLANG_ARCHBASE := cfe-$(LLVM_VERSION).src
19 LLVM_TARGETS := "X86;ARM;PowerPC"
20 LLVM_HOST := "$(AROS_TARGET_CPU)"
23 LLVM_CMAKEOPTIONS := \
24 -DDEFAULT_SYSROOT="$(AROS_DEVELOPER)" \
25 -DCMAKE_INSTALL_BINDIR="$(CROSSTOOLSDIR)" \
26 -DLLVM_TARGETS_TO_BUILD=$(LLVM_TARGETS) \
27 -DLLVM_DEFAULT_TARGET_TRIPLE=$(AROS_TARGET_CPU)-unknown-aros \
28 -DLLVM_INCLUDE_TESTS=OFF \
29 -DLLVM_INCLUDE_EXAMPLES=OFF
31 ifeq ($(AROS_HOST_ARCH),linux)
32 LLVM_CMAKEOPTIONS += -DBUILD_SHARED_LIBS=ON
33 # LLVM_CMAKEOPTIONS += -DLLVM_LINK_LLVM_DYLIB=ON
36 #LLVM_CMAKEOPTIONS +=--DLLVM_EXTERNAL_LLD_SOURCE_DIR:PATH="$(HOSTDIR)/Ports/host/llvm-lld/$(LLVMLLD_ARCHBASE)"
37 #LLVM_CMAKEOPTIONS +=--DLLVM_EXTERNAL_CLANG_SOURCE_DIR:PATH="$(HOSTDIR)/Ports/host/clang/$(CLANG_ARCHBASE)"
39 #LLVM_CMAKEOPTIONS +=-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
42 crosstools-llvm-remdirs:
43 $(Q)$(ECHO) "Removing LLVM tool dirs..."
44 $(Q)$(IF) $(TEST) -d $(HOSTDIR)/Ports/host/llvm/$(LLVM_ARCHBASE)/tools/lld; then \
45 $(MV) $(HOSTDIR)/Ports/host/llvm/$(LLVM_ARCHBASE)/tools/lld $(HOSTDIR)/Ports/host/llvm-lld/$(LLVMLLD_ARCHBASE) ; \
47 $(Q)$(IF) $(TEST) -d $(HOSTDIR)/Ports/host/llvm/$(LLVM_ARCHBASE)/tools/clang; then \
48 $(MV) $(HOSTDIR)/Ports/host/llvm/$(LLVM_ARCHBASE)/tools/clang $(HOSTDIR)/Ports/host/clang/$(CLANG_ARCHBASE) ; \
52 crosstools-llvm-adddirs:
53 $(Q)$(ECHO) "Adding LLVM tool dirs..."
54 $(Q)$(IF) $(TEST) -d $(HOSTDIR)/Ports/host/llvm-lld/$(LLVMLLD_ARCHBASE); then \
55 $(MV) $(HOSTDIR)/Ports/host/llvm-lld/$(LLVMLLD_ARCHBASE) $(HOSTDIR)/Ports/host/llvm/$(LLVM_ARCHBASE)/tools/lld ; \
57 $(Q)$(IF) $(TEST) -d $(HOSTDIR)/Ports/host/clang/$(CLANG_ARCHBASE); then \
58 $(MV) $(HOSTDIR)/Ports/host/clang/$(CLANG_ARCHBASE) $(HOSTDIR)/Ports/host/llvm/$(LLVM_ARCHBASE)/tools/clang ; \
61 %fetch mmake=crosstools-clang-fetch archive=$(CLANG_ARCHBASE) \
62 archive_origins=$(LLVM_REPOSITORY) suffixes="tar.xz" \
63 location=$(PORTSSOURCEDIR) destination=$(HOSTDIR)/Ports/host/clang \
64 patches_specs=$(CLANG_ARCHBASE)-aros.diff:$(CLANG_ARCHBASE):-p1
66 %create_patch mmake=crosstools-clang-create-patch \
67 archive=$(CLANG_ARCHBASE) suffixes="tar.xz" \
68 destination=$(HOSTDIR)/Ports/host/clang prediff=crosstools-llvm-remdirs
70 %fetch mmake=crosstools-llvm-lld-fetch archive=$(LLVMLLD_ARCHBASE) \
71 archive_origins=$(LLVM_REPOSITORY) suffixes="tar.xz" \
72 location=$(PORTSSOURCEDIR) destination=$(HOSTDIR)/Ports/host/llvm-lld
74 %create_patch mmake=crosstools-llvm-lld-create-patch \
75 archive=$(LLVMLLD_ARCHBASE) suffixes="tar.xz" \
76 destination=$(HOSTDIR)/Ports/host/llvm-lld prediff=crosstools-llvm-remdirs
78 %fetch mmake=crosstools-llvm-fetch archive=$(LLVM_ARCHBASE) \
79 archive_origins=$(LLVM_REPOSITORY) suffixes="tar.xz" \
80 location=$(PORTSSOURCEDIR) destination=$(HOSTDIR)/Ports/host/llvm \
81 patches_specs=$(LLVM_ARCHBASE)-aros.diff:$(LLVM_ARCHBASE):-p1
83 %create_patch mmake=crosstools-llvm-create-patch \
84 archive=$(LLVM_ARCHBASE) suffixes="tar.xz" \
85 destination=$(HOSTDIR)/Ports/host/llvm prediff=crosstools-llvm-remdirs
87 #MM crosstools-llvm-fetch : crosstools-clang-fetch crosstools-llvm-lld-fetch
89 #MM- tools-crosstools-llvm-i386 : crosstools-llvm-quick
90 #MM- tools-crosstools-llvm-x86_64 : crosstools-llvm-quick
91 #MM- tools-crosstools-llvm-ppc : crosstools-llvm-quick
92 #MM- tools-crosstools-llvm-arm : crosstools-llvm-quick
94 #MM- crosstools-llvm-quick : setup crosstools-llvm-fetch
96 %build_with_cmake mmake=crosstools-llvm package=llvm srcdir=$(HOSTDIR)/Ports/host/llvm/$(LLVM_ARCHBASE) \
97 prefix="$(CROSSTOOLSDIR)" maketarget=$(LLVM_CMAKETARGET) \
98 extraoptions="$(LLVM_CMAKEOPTIONS)" precmake=crosstools-llvm-adddirs compiler=host