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 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
11 GCC_CHANGES := config.sub gcc/config.gcc gcc/config/acess2.h libgcc/config.host
12 # libstdc++-v3/crossconfig.m4 config/override.m4
15 GCC_TARGETS := gcc target-libgcc
18 PREFIX := $(OUTDIR)-BUILD
19 BDIR_GCC := build-$(ARCH)/gcc
20 BDIR_BINUTILS := build-$(ARCH)/binutils
22 .PHONY: all clean binutils gcc include
24 all: include binutils gcc
28 mkdir -p $(SYSROOT)/usr
29 ln -sf $(ACESSDIR)/Usermode/include $(SYSROOT)/usr/include
30 ln -sf $(ACESSDIR)/Usermode/Output/$(ARCH)/Libs $(SYSROOT)/usr/lib
32 gcc: $(GCC_DIR) $(PREFIX)/bin/$(TARGET)-gcc
34 binutils: $(BINUTILS_DIR) $(PREFIX)/bin/$(TARGET)-ld
37 $(RM) -rf $(BINUTILS_DIR) $(GCC_DIR) build-$(ARCH)
39 $(BINUTILS_DIR) $(GCC_DIR): %: %.tar.bz2
41 $(warning $(BINUTILS_DIR) $(GCC_DIR))
43 $(GCC_DIR)/%: patches/gcc/%.patch
45 #@tar -xf $(GCC_ARCHIVE) $@
47 $(GCC_DIR)/%: patches/gcc/%
51 $(BINUTILS_DIR)/%: patches/binutils/%.patch
53 #@tar -xf $(BINUTILS_ARCHIVE) $@
55 $(BINUTILS_DIR)/%: patches/binutils/%
59 $(GCC_DIR)/libstdc++-v3/configure: $(GCC_DIR)/libstdc++-v3/crossconfig.m4
60 cd $(GCC_DIR)/libstdc++-v3/ && autoconf
62 $(BDIR_BINUTILS)/Makefile: $(addprefix $(BINUTILS_DIR)/,$(BINUTILS_CHANGES))
63 @mkdir -p $(BDIR_BINUTILS)
64 @cd $(BDIR_BINUTILS) && ../../$(BINUTILS_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls "--with-sysroot=$(SYSROOT)" --enable-shared
66 $(PREFIX)/bin/$(TARGET)-ld: $(BDIR_BINUTILS)/Makefile
67 @make -C $(BDIR_BINUTILS) all -j $(PARLEVEL)
68 @make -C $(BDIR_BINUTILS) install
70 $(BDIR_GCC)/Makefile: Makefile $(addprefix $(GCC_DIR)/,$(GCC_CHANGES)) $(GCC_DIR)/libstdc++-v3/configure
72 @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)"
74 $(PREFIX)/bin/$(TARGET)-gcc: $(BDIR_GCC)/Makefile
75 @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC) $(GCC_TARGETS:%=all-%) -j $(PARLEVEL)
76 @PATH=$(PREFIX)/bin:$$PATH make -C $(BDIR_GCC) $(GCC_TARGETS:%=install-%)