5 GCC_ARCHIVE:=$(lastword $(sort $(wildcard gcc-*.tar.bz2)))
6 GCC_DIR:=$(GCC_ARCHIVE:%.tar.bz2=%)
7 BINUTILS_ARCHIVE:=$(lastword $(sort $(wildcard binutils-*.tar.bz2)))
8 BINUTILS_DIR:=$(BINUTILS_ARCHIVE:%.tar.bz2=%)
10 ifeq ($(GCC_ARCHIVE),)
11 $(warning Unable to find a GCC archive matching gcc-*.tar.bz2)
12 $(error No archive found)
14 ifeq ($(BINUTILS_ARCHIVE),)
15 $(warning Unable to find a binutils archive matching binutils-*.tar.bz2)
16 $(error No archive found)
19 BINUTILS_CHANGES := config.sub bfd/config.bfd gas/configure.tgt ld/configure.tgt ld/emulparams/acess2_i386.sh ld/emulparams/acess2_amd64.sh ld/Makefile.in
20 GCC_CHANGES := config.sub gcc/config.gcc gcc/config/acess2.h libgcc/config.host gcc/config/acess2.opt
21 # libstdc++-v3/crossconfig.m4 config/override.m4
24 GCC_TARGETS := gcc target-libgcc
27 PREFIX := $(OUTDIR)-BUILD
28 BDIR_GCC := build-$(ARCH)/gcc
29 BDIR_BINUTILS := build-$(ARCH)/binutils
31 .PHONY: all clean binutils gcc include
33 all: include binutils gcc
37 mkdir -p $(SYSROOT)/usr
38 ln -sf $(ACESSDIR)/Usermode/include $(SYSROOT)/usr/include
39 ln -sf $(ACESSDIR)/Usermode/Output/$(ARCH)/Libs $(SYSROOT)/usr/lib
41 gcc: $(GCC_DIR) $(PREFIX)/bin/$(TARGET)-gcc
43 binutils: $(BINUTILS_DIR) $(PREFIX)/bin/$(TARGET)-ld
46 $(RM) -rf $(BINUTILS_DIR) $(GCC_DIR) build-$(ARCH)
48 $(BINUTILS_DIR) $(GCC_DIR): %: %.tar.bz2
50 $(warning $(BINUTILS_DIR) $(GCC_DIR))
52 $(GCC_DIR)/%: patches/gcc/%.patch
54 @tar -xf $(GCC_ARCHIVE) $@
56 $(GCC_DIR)/%: patches/gcc/%
60 $(BINUTILS_DIR)/%: patches/binutils/%.patch
62 @tar -xf $(BINUTILS_ARCHIVE) $@
64 $(BINUTILS_DIR)/%: patches/binutils/%
68 $(GCC_DIR)/libstdc++-v3/configure: $(GCC_DIR)/libstdc++-v3/crossconfig.m4
69 cd $(GCC_DIR)/libstdc++-v3/ && autoconf
71 $(BDIR_BINUTILS)/Makefile: $(addprefix $(BINUTILS_DIR)/,$(BINUTILS_CHANGES))
72 @mkdir -p $(BDIR_BINUTILS)
73 @cd $(BDIR_BINUTILS) && ../../$(BINUTILS_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls "--with-sysroot=$(SYSROOT)" --enable-shared --without-docdir
75 $(PREFIX)/bin/$(TARGET)-ld: $(BDIR_BINUTILS)/Makefile
76 @make -C $(BDIR_BINUTILS) all -j $(PARLEVEL)
77 @make -C $(BDIR_BINUTILS) install
79 $(BDIR_GCC)/Makefile: Makefile $(addprefix $(GCC_DIR)/,$(GCC_CHANGES)) $(GCC_DIR)/libstdc++-v3/configure
81 @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
82 @echo "MAKEINFO = :" >> $(BDIR_GCC)/Makefile
84 $(PREFIX)/bin/$(TARGET)-gcc: $(BDIR_GCC)/Makefile
85 @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC) $(GCC_TARGETS:%=all-%) -j $(PARLEVEL)
86 @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC) $(GCC_TARGETS:%=install-%)