réplica de
https://github.com/Arnau478/quark.git
synced 2024-11-23 12:58:07 +01:00
Initial code organization and GCC+binutils toolchain
This commit is contained in:
pare
32ccfd1de0
commit
ce90791747
S'han modificat 4 arxius amb 88 adicions i 0 eliminacions
3
.gitignore
vendido
Normal file
3
.gitignore
vendido
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
./quark
|
||||||
|
build/
|
||||||
|
toolchain/
|
9
Makefile
Normal file
9
Makefile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
include scripts/toolchain.mk
|
||||||
|
|
||||||
|
BUILD_DIR?=build/
|
||||||
|
|
||||||
|
quark: build-dir $(BUILD_DIR)/quark
|
||||||
|
|
||||||
|
.PHONY: build-dir
|
||||||
|
build-dir:
|
||||||
|
@mkdir -p $(BUILD_DIR)
|
15
config/toolchain.conf
Normal file
15
config/toolchain.conf
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# TOOLCHAIN CONFIGURATION FILE
|
||||||
|
|
||||||
|
export TARGET = i686-elf
|
||||||
|
export TARGET_ASM = nasm
|
||||||
|
export TARGET_ASMFLAGS =
|
||||||
|
export TARGET_CFLAGS = -std=c99 -g
|
||||||
|
export TARGET_CC = $(TARGET)-gcc
|
||||||
|
export TARGET_CXX = $(TARGET)-g++
|
||||||
|
export TARGET_LD = $(TARGET)-gcc
|
||||||
|
export TARGET_LINKFLAGS =
|
||||||
|
export TARGET_LIBS =
|
||||||
|
BINUTILS_VERSION = 2.37
|
||||||
|
BINUTILS_URL = https://ftp.gnu.org/gnu/binutils/binutils-$(BINUTILS_VERSION).tar.xz
|
||||||
|
GCC_VERSION = 11.1.0
|
||||||
|
GCC_URL = https://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.gz
|
61
scripts/toolchain.mk
Normal file
61
scripts/toolchain.mk
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
include config/toolchain.conf
|
||||||
|
|
||||||
|
TOOLCHAIN_PREFIX = $(abspath toolchain/$(TARGET))
|
||||||
|
export PATH := $(TOOLCHAIN_PREFIX)/bin:$(PATH)
|
||||||
|
|
||||||
|
toolchain: toolchain_binutils toolchain_gcc
|
||||||
|
|
||||||
|
BINUTILS_SRC = toolchain/binutils-$(BINUTILS_VERSION)
|
||||||
|
BINUTILS_BUILD = toolchain/binutils-build-$(BINUTILS_VERSION)
|
||||||
|
|
||||||
|
toolchain_binutils: $(TOOLCHAIN_PREFIX)/bin/i686-elf-ld
|
||||||
|
|
||||||
|
$(TOOLCHAIN_PREFIX)/bin/i686-elf-ld: $(BINUTILS_SRC).tar.xz
|
||||||
|
cd toolchain && tar -xf binutils-$(BINUTILS_VERSION).tar.xz
|
||||||
|
mkdir $(BINUTILS_BUILD)
|
||||||
|
cd $(BINUTILS_BUILD) && CFLAGS= ASMFLAGS= CC= CXX= LD= ASM= LINKFLAGS= LIBS= ../binutils-$(BINUTILS_VERSION)/configure \
|
||||||
|
--prefix="$(TOOLCHAIN_PREFIX)" \
|
||||||
|
--target=$(TARGET) \
|
||||||
|
--with-sysroot \
|
||||||
|
--disable-nls \
|
||||||
|
--disable-werror
|
||||||
|
$(MAKE) -j8 -C $(BINUTILS_BUILD)
|
||||||
|
$(MAKE) -C $(BINUTILS_BUILD) install
|
||||||
|
|
||||||
|
$(BINUTILS_SRC).tar.xz:
|
||||||
|
mkdir -p toolchain
|
||||||
|
cd toolchain && wget $(BINUTILS_URL)
|
||||||
|
|
||||||
|
|
||||||
|
GCC_SRC = $(abspath toolchain/gcc-$(GCC_VERSION))
|
||||||
|
GCC_BUILD = toolchain/gcc-build-$(GCC_VERSION)
|
||||||
|
|
||||||
|
toolchain_gcc: $(TOOLCHAIN_PREFIX)/bin/i686-elf-gcc
|
||||||
|
|
||||||
|
$(TOOLCHAIN_PREFIX)/bin/i686-elf-gcc: $(TOOLCHAIN_PREFIX)/bin/i686-elf-ld $(GCC_SRC).tar.gz
|
||||||
|
cd toolchain && tar -xf $(GCC_SRC).tar.gz
|
||||||
|
cd toolchain/gcc-$(GCC_VERSION) && ./contrib/download_prerequisites
|
||||||
|
mkdir -p $(GCC_BUILD)
|
||||||
|
cd $(GCC_BUILD) && CFLAGS= ASMFLAGS= CC= CXX= LD= ASM= LINKFLAGS= LIBS= ../gcc-$(GCC_VERSION)/configure \
|
||||||
|
--prefix="$(TOOLCHAIN_PREFIX)" \
|
||||||
|
--target=$(TARGET) \
|
||||||
|
--disable-nls \
|
||||||
|
--enable-languages=c,c++ \
|
||||||
|
--without-headers
|
||||||
|
$(MAKE) -j8 -C $(GCC_BUILD) all-gcc all-target-libgcc
|
||||||
|
$(MAKE) -C $(GCC_BUILD) install-gcc install-target-libgcc
|
||||||
|
|
||||||
|
$(GCC_SRC).tar.gz:
|
||||||
|
mkdir -p toolchain
|
||||||
|
cd toolchain && wget $(GCC_URL)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Clean
|
||||||
|
#
|
||||||
|
clean-toolchain:
|
||||||
|
rm -rf $(GCC_BUILD) $(GCC_SRC) $(BINUTILS_BUILD) $(BINUTILS_SRC)
|
||||||
|
|
||||||
|
clean-toolchain-all:
|
||||||
|
rm -rf toolchain/*
|
||||||
|
|
||||||
|
.PHONY: toolchain toolchain_binutils toolchain_gcc clean-toolchain clean-toolchain-all
|
Loading…
Referencia en una nova incidència