2011-12-22 15:19:25 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
#
|
|
|
|
# \brief Tool-chain creation tool for the Genode OS Framework
|
|
|
|
# \author Norman Feske
|
|
|
|
# \date 2009-02-03
|
|
|
|
#
|
|
|
|
|
|
|
|
help:
|
|
|
|
$(ECHO)
|
|
|
|
$(ECHO) "Build tool chain for the Genode OS Framework"
|
|
|
|
$(ECHO)
|
|
|
|
$(ECHO) "The tool chain consists of GCC $(GCC_VERSION) and binutils $(BINUTILS_VERSION)"
|
|
|
|
$(ECHO) "and will be created at '$(LOCAL_INSTALL_LOCATION)'."
|
|
|
|
$(ECHO)
|
|
|
|
$(ECHO) "--- available commands ---"
|
2017-04-09 19:02:34 +00:00
|
|
|
$(ECHO) "x86 - create tool chain for x86"
|
|
|
|
$(ECHO) "arm - create tool chain for arm"
|
2019-03-26 10:46:37 +00:00
|
|
|
$(ECHO) "aarch64 - create tool chain for aarch64/arm64"
|
2017-04-09 19:02:34 +00:00
|
|
|
$(ECHO) "riscv - create tool chain for riscv"
|
|
|
|
$(ECHO) "clean - clean everything except downloaded archives"
|
|
|
|
$(ECHO) "cleanall - clean everything including downloaded archives"
|
|
|
|
$(ECHO)
|
|
|
|
$(ECHO) "--- available command line options ---"
|
2019-03-19 17:03:49 +00:00
|
|
|
$(ECHO) "MAKE_JOBS=... - number of parallel make jobs (default: 4)"
|
2019-04-05 09:51:31 +00:00
|
|
|
$(ECHO) "BUILD_LOCATION=... - build location (default: $(DEFAULT_BUILD_LOCATION))"
|
|
|
|
$(ECHO) "INSTALL_LOCATION=... - install location (default: $(DEFAULT_INSTALL_LOCATION))"
|
2019-03-19 17:03:49 +00:00
|
|
|
$(ECHO) "SUDO=... - name of sudo command, leave empty to not use sudo (default: sudo)"
|
2011-12-22 15:19:25 +00:00
|
|
|
$(ECHO)
|
|
|
|
|
|
|
|
#
|
|
|
|
# User interface
|
|
|
|
#
|
|
|
|
|
2019-03-26 10:46:37 +00:00
|
|
|
SUPPORTED_PLATFORMS := x86 arm riscv aarch64
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
PLATFORM := $(firstword $(filter $(SUPPORTED_PLATFORMS),$(MAKECMDGOALS)))
|
|
|
|
|
|
|
|
$(SUPPORTED_PLATFORMS): install
|
|
|
|
|
|
|
|
#
|
|
|
|
# Enable parallel build for 2nd-level $(MAKE) by default
|
|
|
|
#
|
|
|
|
|
2017-04-09 19:02:34 +00:00
|
|
|
MAKE_JOBS ?= 4
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Determine Genode base directory based on the known location of the
|
2019-04-05 09:51:31 +00:00
|
|
|
# 'tool_chain' tool within the Genode source tree
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
|
2012-07-03 10:56:25 +00:00
|
|
|
GENODE_DIR ?= $(realpath $(dir $(firstword $(MAKEFILE_LIST)))/..)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
2019-04-05 09:51:31 +00:00
|
|
|
# version numbers
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
|
2019-03-22 13:34:05 +00:00
|
|
|
TOOL_CHAIN_VERSION = 19.05
|
2019-03-19 13:01:17 +00:00
|
|
|
GCC_VERSION = 8.3.0
|
2019-03-22 13:34:05 +00:00
|
|
|
BINUTILS_VERSION = 2.32
|
2019-04-05 09:51:31 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# locations
|
|
|
|
#
|
|
|
|
|
|
|
|
DEFAULT_BUILD_LOCATION = $(GENODE_DIR)/build/tool_chain-$(TOOL_CHAIN_VERSION)
|
2019-05-24 15:29:05 +00:00
|
|
|
DEFAULT_INSTALL_LOCATION = /usr/local/genode/tool/$(TOOL_CHAIN_VERSION)
|
2019-04-05 09:51:31 +00:00
|
|
|
|
|
|
|
BUILD_LOCATION ?= $(DEFAULT_BUILD_LOCATION)
|
|
|
|
INSTALL_LOCATION ?= $(DEFAULT_INSTALL_LOCATION)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Utilities
|
|
|
|
#
|
|
|
|
|
2014-02-09 10:41:30 +00:00
|
|
|
##
|
|
|
|
# Return $(2) if $(1) is empty, "" else
|
|
|
|
#
|
|
|
|
check_nonempty_f = $(if $(1),,$(info $(2))$(2))
|
|
|
|
|
|
|
|
##
|
|
|
|
# Return $(3) if $(1) != $(2), "" else
|
|
|
|
#
|
|
|
|
check_equal_f = $(if $(filter $(1),$(2)),,$(info $(3))$(3))
|
|
|
|
|
|
|
|
|
2019-03-19 17:03:49 +00:00
|
|
|
SHELL = bash
|
|
|
|
BRIGHT_COL = \033[01;33m
|
|
|
|
DEFAULT_COL = \033[0m
|
|
|
|
ECHO = @echo -e
|
|
|
|
VERBOSE ?= @
|
|
|
|
SUDO ?= sudo
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2014-02-09 10:41:30 +00:00
|
|
|
#
|
|
|
|
# Check if 'autoconf' is installed
|
|
|
|
#
|
2017-04-09 19:02:34 +00:00
|
|
|
AUTOCONF_VERSION = 2.64
|
2014-02-05 21:49:48 +00:00
|
|
|
|
2014-02-09 10:41:30 +00:00
|
|
|
AUTOCONF_VERSION_STRING = "autoconf (GNU Autoconf) $(AUTOCONF_VERSION)"
|
|
|
|
ifeq ($(shell autoconf -V | grep $(AUTOCONF_VERSION_STRING)),)
|
|
|
|
ifeq ($(shell which autoconf$(AUTOCONF_VERSION)),)
|
|
|
|
ifneq ($(shell which autoconf-$(AUTOCONF_VERSION)),)
|
|
|
|
AUTOCONF = autoconf-$(AUTOCONF_VERSION)
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
AUTOCONF = autoconf$(AUTOCONF_VERSION)
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
AUTOCONF = autoconf
|
|
|
|
endif
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2014-02-09 10:41:30 +00:00
|
|
|
AUTOCONFINST_OK = $(call check_nonempty_f,$(AUTOCONF),\
|
|
|
|
Need to have 'autoconf-$(AUTOCONF_VERSION)' installed.)
|
2012-01-04 19:03:08 +00:00
|
|
|
|
2016-05-18 12:40:45 +00:00
|
|
|
#
|
|
|
|
# Check if 'pkg-config' is installed
|
|
|
|
#
|
|
|
|
PKG_CONFIG_OK = $(call check_nonempty_f,$(shell which pkg-config),\
|
|
|
|
Need to have 'pkg-config' installed.)
|
|
|
|
|
2012-01-04 19:03:08 +00:00
|
|
|
#
|
|
|
|
# Check if 'libncurses' is installed
|
|
|
|
#
|
2014-02-05 21:49:48 +00:00
|
|
|
CURSES_OK = $(call check_equal_f,\
|
2016-05-18 12:40:45 +00:00
|
|
|
$(shell pkg-config --exists ncurses && echo ok),ok,\
|
2014-02-05 21:49:48 +00:00
|
|
|
Need to have 'libncurses' installed.)
|
2012-01-04 19:03:08 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Check if 'texinfo' is installed
|
|
|
|
#
|
2014-02-05 21:49:48 +00:00
|
|
|
TEXINFO_OK = $(call check_nonempty_f,$(shell which texi2pdf),\
|
|
|
|
Need to have 'texinfo' installed.)
|
2012-01-04 19:03:08 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Check if 'wget' is installed
|
|
|
|
#
|
2014-02-05 21:49:48 +00:00
|
|
|
WGET_OK = $(call check_nonempty_f,$(shell which wget),\
|
|
|
|
Need to have 'wget' installed.)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-01-04 19:03:08 +00:00
|
|
|
#
|
|
|
|
# Check if 'autogen' is installed
|
|
|
|
#
|
2014-02-05 21:49:48 +00:00
|
|
|
AUTOGEN_OK = $(call check_nonempty_f,$(shell which autogen),\
|
|
|
|
Need to have 'autogen' installed.)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2013-05-25 12:48:08 +00:00
|
|
|
#
|
|
|
|
# Check if 'gpg' is installed
|
|
|
|
#
|
2014-02-05 21:49:48 +00:00
|
|
|
GPG_OK = $(call check_nonempty_f,$(shell which gpg),\
|
|
|
|
Need to have 'gpg' installed.)
|
|
|
|
|
2015-05-12 11:14:57 +00:00
|
|
|
#
|
|
|
|
# Check if 'libexpat' is installed
|
|
|
|
#
|
|
|
|
EXPAT_OK = $(call check_equal_f,\
|
2016-05-18 12:40:45 +00:00
|
|
|
$(shell pkg-config --exists expat && echo ok),ok,\
|
2015-05-12 11:14:57 +00:00
|
|
|
Need to have 'libexpat' installed.)
|
|
|
|
|
2017-04-09 19:02:34 +00:00
|
|
|
#
|
|
|
|
# Check if 'GNAT' is installed
|
|
|
|
#
|
2018-08-27 16:48:58 +00:00
|
|
|
# The '-dumpfullversion' option is used by GCC version 7, the '-dumpversion' option
|
|
|
|
# is used by GCC versions < 7.
|
|
|
|
#
|
|
|
|
HOST_GCC_VERSION := $(shell gcc -dumpfullversion -dumpversion)
|
2017-04-09 19:02:34 +00:00
|
|
|
GNAT_OK = $(call check_equal_f,$(shell gnatmake --version | sed -n -e 's/GNATMAKE //p'),$(HOST_GCC_VERSION),\
|
|
|
|
Need to have GNAT installed and the GNAT version must match the GCC version (found GCC $(HOST_GCC_VERSION)).)
|
2015-05-12 11:14:57 +00:00
|
|
|
|
2016-05-18 12:40:45 +00:00
|
|
|
TOOLS_OK = $(AUTOCONF_OK) $(AUTOCONFINST_OK) $(PKG_CONFIG_OK) $(CURSES_OK) \
|
2017-04-09 19:02:34 +00:00
|
|
|
$(TEXINFO_OK) $(WGET_OK) $(AUTOGEN_OK) $(GPG_OK) $(EXPAT_OK) \
|
2021-04-20 09:20:55 +00:00
|
|
|
$(GNAT_OK)
|
2014-02-05 21:49:48 +00:00
|
|
|
|
|
|
|
ifneq ($(strip $(TOOLS_OK)),)
|
|
|
|
$(error Please install missing tools.)
|
2013-05-25 12:48:08 +00:00
|
|
|
endif
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
# 'configure' parameters for binutils, gcc and gdb
|
|
|
|
#
|
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
LOCAL_BOOTSTRAP_INSTALL_LOCATION = $(BUILD_LOCATION)/bootstrap/install
|
2017-04-09 19:02:34 +00:00
|
|
|
export PATH := $(LOCAL_BOOTSTRAP_INSTALL_LOCATION)/bin:$(PATH)
|
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
LOCAL_INSTALL_LOCATION = $(BUILD_LOCATION)/install
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-05-11 15:55:26 +00:00
|
|
|
TARGET_NAME_x86 = x86_64-pc-elf
|
|
|
|
TARGET_NAME_arm = arm-none-eabi
|
2017-05-03 13:40:44 +00:00
|
|
|
TARGET_NAME_riscv = riscv64-unknown-elf
|
2019-03-26 10:46:37 +00:00
|
|
|
TARGET_NAME_aarch64 = aarch64-none-elf
|
2017-05-03 13:40:44 +00:00
|
|
|
|
2019-05-06 16:18:21 +00:00
|
|
|
GCC_CONFIG_riscv = --with-arch=rv64imac --with-abi=lp64
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
ifneq ($(VERBOSE),)
|
|
|
|
CONFIG_QUIET = --quiet
|
|
|
|
MAKEFLAGS += --quiet
|
|
|
|
export MAKEFLAGS
|
|
|
|
endif
|
|
|
|
|
2017-04-09 19:02:34 +00:00
|
|
|
COMMON_BOOTSTRAP_CONFIG = $(CONFIG_QUIET) \
|
|
|
|
--prefix=$(LOCAL_BOOTSTRAP_INSTALL_LOCATION) \
|
|
|
|
--disable-multilib
|
|
|
|
|
|
|
|
BINUTILS_BOOTSTRAP_CONFIG += $(COMMON_BOOTSTRAP_CONFIG)
|
|
|
|
|
2017-05-03 13:40:44 +00:00
|
|
|
ifeq ($(PLATFORM),riscv)
|
|
|
|
LANGUAGES = c,c++
|
|
|
|
LIB_GCC = cd $(INSTALL_LOCATION)/lib/gcc/riscv64-unknown-elf/$(GCC_VERSION)/rv64imac/lp64 && \
|
2019-03-19 17:03:49 +00:00
|
|
|
$(SUDO) ln -sf ../../include include
|
2017-05-03 13:40:44 +00:00
|
|
|
else
|
|
|
|
LANGUAGES = c,c++,ada
|
|
|
|
LIB_GCC =
|
|
|
|
endif
|
|
|
|
|
2017-04-09 19:02:34 +00:00
|
|
|
GCC_BOOTSTRAP_CONFIG += $(COMMON_BOOTSTRAP_CONFIG) \
|
|
|
|
--enable-languages=c,c++,ada \
|
|
|
|
--disable-libatomic \
|
|
|
|
--disable-libcilkrts \
|
|
|
|
--disable-libgomp \
|
|
|
|
--disable-libitm \
|
|
|
|
--disable-libmpx \
|
|
|
|
--disable-libsanitizer \
|
|
|
|
--disable-libquadmath \
|
|
|
|
--disable-libssp \
|
2021-03-24 21:03:18 +00:00
|
|
|
--disable-lto
|
2017-04-09 19:02:34 +00:00
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
COMMON_CONFIG = $(CONFIG_QUIET) \
|
|
|
|
--prefix=$(LOCAL_INSTALL_LOCATION) \
|
|
|
|
--program-prefix=genode-$(PLATFORM)- \
|
|
|
|
--target=$(TARGET_NAME_$(PLATFORM)) \
|
|
|
|
--program-transform-name="s/$(TARGET_NAME_$(PLATFORM))/$(PLATFORM)/"
|
|
|
|
|
|
|
|
BINUTILS_CONFIG += $(COMMON_CONFIG) --disable-werror
|
|
|
|
|
|
|
|
#
|
|
|
|
# Prevent GNU assembler from treating '/' as the start of a comment. In
|
|
|
|
# 'gas/config/tc-i386.c', the policy of handling '/' is defined. For Linux, '/'
|
|
|
|
# is treated as division, which we expect. To apply this needed policy for our
|
|
|
|
# plain 'elf' version gas, we supply the definition of 'TE_LINUX' by hand.
|
|
|
|
# Fortunately, this define is not used outside of gas.
|
|
|
|
#
|
|
|
|
BINUTILS_CONFIG += CFLAGS=-DTE_LINUX
|
|
|
|
|
2017-04-09 19:02:29 +00:00
|
|
|
# Disable the generation of new relocation types introduced with binutils 2.26
|
|
|
|
# which are not recognized by older 'ld' versions. This is needed for hybrid
|
|
|
|
# Genode/Linux components on Ubuntu 14.04 with binutils 2.24.
|
|
|
|
BINUTILS_CONFIG_x86 += --disable-x86-relax-relocations
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
# Add platform-specific binutils configure arguments
|
|
|
|
#
|
|
|
|
BINUTILS_CONFIG += $(BINUTILS_CONFIG_$(PLATFORM))
|
|
|
|
|
2014-07-21 12:29:52 +00:00
|
|
|
#
|
|
|
|
# GDB configure arguments
|
|
|
|
#
|
2021-05-06 09:57:27 +00:00
|
|
|
GDB_CONFIG += $(COMMON_CONFIG) --disable-werror --disable-sim
|
2014-07-21 12:29:52 +00:00
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
GCC_CONFIG += $(COMMON_CONFIG) \
|
2017-05-03 13:40:44 +00:00
|
|
|
--enable-languages=$(LANGUAGES),go \
|
2015-05-11 15:55:26 +00:00
|
|
|
--disable-libgo \
|
2017-04-09 19:02:34 +00:00
|
|
|
--disable-gotools \
|
2015-05-11 15:55:26 +00:00
|
|
|
--disable-libssp \
|
|
|
|
--disable-libquadmath \
|
|
|
|
--disable-libffi \
|
2017-04-09 19:02:34 +00:00
|
|
|
--disable-libada \
|
2012-11-05 09:23:02 +00:00
|
|
|
--enable-targets=all \
|
2015-05-11 15:55:26 +00:00
|
|
|
--with-gnu-as \
|
|
|
|
--with-gnu-ld \
|
|
|
|
--disable-tls \
|
|
|
|
--disable-threads \
|
|
|
|
--disable-hosted-libstdcxx \
|
2011-12-22 15:19:25 +00:00
|
|
|
--enable-shared \
|
2014-11-15 19:22:20 +00:00
|
|
|
--enable-multiarch \
|
2015-05-11 15:55:26 +00:00
|
|
|
--disable-sjlj-exceptions \
|
|
|
|
CFLAGS_FOR_TARGET="-I$(GENODE_DIR)/tool -DUSE_PT_GNU_EH_FRAME -Dinhibit_libc -fPIC" \
|
|
|
|
CXXFLAGS_FOR_TARGET="-fPIC"
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
GCC_CONFIG += $(GCC_CONFIG_$(PLATFORM))
|
|
|
|
|
|
|
|
#
|
|
|
|
# Configure options passed to gcc
|
|
|
|
#
|
2015-05-11 15:55:26 +00:00
|
|
|
HOST_CONFIG_ARGS = $(CONFIG_QUIET)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2012-10-30 17:09:09 +00:00
|
|
|
#
|
|
|
|
# Passed to target components such as libgcc, libstdc++
|
|
|
|
#
|
2015-05-11 15:55:26 +00:00
|
|
|
TARGET_CONFIG_ARGS = $(CONFIG_QUIET)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
GCC_INSTALL_RULE = install-strip
|
|
|
|
|
2017-04-09 19:02:34 +00:00
|
|
|
MAKE_OPT += GENODE="yes"
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
# Platform-specific multilib support
|
|
|
|
#
|
|
|
|
|
2017-04-09 19:02:34 +00:00
|
|
|
GCC_MAKE_OPT_x86 := MULTILIB_OPTIONS="m64/m32" MULTILIB_DIRNAMES="64 32"
|
|
|
|
GCC_MAKE_OPT += $(MAKE_OPT) $(GCC_MAKE_OPT_$(PLATFORM))
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build rules and dependencies between build steps
|
|
|
|
#
|
|
|
|
# We use the binaries 'objdump' and 'g++' as representatives for expressing
|
|
|
|
# dependencies. All other programs will be generated as side effect.
|
|
|
|
#
|
2021-04-20 09:20:55 +00:00
|
|
|
# The 'gprbuild' tool is built from source because of a bug in the version
|
|
|
|
# that comes with Ubuntu 18.04 (fixed by commit 361d080 on github).
|
|
|
|
#
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
BINUTILS_BOOTSTRAP_BINARIES = $(BUILD_LOCATION)/bootstrap/binutils/binutils/objdump
|
2017-04-09 19:02:34 +00:00
|
|
|
BINUTILS_BOOTSTRAP_INSTALLED_BINARIES = $(LOCAL_BOOTSTRAP_INSTALL_LOCATION)/bin/objdump
|
2019-04-05 09:51:31 +00:00
|
|
|
GCC_BOOTSTRAP_BINARIES = $(BUILD_LOCATION)/bootstrap/gcc/gcc/xg++
|
2017-04-09 19:02:34 +00:00
|
|
|
GCC_BOOTSTRAP_INSTALLED_BINARIES = $(LOCAL_BOOTSTRAP_INSTALL_LOCATION)/bin/g++
|
2021-04-20 09:20:55 +00:00
|
|
|
GPRBUILD_BOOTSTRAP_INSTALLED_BINARIES = $(LOCAL_BOOTSTRAP_INSTALL_LOCATION)/bin/gprbuild
|
2017-04-09 19:02:34 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
BINUTILS_BINARIES = $(BUILD_LOCATION)/$(PLATFORM)/binutils/binutils/objdump
|
2011-12-22 15:19:25 +00:00
|
|
|
BINUTILS_INSTALLED_BINARIES = $(LOCAL_INSTALL_LOCATION)/bin/genode-$(PLATFORM)-objdump
|
2019-04-05 09:51:31 +00:00
|
|
|
GCC_BINARIES = $(BUILD_LOCATION)/$(PLATFORM)/gcc/gcc/g++-cross
|
2011-12-22 15:19:25 +00:00
|
|
|
GCC_INSTALLED_BINARIES = $(LOCAL_INSTALL_LOCATION)/bin/genode-$(PLATFORM)-g++
|
2019-04-05 09:51:31 +00:00
|
|
|
GDB_BINARIES = $(BUILD_LOCATION)/$(PLATFORM)/gdb/gdb/gdb
|
2019-05-06 16:18:21 +00:00
|
|
|
GDB_INSTALLED_BINARIES = $(LOCAL_INSTALL_LOCATION)/bin/genode-$(PLATFORM)-gdb
|
2019-05-17 16:47:41 +00:00
|
|
|
ALI2DEP_BINARY = $(BUILD_LOCATION)/ali2dep/ali2dep
|
|
|
|
ALI2DEP_INSTALLED_BINARY = $(LOCAL_INSTALL_LOCATION)/bin/genode-$(PLATFORM)-ali2dep
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-05-17 16:47:41 +00:00
|
|
|
build_all: $(GCC_INSTALLED_BINARIES) $(GDB_INSTALLED_BINARIES) $(ALI2DEP_INSTALLED_BINARY)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2017-03-17 12:10:55 +00:00
|
|
|
GCC_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current gcc)/src/noux-pkg/gcc
|
|
|
|
|
|
|
|
$(GCC_CONTRIB_DIR)/configure:
|
|
|
|
$(ECHO) "$(BRIGHT_COL)preparing gcc...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port gcc
|
|
|
|
|
|
|
|
BINUTILS_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current binutils)/src/noux-pkg/binutils
|
|
|
|
|
|
|
|
$(BINUTILS_CONTRIB_DIR)/configure:
|
|
|
|
$(ECHO) "$(BRIGHT_COL)preparing binutils...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port binutils
|
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BUILD_LOCATION)/bootstrap/binutils/Makefile: $(BINUTILS_CONTRIB_DIR)/configure
|
2017-04-09 19:02:34 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)configuring bootstrap binutils...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)mkdir -p $(dir $@)
|
|
|
|
$(VERBOSE)cd $(dir $@); $(BINUTILS_CONTRIB_DIR)/configure $(BINUTILS_BOOTSTRAP_CONFIG)
|
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BINUTILS_BOOTSTRAP_BINARIES): $(BUILD_LOCATION)/bootstrap/binutils/Makefile
|
2017-04-09 19:02:34 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)building bootstrap binutils...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)$(MAKE) -C $(dir $<) -j$(MAKE_JOBS)
|
|
|
|
|
|
|
|
$(BINUTILS_BOOTSTRAP_INSTALLED_BINARIES): $(BINUTILS_BOOTSTRAP_BINARIES)
|
|
|
|
$(ECHO) "$(BRIGHT_COL)installing bootstrap binutils...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)for i in binutils gas ld intl opcodes; do \
|
2019-04-05 09:51:31 +00:00
|
|
|
$(MAKE) -C $(BUILD_LOCATION)/bootstrap/binutils/$$i install-strip; done
|
|
|
|
$(VERBOSE)$(MAKE) -C $(BUILD_LOCATION)/bootstrap/binutils/libiberty install
|
2017-04-09 19:02:34 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BUILD_LOCATION)/$(PLATFORM)/binutils/Makefile: $(BINUTILS_CONTRIB_DIR)/configure \
|
2017-04-09 19:02:34 +00:00
|
|
|
$(GCC_BOOTSTRAP_INSTALLED_BINARIES)
|
2011-12-22 15:19:25 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)configuring binutils...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)mkdir -p $(dir $@)
|
2017-03-17 12:10:55 +00:00
|
|
|
$(VERBOSE)cd $(dir $@); $(BINUTILS_CONTRIB_DIR)/configure $(BINUTILS_CONFIG)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BINUTILS_BINARIES): $(BUILD_LOCATION)/$(PLATFORM)/binutils/Makefile
|
2017-04-09 19:02:34 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)building binutils...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)$(MAKE) -C $(dir $<) $(MAKE_OPT) -j$(MAKE_JOBS)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
$(BINUTILS_INSTALLED_BINARIES): $(BINUTILS_BINARIES)
|
|
|
|
$(ECHO) "$(BRIGHT_COL)installing binutils...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)for i in binutils gas ld intl opcodes; do \
|
2019-04-05 09:51:31 +00:00
|
|
|
$(MAKE) -C $(BUILD_LOCATION)/$(PLATFORM)/binutils/$$i install-strip $(MAKE_OPT); done
|
|
|
|
$(VERBOSE)$(MAKE) -C $(BUILD_LOCATION)/$(PLATFORM)/binutils/libiberty install $(MAKE_OPT)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BUILD_LOCATION)/bootstrap/gcc/Makefile: $(GCC_CONTRIB_DIR)/configure \
|
2021-03-24 21:03:18 +00:00
|
|
|
$(BINUTILS_BOOTSTRAP_INSTALLED_BINARIES)
|
2017-04-09 19:02:34 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BUILD_LOCATION)/bootstrap/gcc/Makefile:
|
2017-04-09 19:02:34 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)configuring bootstrap gcc...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)mkdir -p $(dir $@)
|
|
|
|
$(VERBOSE)cd $(dir $@); $(GCC_CONTRIB_DIR)/configure $(GCC_BOOTSTRAP_CONFIG)
|
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(GCC_BOOTSTRAP_BINARIES): $(BUILD_LOCATION)/bootstrap/gcc/Makefile
|
2017-04-09 19:02:34 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)building bootstrap gcc...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)$(MAKE) -C $(dir $<) -j$(MAKE_JOBS)
|
|
|
|
|
|
|
|
$(GCC_BOOTSTRAP_INSTALLED_BINARIES): $(GCC_BOOTSTRAP_BINARIES)
|
|
|
|
$(ECHO) "$(BRIGHT_COL)installing bootstrap gcc...$(DEFAULT_COL)"
|
2019-04-05 09:51:31 +00:00
|
|
|
$(VERBOSE)$(MAKE) -C $(BUILD_LOCATION)/bootstrap/gcc $(GCC_INSTALL_RULE)
|
2017-04-09 19:02:34 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BUILD_LOCATION)/$(PLATFORM)/gcc/Makefile: $(GCC_CONTRIB_DIR)/configure \
|
2021-03-24 21:03:18 +00:00
|
|
|
$(BINUTILS_INSTALLED_BINARIES)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BUILD_LOCATION)/$(PLATFORM)/gcc/Makefile:
|
2011-12-22 15:19:25 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)configuring gcc...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)mkdir -p $(dir $@)
|
|
|
|
$(VERBOSE)cd $(dir $@); \
|
|
|
|
host_configargs="$(HOST_CONFIG_ARGS)" \
|
|
|
|
target_configargs="$(TARGET_CONFIG_ARGS)" \
|
2017-03-17 12:10:55 +00:00
|
|
|
$(GCC_CONTRIB_DIR)/configure $(GCC_CONFIG)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(GCC_BINARIES): $(BUILD_LOCATION)/$(PLATFORM)/gcc/Makefile
|
2017-04-09 19:02:34 +00:00
|
|
|
|
|
|
|
$(GCC_BINARIES):
|
|
|
|
$(ECHO) "$(BRIGHT_COL)building gcc...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)$(MAKE) -C $(dir $<) $(GCC_MAKE_OPT) -j$(MAKE_JOBS)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
$(GCC_INSTALLED_BINARIES): $(GCC_BINARIES)
|
|
|
|
$(ECHO) "$(BRIGHT_COL)installing gcc...$(DEFAULT_COL)"
|
2019-04-05 09:51:31 +00:00
|
|
|
$(VERBOSE)$(MAKE) -C $(BUILD_LOCATION)/$(PLATFORM)/gcc $(GCC_INSTALL_RULE) $(GCC_MAKE_OPT)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2017-03-17 12:10:55 +00:00
|
|
|
GDB_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current gdb)/src/noux-pkg/gdb
|
2012-07-12 19:25:55 +00:00
|
|
|
|
2017-03-17 12:10:55 +00:00
|
|
|
$(GDB_CONTRIB_DIR)/configure:
|
|
|
|
$(ECHO) "$(BRIGHT_COL)preparing gdb...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port gdb
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(BUILD_LOCATION)/$(PLATFORM)/gdb/Makefile: $(GDB_CONTRIB_DIR)/configure
|
2011-12-22 15:19:25 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)configuring gdb...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)mkdir -p $(dir $@)
|
|
|
|
$(VERBOSE)cd $(dir $@); \
|
2017-03-17 12:10:55 +00:00
|
|
|
$(GDB_CONTRIB_DIR)/configure $(GDB_CONFIG)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2019-04-05 09:51:31 +00:00
|
|
|
$(GDB_BINARIES): $(BUILD_LOCATION)/$(PLATFORM)/gdb/Makefile
|
2017-04-09 19:02:34 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)building gdb...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)$(MAKE) -C $(dir $<) $(MAKE_OPT) -j$(MAKE_JOBS)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
$(GDB_INSTALLED_BINARIES): $(GDB_BINARIES)
|
|
|
|
$(ECHO) "$(BRIGHT_COL)installing gdb...$(DEFAULT_COL)"
|
2019-04-05 09:51:31 +00:00
|
|
|
$(VERBOSE)$(MAKE) -C $(BUILD_LOCATION)/$(PLATFORM)/gdb install $(MAKE_OPT) MAKEINFO=true
|
2019-05-21 11:19:59 +00:00
|
|
|
$(VEBOSE)strip $@
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2021-04-20 09:20:55 +00:00
|
|
|
|
|
|
|
$(BUILD_LOCATION)/bootstrap/gprbuild/Makefile:
|
|
|
|
$(ECHO) "$(BRIGHT_COL)preparing bootstrap gprbuild...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)git clone -b v21.0.0 https://github.com/AdaCore/gprbuild.git $(dir $@)
|
|
|
|
$(VERBOSE)git clone -b v21.0.0 https://github.com/AdaCore/xmlada.git $(dir $@)/xmlada
|
|
|
|
$(VERBOSE)git clone -b v21.0.0 https://github.com/AdaCore/gprconfig_kb.git $(dir $@)/gprconfig_kb
|
|
|
|
$(VERBOSE)sed -i -e '/\<target name="\^\.\*-gnueabihf$$" \/>/d' $(dir $@)/gprconfig_kb/db/linker.xml
|
|
|
|
$(VERBOSE)sed -i -e '/\<target name="\^\.\*-linux\.\*" \/>/d' $(dir $@)/gprconfig_kb/db/linker.xml
|
|
|
|
|
|
|
|
$(GPRBUILD_BOOTSTRAP_INSTALLED_BINARIES): $(BUILD_LOCATION)/bootstrap/gprbuild/Makefile $(GCC_BOOTSTRAP_INSTALLED_BINARIES)
|
|
|
|
$(ECHO) "$(BRIGHT_COL)building bootstrap gprbuild...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)cd $(dir $<); CC=$(LOCAL_BOOTSTRAP_INSTALL_LOCATION)/bin/gcc ./bootstrap.sh \
|
|
|
|
--with-xmlada=./xmlada --with-kb=./gprconfig_kb --prefix=$(LOCAL_BOOTSTRAP_INSTALL_LOCATION)
|
|
|
|
|
|
|
|
|
2019-05-17 16:47:41 +00:00
|
|
|
$(BUILD_LOCATION)/ali2dep/build/build.gpr:
|
|
|
|
$(ECHO) "$(BRIGHT_COL)preparing ali2dep...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)git clone https://github.com/Componolit/ali2dep.git $(BUILD_LOCATION)/ali2dep
|
|
|
|
$(VERBOSE)sed -i -e '/Create_Missing_Dirs/d' $@
|
|
|
|
|
2021-04-20 09:20:55 +00:00
|
|
|
$(ALI2DEP_BINARY): $(GCC_BOOTSTRAP_INSTALLED_BINARIES) $(GPRBUILD_BOOTSTRAP_INSTALLED_BINARIES) $(BUILD_LOCATION)/ali2dep/build/build.gpr
|
2019-05-17 16:47:41 +00:00
|
|
|
$(ECHO) "$(BRIGHT_COL)building ali2dep...$(DEFAULT_COL)"
|
2021-04-20 09:20:55 +00:00
|
|
|
$(VERBOSE)$(LOCAL_BOOTSTRAP_INSTALL_LOCATION)/bin/gprconfig --batch --target=all \
|
2019-05-17 16:47:41 +00:00
|
|
|
--config=Ada,,default,$(LOCAL_BOOTSTRAP_INSTALL_LOCATION)/bin,GNAT \
|
|
|
|
--config=C,,,$(LOCAL_BOOTSTRAP_INSTALL_LOCATION)/bin/,GCC \
|
|
|
|
-o $(BUILD_LOCATION)/ali2dep/genode_bootstrap_tool_chain.cgpr
|
|
|
|
$(VERBOSE)GPRBUILD_ARGS="--config=genode_bootstrap_tool_chain.cgpr" $(MAKE) -C $(BUILD_LOCATION)/ali2dep
|
|
|
|
|
|
|
|
$(ALI2DEP_INSTALLED_BINARY): $(ALI2DEP_BINARY)
|
|
|
|
$(ECHO) "$(BRIGHT_COL)installing ali2dep...$(DEFAULT_COL)"
|
|
|
|
$(VERBOSE)strip -o $@ $<
|
|
|
|
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
|
|
|
# Clean rules
|
|
|
|
#
|
|
|
|
|
|
|
|
clean:
|
2019-04-05 09:51:31 +00:00
|
|
|
rm -rf $(BUILD_LOCATION)
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
cleanall: clean
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install rules
|
|
|
|
#
|
|
|
|
|
|
|
|
install: build_all
|
|
|
|
$(ECHO) "$(BRIGHT_COL)installing tool chain to '$(INSTALL_LOCATION)'...$(DEFAULT_COL)"
|
2019-05-24 15:29:05 +00:00
|
|
|
$(VERBOSE)$(SUDO) mkdir -p $(INSTALL_LOCATION)
|
2019-03-19 17:03:49 +00:00
|
|
|
$(VERBOSE)$(SUDO) cp -a --remove-destination --no-target-directory $(LOCAL_INSTALL_LOCATION) $(INSTALL_LOCATION)
|
2017-05-03 13:40:44 +00:00
|
|
|
$(VERBOSE)$(LIB_GCC)
|
2019-05-24 15:29:05 +00:00
|
|
|
ifeq ($(INSTALL_LOCATION),$(DEFAULT_INSTALL_LOCATION))
|
|
|
|
$(VERBOSE)$(SUDO) ln -snf $(TOOL_CHAIN_VERSION) $(dir $(INSTALL_LOCATION))/current
|
|
|
|
endif
|