cross-cc-builder/Makefile

88 lines
3.5 KiB
Makefile
Raw Normal View History

#=----------------------------------------------------------------------------=#
# OS/K CROSS COMPILER BUILDER #
# #
# Desc: Project Makefile #
# #
# #
# Copyright © 2018-2020 The OS/K Team #
# #
# This file is part of OS/K. #
# #
# OS/K is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# any later version. #
# #
# OS/K is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY# without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with OS/K. If not, see <https://www.gnu.org/licenses/>. #
#=----------------------------------------------------------------------------=#
.PHONY: retrieve compile showenv
.DEFAULT_GOAL := compile
## VERSIONS ------------------------------------------------------------------ #
# GCC 10.1.0
GCC_SOURCES = https://ftp.gnu.org/gnu/gcc/gcc-10.1.0/gcc-10.1.0.tar.xz
# BINUTILS 2.34
BINUTILS_SOURCES = https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.xz
## VARIABLES ----------------------------------------------------------------- #
#ENV
export NTHREADS := ${nproc}
export PREFIX := $(HOME)/opt/cross
export TARGET := x86_64-elf
export PATH := $(PREFIX)/bin:$(PATH)
export XZ_DEFAULTS := -T $(NTHREADS)
GCCTARNAME = gcc.tar.xz
BINUTILSTARNAME = binutils.tar.xz
GCCDIRNAME = gcc-src
BINUTILSDIRNAME = binutils-src
# Color codes
CL='\033[0;32m'
CL2='\033[1;36m'
CL3='\033[0m'
NC='\033[1;37m'
## RECIPES ------------------------------------------------------------------- #
showenv:
@echo Installation path prefix : $(PREFIX)
@echo Installation path : $(PATH)
@echo Target : $(TARGET)
@echo Thread number : $(NTHREADS)
retrieve: showenv
@echo ${CL2}[$@] ${NC}Downloading GCC sources...${CL3}
@wget $(GCC_SOURCES) -O $(GCCTARNAME) -q -c --show-progress
@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}
@tar -xaf $(GCCTARNAME) --threads NTHREADS
@echo ${CL2}[$@] ${NC}Deflate BINUTILS sources...${CL3}
@tar -xaf $(BINUTILSTARNAME) --threads NTHREADS
@echo ${CL2}[$@] ${CL}Success.${CL3}
compile: retrieve deflate
@echo ${CL2}[$@] ${CL}Success.${CL3}
remove_all:
@rm -rf gcc*
@rm -rf binutils*
@echo ${CL2}[$@] ${CL}Success.${CL3}