integration/builder: Avoid picolibc/compiler_rt dependencies when not using the LiteX BIOS & minor cleanups.

This commit is contained in:
Florent Kermarrec 2021-09-28 08:57:49 +02:00
parent 29fb1c48d0
commit c98c777bed
1 changed files with 12 additions and 10 deletions

View File

@ -125,6 +125,7 @@ class Builder:
self.software_libraries.append(name) self.software_libraries.append(name)
def _get_variables_contents(self): def _get_variables_contents(self):
# Helper.
variables_contents = [] variables_contents = []
def define(k, v): def define(k, v):
variables_contents.append("{}={}".format(k, _makefile_escape(v))) variables_contents.append("{}={}".format(k, _makefile_escape(v)))
@ -134,22 +135,23 @@ class Builder:
define("PACKAGE_DIRS", " ".join(src_dir for name, src_dir in self.software_packages)) define("PACKAGE_DIRS", " ".join(src_dir for name, src_dir in self.software_packages))
define("LIBS", " ".join(self.software_libraries)) define("LIBS", " ".join(self.software_libraries))
# Define the CPU variables. # Define CPU variables.
for k, v in export.get_cpu_mak(self.soc.cpu, self.compile_software): for k, v in export.get_cpu_mak(self.soc.cpu, self.compile_software):
define(k, v) define(k, v)
# Define the SoC/Picolibc/Compiler-RT/Software/Include directories. # Define SoC/Picolibc/Compiler-RT/Software/Include directories.
define("SOC_DIRECTORY", soc_directory)
picolibc_directory = get_data_mod("software", "picolibc").data_location picolibc_directory = get_data_mod("software", "picolibc").data_location
define("PICOLIBC_DIRECTORY", picolibc_directory)
compiler_rt_directory = get_data_mod("software", "compiler_rt").data_location compiler_rt_directory = get_data_mod("software", "compiler_rt").data_location
define("SOC_DIRECTORY", soc_directory)
define("PICOLIBC_DIRECTORY", picolibc_directory)
define("COMPILER_RT_DIRECTORY", compiler_rt_directory) define("COMPILER_RT_DIRECTORY", compiler_rt_directory)
variables_contents.append("export BUILDINC_DIRECTORY") variables_contents.append("export BUILDINC_DIRECTORY")
define("BUILDINC_DIRECTORY", self.include_dir) define("BUILDINC_DIRECTORY", self.include_dir)
for name, src_dir in self.software_packages: for name, src_dir in self.software_packages:
define(name.upper() + "_DIRECTORY", src_dir) define(name.upper() + "_DIRECTORY", src_dir)
# Define the BIOS Options. # Define BIOS Options.
for bios_option in self.bios_options: for bios_option in self.bios_options:
assert bios_option in ["TERM_NO_HIST", "TERM_MINI", "TERM_NO_COMPLETE"] assert bios_option in ["TERM_NO_HIST", "TERM_MINI", "TERM_NO_COMPLETE"]
define(bios_option, "1") define(bios_option, "1")
@ -268,10 +270,10 @@ class Builder:
# Create Software directory. # Create Software directory.
# First check if software needs a full re-build and remove software dir if so. # First check if software needs a full re-build and remove software dir if so.
if self.soc.cpu_type is not None: if with_bios:
software_full_rebuild = False software_full_rebuild = False
software_variables_mak = os.path.join(self.generated_dir, "variables.mak") software_variables_mak = os.path.join(self.generated_dir, "variables.mak")
if os.path.exists(software_variables_mak): if self.compile_software and os.path.exists(software_variables_mak):
old_variables_contents = open(software_variables_mak).read() old_variables_contents = open(software_variables_mak).read()
new_variables_contents = self._get_variables_contents() new_variables_contents = self._get_variables_contents()
software_full_rebuild = (old_variables_contents != new_variables_contents) software_full_rebuild = (old_variables_contents != new_variables_contents)