1 include $(SRCDIR)/config/aros.cfg
2 -include $(SRCDIR)/$(CURDIR)/$(AROS_TOOLCHAIN).cfg
8 ICU_PKGVERSION=$(subst .,_,$(ICU_VERSION))
11 --bindir=$(CROSSTOOLSDIR) \
12 --sbindir=$(CROSSTOOLSDIR) \
19 --with-data-packaging=static
21 BINUTILS_VERSION = $(TARGET_BINUTILS_VER)
23 BINUTILS_EXTRA_OPTS := --target=$(AROS_TARGET_CPU)-aros
24 BINUTILS_EXTRA_OPTS += -bindir=$(CROSSTOOLSDIR)
25 BINUTILS_EXTRA_OPTS += --libdir=$(CROSSTOOLSDIR)/lib
26 BINUTILS_EXTRA_OPTS += --with-sysroot=$(AROS_DEVELOPMENT)
27 BINUTILS_EXTRA_OPTS += --disable-werror
29 GCC_VERSION = $(TARGET_GCC_VER)
30 $(eval UNUSEDREMAINDER := $$$(GCC_VERSION))
31 GCC_VERSION_MAJOR := $(subst $(UNUSEDREMAINDER),,$(GCC_VERSION))
34 ifneq (no-objc,$(OBJC_TARGET))
35 GCC_LANGUAGES:=$(GCC_LANGUAGES),objc
37 ifneq (no-java,$(JAVA_TARGET))
38 GCC_LANGUAGES:=$(GCC_LANGUAGES),java
41 GCC_EXTRA_OPTS := --target=$(AROS_TARGET_CPU)-aros
43 # ARM requires additional flags to determine CPU type and FP model
44 ifneq (,$(findstring $(AROS_TARGET_CPU),arm))
45 GCC_EXTRA_OPTS += --with-arch=$(GCC_DEFAULT_CPU)
46 GCC_EXTRA_OPTS += --with-float=$(GCC_DEFAULT_FLOAT_ABI)
47 GCC_EXTRA_OPTS += --with-fpu=$(GCC_DEFAULT_FPU)
48 GCC_EXTRA_OPTS += --with-mode=$(GCC_DEFAULT_MODE)
49 GCC_EXTRA_OPTS += --disable-libunwind-exceptions
51 # If we are building GCC >= 5, for x86 targets, enable libmpx
52 # ifeq ($(shell test $(GCC_VERSION_MAJOR) -gt 4; echo $$?),0)
53 # ifeq ($(AROS_TARGET_CPU),i386)
54 # GCC_EXTRA_OPTS += --enable-libmpx
56 # ifeq ($(AROS_TARGET_CPU),x86_64)
57 # GCC_EXTRA_OPTS += --enable-libmpx
60 GCC_EXTRA_OPTS += --with-dwarf2
63 GCC_EXTRA_OPTS += --with-sysroot=$(AROS_DEVELOPMENT)
64 GCC_EXTRA_OPTS += --with-native-system-header-dir=/include
65 GCC_EXTRA_OPTS += --bindir=$(CROSSTOOLSDIR)
66 GCC_EXTRA_OPTS += --libdir=$(CROSSTOOLSDIR)/lib
67 GCC_EXTRA_OPTS += --enable-languages=$(strip $(GCC_LANGUAGES))
68 GCC_EXTRA_OPTS += --enable-long-long
69 GCC_EXTRA_OPTS += --enable-version-specific-runtime-libs
70 GCC_EXTRA_OPTS += --enable-frame-pointer
71 GCC_EXTRA_OPTS += --with-isl=$(CROSSTOOLSDIR)
72 GCC_EXTRA_OPTS += --disable-isl-version-check
73 GCC_EXTRA_OPTS += --disable-bootstrap
74 GCC_EXTRA_OPTS += --disable-sjlj-exceptions
75 GCC_EXTRA_OPTS += --disable-tls
76 GCC_EXTRA_OPTS += --disable-plugins
77 GCC_EXTRA_OPTS += --disable-libssp
78 GCC_EXTRA_OPTS += --disable-libstdcxx-pch
79 GCC_EXTRA_OPTS += --disable-build-with-cxx
80 GCC_EXTRA_OPTS += --disable-build-poststage1-with-cxx
82 GCC_PATH = `LANG=en_US $(CROSSTOOLSDIR)/$(AROS_TARGET_CPU)-aros-gcc -print-search-dirs | grep "programs: =" | cut -c 12-`
86 GDB_EXTRA_OPTS := --target=$(AROS_TARGET_CPU)-aros
87 GDB_EXTRA_OPTS += --bindir=$(CROSSTOOLSDIR)
88 GDB_EXTRA_OPTS += --libdir=$(CROSSTOOLSDIR)/lib
90 GNU_REPOSITORY := gnu://
91 ISL_REPOSITORY := ftp://gcc.gnu.org/pub/gcc/infrastructure
92 MPC_REPOSITORY := http://www.multiprecision.org/mpc/download http://ftp.osuosl.org/pub/lfs/lfs-packages/7.3
93 ICU_REPOSITORY := http://download.icu-project.org/files/$(ICU_PKGNAME)/$(ICU_VERSION)
95 binutils-installflag := $(CROSSTOOLSDIR)/.installflag-binutils-$(BINUTILS_VERSION)-$(AROS_TARGET_CPU)
96 gmp-installflag := $(CROSSTOOLSDIR)/.installflag-gmp-$(GMP_VERSION)
97 isl-installflag := $(CROSSTOOLSDIR)/.installflag-isl-$(ISL_VERSION)
98 mpfr-installflag := $(CROSSTOOLSDIR)/.installflag-mpfr-$(MPFR_VERSION)
99 mpc-installflag := $(CROSSTOOLSDIR)/.installflag-mpc-$(MPC_VERSION)
100 gcc-installflag := $(CROSSTOOLSDIR)/.installflag-gcc-$(GCC_VERSION)-$(AROS_TARGET_CPU)
101 icu-installflag := $(CROSSTOOLSDIR)/.installflag-icu-$(ICU_VERSION)
102 gdb-installflag := $(CROSSTOOLSDIR)/.installflag-gdb-$(GDB_VERSION)
104 #MM- tools-crosstools : tools-crosstools-$(AROS_TOOLCHAIN)-$(AROS_TARGET_CPU)
106 #MM- tools-crosstools-gnu-m68k : tools-crosstools-gcc crosstools-gcc
107 #MM- tools-crosstools-gnu-i386 : tools-crosstools-gcc crosstools-gcc
108 #MM- tools-crosstools-gnu-x86_64 : tools-crosstools-gcc crosstools-gcc
109 #MM- tools-crosstools-gnu-ppc : tools-crosstools-gcc crosstools-gcc
110 #MM- tools-crosstools-gnu-arm : tools-crosstools-gcc crosstools-gcc
111 #MM- tools-crosstools-gnu-aarch64 : tools-crosstools-gcc crosstools-gcc
113 #MM tools-crosstools-gcc : tools-crosstools-binutils tools-crosstools-collect-aros \
114 #MM tools-crosstools-gmp \
115 #MM tools-crosstools-isl \
116 #MM tools-crosstools-mpfr \
117 #MM tools-crosstools-mpc
119 # We intentionally bypass the usual fetch_and_build macro below and call mmakefile and gcc makefile
120 # targets directly. This is in order to not build the core-linklibs target during binutils and gcc
121 # builds because we want these static linker libraries be generated by the cross tool chain we are building
122 # right here. Additionally, we also want to maintain our own install flag files inside the directory
123 # specified by --with-aros-toolchain-install. This directory may even reside outside of the usual aros
124 # build directory and can be reused between complete rebuilds.
127 tools-crosstools-gmp :
128 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
129 || ! $(TEST) -f $(gmp-installflag) ; then \
130 $(RM) $(HOSTGENDIR)/$(CURDIR)/gmp/.files-touched \
131 && $(MAKE) -f ./mmakefile crosstools-gmp--fetch \
132 && $(MAKE) -f ./mmakefile crosstools-gmp--build_and_install-quick \
133 && $(TOUCH) $(gmp-installflag) ; \
136 %fetch_and_build mmake=crosstools-gmp package=gmp version=$(GMP_VERSION) compiler=host \
137 package_repo="$(GNU_REPOSITORY)/gmp" \
139 prefix="$(CROSSTOOLSDIR)" \
140 extraoptions="--bindir=$(CROSSTOOLSDIR) --libdir=$(CROSSTOOLSDIR)/lib --disable-shared"
143 tools-crosstools-isl :
144 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
145 || ! $(TEST) -f $(isl-installflag) ; then \
146 $(RM) $(HOSTGENDIR)/$(CURDIR)/isl/.files-touched \
147 && $(MAKE) -f ./mmakefile crosstools-isl--fetch \
148 && $(MAKE) -f ./mmakefile crosstools-isl--build_and_install-quick \
149 && $(TOUCH) $(isl-installflag) ; \
152 %fetch_and_build mmake=crosstools-isl package=isl version=$(ISL_VERSION) compiler=host \
153 package_repo="$(ISL_REPOSITORY)" \
155 prefix="$(CROSSTOOLSDIR)" \
156 extraoptions="--bindir=$(CROSSTOOLSDIR) --libdir=$(CROSSTOOLSDIR)/lib --without-piplib --disable-shared"
159 tools-crosstools-mpfr :
160 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
161 || ! $(TEST) -f $(mpfr-installflag) ; then \
162 $(RM) $(HOSTGENDIR)/$(CURDIR)/mpfr/.files-touched \
163 && $(MAKE) -f ./mmakefile crosstools-mpfr--fetch \
164 && $(MAKE) -f ./mmakefile crosstools-mpfr--build_and_install-quick \
165 && $(TOUCH) $(mpfr-installflag) ; \
168 %fetch_and_build mmake=crosstools-mpfr package=mpfr version=$(MPFR_VERSION) compiler=host \
169 package_repo="$(GNU_REPOSITORY)/mpfr" \
171 prefix="$(CROSSTOOLSDIR)" \
172 extraoptions="--bindir=$(CROSSTOOLSDIR) --libdir=$(CROSSTOOLSDIR)/lib --disable-shared"
175 tools-crosstools-mpc :
176 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
177 || ! $(TEST) -f $(mpc-installflag) ; then \
178 $(RM) $(HOSTGENDIR)/$(CURDIR)/mpc/.files-touched \
179 && $(MAKE) -f ./mmakefile crosstools-mpc--fetch \
180 && $(MAKE) -f ./mmakefile crosstools-mpc--build_and_install-quick \
181 && $(TOUCH) $(mpc-installflag) ; \
184 %fetch_and_build mmake=crosstools-mpc package=mpc version=$(MPC_VERSION) compiler=host \
185 package_repo="$(MPC_REPOSITORY)" suffixes="tar.gz" \
187 prefix="$(CROSSTOOLSDIR)" \
188 extraoptions="--bindir=$(CROSSTOOLSDIR) --libdir=$(CROSSTOOLSDIR)/lib --disable-shared"
191 tools-crosstools-binutils :
192 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
193 || ! $(TEST) -f $(binutils-installflag) ; then \
194 $(RM) $(HOSTGENDIR)/$(CURDIR)/binutils/.files-touched \
195 && $(MAKE) -f ./mmakefile crosstools-binutils--fetch \
196 && $(MAKE) -f ./mmakefile crosstools-binutils--build_and_install-quick \
197 && $(TOUCH) $(binutils-installflag) ; \
200 %fetch_and_build mmake=crosstools-binutils package=binutils version=$(BINUTILS_VERSION) compiler=host \
201 package_repo="$(GNU_REPOSITORY)/binutils" \
203 prefix="$(CROSSTOOLSDIR)" \
204 extraoptions="$(BINUTILS_EXTRA_OPTS)"
206 HOST_CFLAGS := $(HOST_CFLAGS) $(HOST_GNU89_INLINE)
209 tools-crosstools-gcc :
210 @$(IF) ! $(TEST) -f $(gcc-installflag) ; then \
211 $(RM) $(HOSTGENDIR)/$(CURDIR)/gcc/.files-touched \
212 && $(MAKE) -f ./mmakefile crosstools-gcc--fetch \
213 && $(MAKE) -f ./mmakefile crosstools-gcc--configure \
214 && $(MAKE) -C $(HOSTGENDIR)/$(CURDIR)/gcc all-gcc \
215 && $(MAKE) -j1 -C $(HOSTGENDIR)/$(CURDIR)/gcc install-gcc \
216 && $(TOUCH) $(gcc-installflag) ; \
218 @$(IF) $(TEST) -f $(gcc-installflag); then \
219 $(SED) -i -e "s|@aros_target_cc_path@|$(GCC_PATH)|g" $(TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX)-aros-ld ; \
222 %fetch_and_build mmake=crosstools-gcc package=gcc version=$(GCC_VERSION) compiler=host \
223 package_repo="$(GNU_REPOSITORY)/gcc/gcc-$(GCC_VERSION)" \
225 prefix="$(CROSSTOOLSDIR)" \
226 extraoptions="$(GCC_EXTRA_OPTS)"
229 tools-crosstools-icu :
230 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
231 || ! $(TEST) -f $(icu-installflag) ; then \
232 $(RM) $(HOSTGENDIR)/$(CURDIR)/icu/.files-touched \
233 && $(MAKE) -f ./mmakefile crosstools-icu--fetch \
234 && $(MAKE) -f ./mmakefile crosstools-icu--build_and_install-quick \
235 && $(TOUCH) $(icu-installflag) ; \
238 HOST_CXXFLAGS := $(subst -Wno-pointer-sign,, $(subst -Werror-implicit-function-declaration,, $(HOST_CXXFLAGS)))
240 # specify the gendir for icu to be in the crosstools directory so it can be reused
241 %fetch_and_build mmake=crosstools-icu package=icu4c version=$(ICU_PKGVERSION)-src compiler=host \
242 package_repo="$(ICU_REPOSITORY)" suffixes="tgz" \
243 patch=yes srcdir=icu builddir=source gendir=$(CROSSTOOLSDIR) \
244 prefix="$(CROSSTOOLSDIR)" \
245 extraoptions="$(ICU_EXTRA_OPTS)"
248 tools-crosstools-gdb :
249 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
250 || ! $(TEST) -f $(gdb-installflag) ; then \
251 $(RM) $(HOSTGENDIR)/$(CURDIR)/gdb/.files-touched \
252 && $(MAKE) -f ./mmakefile crosstools-gdb--fetch \
253 && $(MAKE) -f ./mmakefile crosstools-gdb--build_and_install-quick \
254 && $(TOUCH) $(gdb-installflag) ; \
257 %fetch_and_build mmake=crosstools-gdb package=gdb version=$(GDB_VERSION) compiler=host \
258 package_repo="$(GNU_REPOSITORY)/gdb" \
260 prefix="$(CROSSTOOLSDIR)" \
261 extraoptions="$(GDB_EXTRA_OPTS)"
268 LLVM_REPOSITORY := http://llvm.org/releases/$(LLVM_VERSION)
269 LLVM_ARCHBASE := llvm-$(LLVM_VERSION).src
270 LLVMLLD_ARCHBASE := lld-$(LLVM_VERSION).src
271 CLANG_ARCHBASE := cfe-$(LLVM_VERSION).src
273 LLVM_TARGETS := "X86;ARM;PowerPC"
274 LLVM_HOST := "$(AROS_TARGET_CPU)"
277 LLVM_CMAKEOPTIONS := \
278 -DDEFAULT_SYSROOT="$(AROS_DEVELOPMENT)" \
279 -DCMAKE_INSTALL_BINDIR="$(CROSSTOOLSDIR)" \
280 -DLLVM_EXTERNAL_LLD_SOURCE_DIR:PATH="$(HOSTDIR)/Ports/host/llvm-lld/$(LLVMLLD_ARCHBASE)" \
281 -DLLVM_EXTERNAL_CLANG_SOURCE_DIR:PATH="$(HOSTDIR)/Ports/host/clang/$(CLANG_ARCHBASE)" \
282 -DLLVM_TARGETS_TO_BUILD=$(LLVM_TARGETS) \
283 -DLLVM_DEFAULT_TARGET_TRIPLE=$(AROS_TARGET_CPU)-unknown-aros \
284 -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF
285 ifeq ($(AROS_HOST_ARCH),linux)
286 LLVM_CMAKEOPTIONS += -DBUILD_SHARED_LIBS=ON
287 # LLVM_CMAKEOPTIONS += -DLLVM_LINK_LLVM_DYLIB=ON
290 %fetch mmake=crosstools-clang-fetch archive=$(CLANG_ARCHBASE) \
291 archive_origins=$(LLVM_REPOSITORY) suffixes="tar.xz" \
292 location=$(PORTSSOURCEDIR) destination=$(HOSTDIR)/Ports/host/clang \
293 patches_specs=$(CLANG_ARCHBASE)-aros.diff:$(CLANG_ARCHBASE):-p1
295 %create_patch mmake=crosstools-clang-create-patch \
296 archive=$(CLANG_ARCHBASE) suffixes="tar.xz" \
297 destination=$(HOSTDIR)/Ports/host/clang
299 %fetch mmake=crosstools-llvm-lld-fetch archive=$(LLVMLLD_ARCHBASE) \
300 archive_origins=$(LLVM_REPOSITORY) suffixes="tar.xz" \
301 location=$(PORTSSOURCEDIR) destination=$(HOSTDIR)/Ports/host/llvm-lld
303 %create_patch mmake=crosstools-llvm-lld-create-patch \
304 archive=$(LLVMLLD_ARCHBASE) suffixes="tar.xz" \
305 destination=$(HOSTDIR)/Ports/host/llvm-lld
307 %fetch mmake=crosstools-llvm-fetch archive=$(LLVM_ARCHBASE) \
308 archive_origins=$(LLVM_REPOSITORY) suffixes="tar.xz" \
309 location=$(PORTSSOURCEDIR) destination=$(HOSTDIR)/Ports/host/llvm \
310 patches_specs=$(LLVM_ARCHBASE)-aros.diff:$(LLVM_ARCHBASE):-p1
312 %create_patch mmake=crosstools-llvm-create-patch \
313 archive=$(LLVM_ARCHBASE) suffixes="tar.xz" \
314 destination=$(HOSTDIR)/Ports/host/llvm
316 #MM crosstools-llvm-fetch : crosstools-clang-fetch crosstools-llvm-lld-fetch
318 #MM- tools-crosstools-llvm-i386 : crosstools-llvm-quick
319 #MM- tools-crosstools-llvm-x86_64 : crosstools-llvm-quick
320 #MM- tools-crosstools-llvm-ppc : crosstools-llvm-quick
321 #MM- tools-crosstools-llvm-arm : crosstools-llvm-quick
323 #MM- crosstools-llvm-quick : setup crosstools-llvm-fetch
325 %build_with_cmake mmake=crosstools-llvm package=llvm srcdir=$(HOSTDIR)/Ports/host/llvm/$(LLVM_ARCHBASE) \
326 prefix="$(CROSSTOOLSDIR)" maketarget=$(LLVM_CMAKETARGET) \
327 extraoptions="$(LLVM_CMAKEOPTIONS)" compiler=host