6 GCC_ARCHIVE:=$(lastword $(sort $(wildcard gcc-*.tar.bz2)))
7 GCC_DIR:=$(GCC_ARCHIVE:%.tar.bz2=%)
8 BINUTILS_ARCHIVE:=$(lastword $(sort $(wildcard binutils-*.tar.bz2)))
9 BINUTILS_DIR:=$(BINUTILS_ARCHIVE:%.tar.bz2=%)
11 ifeq ($(GCC_ARCHIVE),)
12 $(warning Unable to find a GCC archive matching gcc-*.tar.bz2)
13 $(error No archive found)
15 ifeq ($(BINUTILS_ARCHIVE),)
16 $(warning Unable to find a binutils archive matching binutils-*.tar.bz2)
17 $(error No archive found)
20 BINUTILS_CHANGES := config.sub bfd/config.bfd gas/configure.tgt ld/configure.tgt ld/emulparams/acess2_i386.sh ld/emulparams/acess2_amd64.sh ld/emulparams/acess2_arm.sh ld/Makefile.in
21 GCC_CHANGES := config.sub gcc/config.gcc gcc/config/acess2.h libgcc/config.host gcc/config/acess2.opt
22 # libstdc++-v3/crossconfig.m4 config/override.m4
25 GCC_TARGETS := gcc target-libgcc
28 PREFIX := $(OUTDIR)-BUILD
29 BDIR_GCC := build-$(ARCH)/gcc/
30 BDIR_BINUTILS := build-$(ARCH)/binutils/
32 .PHONY: all clean binutils gcc include
34 all: include binutils gcc
38 mkdir -p $(SYSROOT)/usr
39 ln -sf $(ACESSDIR)/Usermode/include $(SYSROOT)/usr/include
40 ln -sf $(ACESSDIR)/Usermode/Output/$(ARCH)/Libs $(SYSROOT)/usr/lib
42 gcc: $(GCC_DIR) $(PREFIX)/bin/$(TARGET)-gcc
44 binutils: $(BINUTILS_DIR) $(PREFIX)/bin/$(TARGET)-ld
47 $(RM) -rf $(BINUTILS_DIR) $(GCC_DIR) build-$(ARCH)
49 $(BINUTILS_DIR) $(GCC_DIR): %: %.tar.bz2
51 $(warning $(BINUTILS_DIR) $(GCC_DIR))
53 $(GCC_DIR)/%: patches/gcc/%.patch
55 @tar -xf $(GCC_ARCHIVE) $@
57 $(GCC_DIR)/%: patches/gcc/%
61 $(BINUTILS_DIR)/%: patches/binutils/%.patch
63 @tar -xf $(BINUTILS_ARCHIVE) $@
65 $(BINUTILS_DIR)/%: patches/binutils/%
69 $(GCC_DIR)/libstdc++-v3/configure: $(GCC_DIR)/libstdc++-v3/crossconfig.m4
70 cd $(GCC_DIR)/libstdc++-v3/ && autoconf
72 $(BDIR_BINUTILS)/Makefile: $(addprefix $(BINUTILS_DIR)/,$(BINUTILS_CHANGES))
73 @mkdir -p $(BDIR_BINUTILS)
74 @cd $(BDIR_BINUTILS) && ../../$(BINUTILS_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls "--with-sysroot=$(SYSROOT)" --enable-shared --without-docdir
76 $(PREFIX)/bin/$(TARGET)-ld: $(BDIR_BINUTILS)/Makefile
77 @make -C $(BDIR_BINUTILS) all -j $(PARLEVEL)
78 @make -C $(BDIR_BINUTILS) install
80 $(BDIR_GCC)/Makefile: Makefile $(addprefix $(GCC_DIR)/,$(GCC_CHANGES)) $(GCC_DIR)/libstdc++-v3/configure
82 @cd $(BDIR_GCC) && PATH=$(PREFIX)/bin:$$PATH ../../$(GCC_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls --enable-langs=c,c++ --includedir=$(ACESSDIR)/Usermode/include "--with-sysroot=$(SYSROOT)" --without-docdir --enable-threads=posix
83 @echo "MAKEINFO = :" >> $(BDIR_GCC)/Makefile
85 $(PREFIX)/bin/$(TARGET)-gcc: $(BDIR_GCC)/Makefile
86 @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC) $(GCC_TARGETS:%=all-%) -j $(PARLEVEL)
87 @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC)libstdc++-v3/ all-target-libsupc++ -j $(PARLEVEL)
88 @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC) $(GCC_TARGETS:%=install-%)