1 include $(SRCDIR)/config/aros.cfg
2 -include $(SRCDIR)/tools/crosstools/$(AROS_TOOLCHAIN).cfg
6 BINUTILS_VERSION = $(TARGET_BINUTILS_VER)
7 BINUTILS_VERSION_MAJOR = $(shell echo "$(BINUTILS_VERSION)" | cut -d"." -f1)
8 BINUTILS_VERSION_MINOR = $(shell echo "$(BINUTILS_VERSION)" | cut -d"." -f2)
9 BINUTILS_VERSION_PATCH = $(shell echo "$(BINUTILS_VERSION)" | cut -d"." -f3)
11 BINUTILS_EXTRA_OPTS := --target=$(AROS_TARGET_CPU)-aros
12 BINUTILS_EXTRA_OPTS += -bindir=$(CROSSTOOLSDIR)
13 BINUTILS_EXTRA_OPTS += --libdir=$(CROSSTOOLSDIR)/lib
14 BINUTILS_EXTRA_OPTS += --with-sysroot=$(AROS_DEVELOPER)
15 BINUTILS_EXTRA_OPTS += --disable-werror
16 BINUTILS_EXTRA_OPTS += --disable-nls
17 ifeq (yes, $(TARGET_LTO))
18 BINUTILS_EXTRA_OPTS += --enable-plugins --enable-lto
21 # Binutils 2.31 enables separate code for x86 by default
22 # however we do not handle it.
24 ifeq ($(shell test $(BINUTILS_VERSION_MAJOR) -gt 2; echo $$?),0)
25 BINUTILS_NOSEPCODE=yes
27 ifeq ($(shell test $(BINUTILS_VERSION_MAJOR) -gt 1; echo $$?),0)
28 ifeq ($(shell test $(BINUTILS_VERSION_MINOR) -gt 30; echo $$?),0)
29 BINUTILS_NOSEPCODE=yes
33 ifneq ($(BINUTILS_NOSEPCODE),no)
34 ifeq ($(AROS_TARGET_CPU),i386)
35 BINUTILS_EXTRA_OPTS += --enable-separate-code=no
37 ifeq ($(AROS_TARGET_CPU),x86_64)
38 BINUTILS_EXTRA_OPTS += --enable-separate-code=no
42 GCC_VERSION = $(TARGET_GCC_VER)
43 GCC_VERSION_MAJOR = $(shell echo "$(GCC_VERSION)" | cut -d"." -f1)
44 GCC_VERSION_MINOR = $(shell echo "$(GCC_VERSION)" | cut -d"." -f2)
45 GCC_VERSION_PATCH = $(shell echo "$(GCC_VERSION)" | cut -d"." -f3)
48 ifneq (no-objc,$(OBJC_TARGET))
49 GCC_LANGUAGES:=$(GCC_LANGUAGES),objc
51 ifneq (no-java,$(JAVA_TARGET))
52 GCC_LANGUAGES:=$(GCC_LANGUAGES),java
55 GCC_COMMON_OPTS := --target=$(AROS_TARGET_CPU)-aros
57 # ARM requires additional flags to determine CPU type and FP model
58 ifneq (,$(findstring arm,$(AROS_TARGET_CPU)))
59 GCC_COMMON_OPTS += --with-arch=$(GCC_DEFAULT_CPU)
60 GCC_COMMON_OPTS += --with-float=$(GCC_DEFAULT_FLOAT_ABI)
61 GCC_COMMON_OPTS += --with-fpu=$(GCC_DEFAULT_FPU)
62 GCC_COMMON_OPTS += --with-mode=$(GCC_DEFAULT_MODE)
63 GCC_COMMON_OPTS += --disable-libunwind-exceptions
65 # If we are building GCC >= 5, for x86 targets, enable libmpx
66 # ifeq ($(shell test $(GCC_VERSION_MAJOR) -gt 4; echo $$?),0)
67 # ifeq ($(AROS_TARGET_CPU),i386)
68 # GCC_COMMON_OPTS += --enable-libmpx
70 # ifeq ($(AROS_TARGET_CPU),x86_64)
71 # GCC_COMMON_OPTS += --enable-libmpx
74 GCC_COMMON_OPTS += --with-dwarf2
77 GCC_COMMON_OPTS += --with-sysroot=$(AROS_DEVELOPER)
78 GCC_COMMON_OPTS += --with-native-system-header-dir=/include
79 GCC_COMMON_OPTS += --bindir=$(CROSSTOOLSDIR)
80 GCC_COMMON_OPTS += --libdir=$(CROSSTOOLSDIR)/lib
81 GCC_COMMON_OPTS += --enable-languages=$(strip $(GCC_LANGUAGES))
82 GCC_COMMON_OPTS += --enable-long-long
83 GCC_COMMON_OPTS += --enable-version-specific-runtime-libs
84 GCC_COMMON_OPTS += --enable-frame-pointer
85 GCC_COMMON_OPTS += --with-isl=$(CROSSTOOLSDIR)
86 GCC_COMMON_OPTS += --disable-isl-version-check
87 GCC_COMMON_OPTS += --disable-bootstrap
88 GCC_COMMON_OPTS += --disable-sjlj-exceptions
89 GCC_COMMON_OPTS += --disable-tls
90 ifneq (yes,$(TARGET_LTO))
91 GCC_COMMON_OPTS += --disable-plugins
93 GCC_COMMON_OPTS += --disable-nls
94 GCC_COMMON_OPTS += --disable-libssp
95 GCC_COMMON_OPTS += --disable-libstdcxx-pch
96 GCC_COMMON_OPTS += --disable-build-with-cxx
97 GCC_COMMON_OPTS += --disable-build-poststage1-with-cxx
99 ifeq (,$(GCC_EXTRA_OPTS))
100 GCC_EXTRA_OPTS += $(GCC_COMMON_OPTS)
102 GCC_ENV=enable_libatomic=no
104 GCC_PATH = `LANG=en_US $(CROSSTOOLSDIR)/$(AROS_TARGET_CPU)-aros-gcc -print-search-dirs | grep "programs: =" | cut -c 12-`
108 GDB_EXTRA_OPTS := --target=$(AROS_TARGET_CPU)-aros
109 GDB_EXTRA_OPTS += --bindir=$(CROSSTOOLSDIR)
110 GDB_EXTRA_OPTS += --libdir=$(CROSSTOOLSDIR)/lib
112 GNU_REPOSITORY := gnu://
113 ifeq (,$(findstring -,$(GCC_VERSION)))
114 GCC_REPOSITORY := $(GNU_REPOSITORY)/gcc/gcc-$(GCC_VERSION)
116 GCC_REPOSITORY := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/snapshots/$(GCC_VERSION)
118 ISL_REPOSITORY := ftp://gcc.gnu.org/pub/gcc/infrastructure
119 MPC_REPOSITORY := ftp://ftp.gnu.org/gnu/mpc http://ftp.vim.org/ftp/gnu/mpc
121 binutils-installflag := $(CROSSTOOLSDIR)/.installflag-binutils-$(BINUTILS_VERSION)-$(AROS_TARGET_CPU)
122 gmp-installflag := $(CROSSTOOLSDIR)/.installflag-gmp-$(GMP_VERSION)
123 isl-installflag := $(CROSSTOOLSDIR)/.installflag-isl-$(ISL_VERSION)
124 mpfr-installflag := $(CROSSTOOLSDIR)/.installflag-mpfr-$(MPFR_VERSION)
125 mpc-installflag := $(CROSSTOOLSDIR)/.installflag-mpc-$(MPC_VERSION)
126 gcc-installflag := $(CROSSTOOLSDIR)/.installflag-gcc-$(GCC_VERSION)-$(AROS_TARGET_CPU)
127 gdb-installflag := $(CROSSTOOLSDIR)/.installflag-gdb-$(GDB_VERSION)
129 #MM- tools-crosstools : tools-crosstools-$(AROS_TOOLCHAIN)-$(AROS_TARGET_CPU)
131 #MM- tools-crosstools-gnu-m68k : tools-crosstools-gcc crosstools-gcc
132 #MM- tools-crosstools-gnu-i386 : tools-crosstools-gcc crosstools-gcc
133 #MM- tools-crosstools-gnu-x86_64 : tools-crosstools-gcc crosstools-gcc
134 #MM- tools-crosstools-gnu-ppc : tools-crosstools-gcc crosstools-gcc
135 #MM- tools-crosstools-gnu-arm : tools-crosstools-gcc crosstools-gcc
136 #MM- tools-crosstools-gnu-armeb : tools-crosstools-gcc crosstools-gcc
137 #MM- tools-crosstools-gnu-aarch64 : tools-crosstools-gcc crosstools-gcc
139 #MM tools-crosstools-gcc : tools-crosstools-binutils tools-crosstools-collect-aros \
140 #MM tools-crosstools-gmp \
141 #MM tools-crosstools-isl \
142 #MM tools-crosstools-mpfr \
143 #MM tools-crosstools-mpc
145 # We intentionally bypass the usual fetch_and_build macro below and call mmakefile and gcc makefile
146 # targets directly. This is in order to not build the core-linklibs target during binutils and gcc
147 # builds because we want these static linker libraries be generated by the cross tool chain we are building
148 # right here. Additionally, we also want to maintain our own install flag files inside the directory
149 # specified by --with-aros-toolchain-install. This directory may even reside outside of the usual aros
150 # build directory and can be reused between complete rebuilds.
153 tools-crosstools-gmp :
154 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
155 || ! $(TEST) -f $(gmp-installflag) ; then \
156 $(RM) $(HOSTGENDIR)/$(CURDIR)/gmp/.files-touched \
157 && $(MAKE) -f ./mmakefile crosstools-gmp--fetch \
158 && $(MAKE) -f ./mmakefile crosstools-gmp--build_and_install-quick \
159 && $(TOUCH) $(gmp-installflag) ; \
162 %fetch_and_build mmake=crosstools-gmp package=gmp version=$(GMP_VERSION) compiler=host \
163 package_repo="$(GNU_REPOSITORY)/gmp" \
165 prefix="$(CROSSTOOLSDIR)" usecppflags=no \
166 extraoptions="--bindir=$(CROSSTOOLSDIR) --libdir=$(CROSSTOOLSDIR)/lib --disable-shared"
169 tools-crosstools-isl :
170 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
171 || ! $(TEST) -f $(isl-installflag) ; then \
172 $(RM) $(HOSTGENDIR)/$(CURDIR)/isl/.files-touched \
173 && $(MAKE) -f ./mmakefile crosstools-isl--fetch \
174 && $(MAKE) -f ./mmakefile crosstools-isl--build_and_install-quick \
175 && $(TOUCH) $(isl-installflag) ; \
178 %fetch_and_build mmake=crosstools-isl package=isl version=$(ISL_VERSION) compiler=host \
179 package_repo="$(ISL_REPOSITORY)" \
181 prefix="$(CROSSTOOLSDIR)" usecppflags=no \
182 extraoptions="--bindir=$(CROSSTOOLSDIR) --libdir=$(CROSSTOOLSDIR)/lib --without-piplib --disable-shared"
185 tools-crosstools-mpfr :
186 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
187 || ! $(TEST) -f $(mpfr-installflag) ; then \
188 $(RM) $(HOSTGENDIR)/$(CURDIR)/mpfr/.files-touched \
189 && $(MAKE) -f ./mmakefile crosstools-mpfr--fetch \
190 && $(MAKE) -f ./mmakefile crosstools-mpfr--build_and_install-quick \
191 && $(TOUCH) $(mpfr-installflag) ; \
194 %fetch_and_build mmake=crosstools-mpfr package=mpfr version=$(MPFR_VERSION) compiler=host \
195 package_repo="$(GNU_REPOSITORY)/mpfr" \
197 prefix="$(CROSSTOOLSDIR)" usecppflags=no \
198 extraoptions="--bindir=$(CROSSTOOLSDIR) --libdir=$(CROSSTOOLSDIR)/lib --disable-shared"
201 tools-crosstools-mpc :
202 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
203 || ! $(TEST) -f $(mpc-installflag) ; then \
204 $(RM) $(HOSTGENDIR)/$(CURDIR)/mpc/.files-touched \
205 && $(MAKE) -f ./mmakefile crosstools-mpc--fetch \
206 && $(MAKE) -f ./mmakefile crosstools-mpc--build_and_install-quick \
207 && $(TOUCH) $(mpc-installflag) ; \
210 %fetch_and_build mmake=crosstools-mpc package=mpc version=$(MPC_VERSION) compiler=host \
211 package_repo="$(MPC_REPOSITORY)" suffixes="tar.gz" \
213 prefix="$(CROSSTOOLSDIR)" usecppflags=no \
214 extraoptions="--bindir=$(CROSSTOOLSDIR) --libdir=$(CROSSTOOLSDIR)/lib --disable-shared"
217 tools-crosstools-binutils :
218 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
219 || ! $(TEST) -f $(binutils-installflag) ; then \
220 $(RM) $(HOSTGENDIR)/$(CURDIR)/binutils/.files-touched \
221 && $(MAKE) -f ./mmakefile crosstools-binutils--fetch \
222 && $(MAKE) -f ./mmakefile crosstools-binutils--build_and_install-quick \
223 && $(TOUCH) $(binutils-installflag) ; \
226 %fetch_and_build mmake=crosstools-binutils package=binutils version=$(BINUTILS_VERSION) compiler=host \
227 package_repo="$(GNU_REPOSITORY)/binutils" \
229 prefix="$(CROSSTOOLSDIR)" usecppflags=no \
230 extraoptions="$(BINUTILS_EXTRA_OPTS)"
232 HOST_CFLAGS := $(HOST_CFLAGS) $(HOST_GNU89_INLINE)
235 tools-crosstools-gcc :
236 @$(IF) ! $(TEST) -f $(gcc-installflag) ; then \
237 $(RM) $(HOSTGENDIR)/$(CURDIR)/gcc/.files-touched \
238 && $(MAKE) -f ./mmakefile crosstools-gcc--fetch \
239 && $(MAKE) -f ./mmakefile crosstools-gcc--configure \
240 && $(MAKE) -C $(HOSTGENDIR)/$(CURDIR)/gcc all-gcc \
241 && $(MAKE) -j1 -C $(HOSTGENDIR)/$(CURDIR)/gcc install-gcc \
242 && $(TOUCH) $(gcc-installflag) ; \
244 @$(IF) $(TEST) -f $(gcc-installflag); then \
245 $(SED) -i -e "s|@aros_target_cc_path@|$(GCC_PATH)|g" $(TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX)-aros-ld ; \
248 %fetch_and_build mmake=crosstools-gcc package=gcc version=$(GCC_VERSION) compiler=host \
249 package_repo="$(GCC_REPOSITORY)" suffixes="tar.bz2 tar.gz tar.xz" \
251 prefix="$(CROSSTOOLSDIR)" usecppflags=no \
252 extraoptions="$(GCC_EXTRA_OPTS)" config_env_extra="$(GCC_ENV)"
255 tools-crosstools-gdb :
256 @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
257 || ! $(TEST) -f $(gdb-installflag) ; then \
258 $(RM) $(HOSTGENDIR)/$(CURDIR)/gdb/.files-touched \
259 && $(MAKE) -f ./mmakefile crosstools-gdb--fetch \
260 && $(MAKE) -f ./mmakefile crosstools-gdb--build_and_install-quick \
261 && $(TOUCH) $(gdb-installflag) ; \
264 %fetch_and_build mmake=crosstools-gdb package=gdb version=$(GDB_VERSION) compiler=host \
265 package_repo="$(GNU_REPOSITORY)/gdb" \
267 prefix="$(CROSSTOOLSDIR)" \
268 extraoptions="$(GDB_EXTRA_OPTS)"