1
0
mirror of https://gitlab.os-k.eu/os-k-team/cross-cc-builder.git synced 2023-08-25 14:03:10 +02:00

Now quite modular

This commit is contained in:
Adrien Bourmault 2020-06-01 22:12:55 +02:00
parent 0e08577ac7
commit 5881cb46cc
No known key found for this signature in database
GPG Key ID: AFEE5788AEE3F4EC
2 changed files with 23 additions and 11 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ gcc*
binutils*
bin/*
build*
cross-cc*

View File

@ -22,8 +22,8 @@
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
.PHONY: retrieve compile showenv deflate configurebinutils binutils gcc clean
.DEFAULT_GOAL := gcc
.PHONY: retrieve compile showenv deflate clean cross-cc
.DEFAULT_GOAL := cross-cc
## VERSIONS ------------------------------------------------------------------ #
@ -67,27 +67,34 @@ showenv:
@echo Target : $(TARGET)
@echo Thread number : $(NTHREADS)
retrieve: showenv
$(GCCTARNAME):
@echo ${CL2}[$@] ${NC}Downloading GCC sources...${CL3}
@wget $(GCC_SOURCES) -O $(GCCTARNAME) -q -c --show-progress
@echo ${CL2}[$@] ${CL}Success.${CL3}
$(BINUTILSTARNAME):
@echo ${CL2}[$@] ${NC}Downloading BINUTILS sources...${CL3}
@wget $(BINUTILS_SOURCES) -O $(BINUTILSTARNAME) -q -c --show-progress
@echo ${CL2}[$@] ${CL}Success.${CL3}
deflate:
@echo ${CL2}[$@] ${NC}Deflate GCC sources...${CL3}
$(GCC_NAME): $(BINUTILSTARNAME)
@echo ${CL2}[$@] ${NC}Deflate $(GCC_NAME) sources...${CL3}
@tar -xaf $(GCCTARNAME) --skip-old-files
@echo ${CL2}[$@] ${CL}Success.${CL3}
$(BINUTILS_NAME): $(GCCTARNAME)
@echo ${CL2}[$@] ${NC}Deflate $(BINUTILS_NAME) sources...${CL3}
@tar -xaf $(BINUTILSTARNAME) --skip-old-files
@echo ${CL2}[$@] ${CL}Success.${CL3}
configurebinutils: retrieve deflate
build-binutils: $(BINUTILS_NAME)
@echo ${CL2}[$@] ${NC}Configuring $(BINUTILS_NAME)...${CL3}
@mkdir -p build-binutils
cd build-binutils && ../$(BINUTILS_NAME)/configure --target=$(TARGET) --prefix="$(PREFIX)" --with-sysroot --disable-nls --disable-werror
@echo ${CL2}[$@] ${CL}Success.${CL3}
binutils: configurebinutils
$(PREFIX)/bin/x86_64-elf-objcopy: build-binutils
@echo ${CL2}[$@] ${NC}Compiling $(BINUTILS_NAME)...${CL3}
cd build-binutils && make -j $(NTHREADS)
@echo ${CL2}[$@] ${NC}Compiling $(BINUTILS_NAME)...${CL3}
@ -95,7 +102,7 @@ binutils: configurebinutils
cd build-binutils && make install -j $(NTHREADS)
@echo ${CL2}[$@] ${CL}Success.${CL3}
configuregcc:
build-gcc: $(GCC_NAME)
@echo ${CL2}[$@] ${NC}Configuring $(GCC_NAME)...${CL3}
@cp multilib.opt $(GCC_NAME)/gcc/config/i386/t-x86_64-elf
@patch $(GCC_NAME)/gcc/config.gcc < patch-red-zone.diff
@ -103,7 +110,7 @@ configuregcc:
cd build-gcc && ../$(GCC_NAME)/configure --target=$(TARGET) --prefix="$(PREFIX)" --disable-nls --enable-languages=c,c++ --without-headers
@echo ${CL2}[$@] ${CL}Success.${CL3}
gcc: binutils configuregcc
$(PREFIX)/bin/x86_64-elf-gcc: $(PREFIX)/bin/x86_64-elf-objcopy build-gcc
@echo ${CL2}[$@] ${NC}Compiling $(GCC_NAME)...${CL3}
cd build-gcc && make all-gcc -j $(NTHREADS)
cd build-gcc && make all-target-libgcc -j $(NTHREADS)
@ -114,9 +121,11 @@ gcc: binutils configuregcc
clean:
@mkdir -p build-gcc build-binutils
@cd build-gcc && rm -rf *
@cd build-binutils && rm -rf *
@rm -rf build-gcc
@rm -rf build-binutils
@rm -rf cross-cc
@rm -rf $(GCC_NAME)/gcc/config/i386/t-x86_64-elf
@patch -R $(GCC_NAME)/gcc/config.gcc < patch-red-zone.diff
@echo ${CL2}[$@] ${CL}Success.${CL3}
@ -124,3 +133,5 @@ remove_all:
@rm -rf gcc*
@rm -rf bin*
@echo ${CL2}[$@] ${CL}Success.${CL3}
cross-cc: $(PREFIX)/bin/x86_64-elf-gcc