Import SB128-v5.24 to main branch
[AROS.git] / tools / crosstools / mmakefile.src
blob062eefb04788cc7a215d1178461c25a956ed409f
1 include $(TOP)/config/make.cfg
3 BINUTILS_VERSION = 2.20.1
5 GCC_LANGUAGES = c,c++
7 GCC_EXTRA_OPTS = \
8   --target=$(AROS_TARGET_CPU)-aros --bindir=$(CROSSTOOLSDIR) --enable-languages=$(GCC_LANGUAGES) \
9   --enable-long-long --enable-version-specific-runtime-libs
11 ifeq ($(AROS_TARGET_CPU), arm)
12   # FIXME: Update patch to work with --with-sysroot then set GCC_INCLUDES and GCC_PATH for --enable-crosstools
13   GCC_VERSION     = 4.4.2
14   GCC_EXTRA_OPTS += --with-headers=$(AROS_DEVELOPMENT)/include --with-libs=$(AROS_DEVELOPMENT)/lib
15 else
16   GCC_VERSION     = 4.2.4
17   GCC_EXTRA_OPTS += --with-sysroot=$(AROS_DEVELOPMENT)
18   GCC_INCLUDES    = $(CROSSTOOLSDIR)/lib/gcc/$(AROS_TARGET_CPU)-aros/$(GCC_VERSION)/include
19   GCC_PATH        = `LANG=en_US $(CROSSTOOLSDIR)/$(AROS_TARGET_CPU)-aros-gcc -print-search-dirs | grep "programs: =" | cut -c 12-`
20 endif
22 GNU_REPOSITORY := gnu://
24 binutils-installflag := $(CROSSTOOLSDIR)/.installflag-binutils-$(BINUTILS_VERSION)
25 gcc-installflag      := $(CROSSTOOLSDIR)/.installflag-gcc-$(GCC_VERSION)
27 #MM- tools-crosstools : tools-crosstools-$(AROS_TARGET_CPU)
29 # m68k build is disabled, since there is no AROS cross compiler yet, just m68k-elf cross compiler
30 ##MM- tools-crosstools-m68k  : tools-crosstools-gcc crosstools-gcc
31 #MM- tools-crosstools-i386   : tools-crosstools-gcc crosstools-gcc
32 #MM- tools-crosstools-x86_64 : tools-crosstools-gcc crosstools-gcc
33 #MM- tools-crosstools-ppc    : tools-crosstools-gcc crosstools-gcc
34 # arm still needs linklibs be build before, can be removed after patch is updated to work with --with-sysroot
35 #MM- tools-crosstools-arm    : core-linklibs tools-crosstools-gcc crosstools-gcc
37 #MM tools-crosstools-gcc : tools-crosstools-binutils tools-crosstools-collect-aros compiler-includes compiler-clib-includes
39 # We intentionally bypass the usual fetch_and_build macro below and call mmakefile and gcc makefile
40 # targets directly. This is in order to not build the core-linklibs target during binutils and gcc
41 # builds because we want these static linker libraries be generated by the cross tool chain we are building
42 # right here. Additionally, we also want to maintain our own install flag files inside the directory
43 # specified by --with-crosstools. This directory may even reside outside of the usual aros build directory
44 # and can be reused between complete rebuilds.
46 #MM
47 tools-crosstools-binutils :
48         @$(IF) ! $(TEST) -d $(CROSSTOOLSDIR) \
49             || ! $(TEST) -f $(binutils-installflag) \
50             || $(TEST) "$(AROS_DEVELOPMENT)" != "$(shell $(CAT) 2>/dev/null $(binutils-installflag))" ; then \
51                $(RM) $(HOSTGENDIR)/$(CURDIR)/binutils/.files-touched \
52             && $(MAKE) -f ./mmakefile crosstools-binutils--fetch \
53             && $(MAKE) -f ./mmakefile crosstools-binutils--build_and_install-quick \
54             && $(ECHO) $(AROS_DEVELOPMENT) > $(binutils-installflag) ; \
55         fi
57 %fetch_and_build mmake=crosstools-binutils package=binutils version=$(BINUTILS_VERSION) compiler=host \
58         package_repo="$(GNU_REPOSITORY)/binutils" \
59         patch=yes \
60         prefix="$(CROSSTOOLSDIR)" \
61         extraoptions="--target=$(AROS_TARGET_CPU)-aros -bindir=$(CROSSTOOLSDIR) --with-sysroot=$(AROS_DEVELOPMENT) --disable-werror"
63 HOST_CFLAGS := $(HOST_CFLAGS) $(HOST_GNU89_INLINE)
65 #MM
66 tools-crosstools-gcc :
67         @$(SED) -i -e "s|@aros_target_cc_includes@|$(GCC_INCLUDES)|g" $(GENDIR)/config/specs
68         @$(IF) ! $(TEST) -f $(gcc-installflag) \
69             || $(TEST) "$(AROS_DEVELOPMENT)" != "$(shell $(CAT) 2>/dev/null $(gcc-installflag))" ; then \
70                $(RM) $(HOSTGENDIR)/$(CURDIR)/gcc/.files-touched \
71             && $(MAKE) -f ./mmakefile crosstools-gcc--fetch \
72             && $(MAKE) -f ./mmakefile crosstools-gcc--configure \
73             && $(MAKE) -C $(HOSTGENDIR)/$(CURDIR)/gcc all-gcc \
74             && $(MAKE) -j1 -C $(HOSTGENDIR)/$(CURDIR)/gcc install-gcc \
75             && $(ECHO) $(AROS_DEVELOPMENT) > $(gcc-installflag) ; \
76         fi
77         @$(IF) $(TEST) -f $(gcc-installflag); then \
78             $(SED) -i -e "s|@aros_target_cc_path@|$(GCC_PATH)|g" $(TOOLDIR)/$(AROS_TARGET_CPU)-$(AROS_TARGET_ARCH)$(AROS_TARGET_SUFFIX)-aros-ld ; \
79         fi
81 %fetch_and_build mmake=crosstools-gcc package=gcc version=$(GCC_VERSION) compiler=host \
82         package_repo="$(GNU_REPOSITORY)/gcc/gcc-$(GCC_VERSION)" \
83         patch=yes \
84         prefix="$(CROSSTOOLSDIR)" \
85         extraoptions="$(GCC_EXTRA_OPTS)"