Funktionierende Toolchains: Unterschied zwischen den Versionen

Aus darkrealm Wiki
Zur Navigation springen Zur Suche springen
Chris (Diskussion | Beiträge)
Chris (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
 
(7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
== Funktionierende Toolchains ==
== KallistiOS Toolchain ==


=== KallistiOS Toolchain ===
Voraussetzungen:


* Wenn die Toolchain innerhalb eines CIFS-Mounts installiert wird müssen '''mfsymlinks''' in den Mountoptions aktiviert sein!
=== Crosscompiler bauen ===
<pre>
<pre>
mkdir /media/chris/development/dreamcast/toolchains
mkdir /media/chris/development/dreamcast/toolchains
cd /media/chris/development/dreamcast/toolchains
cd /media/chris/development/dreamcast/toolchains
git clone -b v2.1.x https://github.com/KallistiOS/KallistiOS.git kos
git clone https://github.com/KallistiOS/KallistiOS.git kos
cd kos/utils/dc-chain/
cd kos/utils/dc-chain/
cp -av Makefile.default.cfg Makefile.cfg
cp -av Makefile.default.cfg Makefile.cfg
</pre>
</pre>


Makefile.cfg bearbeiten:
==== Makefile.cfg bearbeiten ====


<pre>
<pre>
Zeile 262: Zeile 265:
</pre>
</pre>


= sys-devel/crossdev-20171230 =
==== KOS bauen ====
 
eviron.sh:
<pre>
# KallistiOS Environment Settings
#
# This is a sample script for configuring and customizing your
# KOS build environment. Modify it to suit your setup. Several
# settings may be enabled optionally or are provided with
# alternative values.
#
# This script is typically sourced in your current shell environment
# (probably by .bashrc, .bash_profile, or something similar), so that
# the KOS environment is set up automatically for each shell session.
#
 
# Build Architecture
#
# Set the major architecture you'll be building for.
# The only option here is "dreamcast" as of KOS 2.0.0.
#
export KOS_ARCH="dreamcast"
 
# Build Sub-Architecture
#
# Defines the sub architecture your configuration
# is targeting or uses an existing value that
# can be set externally via your IDE.
#
# Valid values:
#  "pristine" - Dreamcast console or HKT-0120 devkit (default)
#  "naomi"    - NAOMI or NAOMI 2 arcade board
#
if [ -z "${KOS_SUBARCH}" ] ; then
    export KOS_SUBARCH="pristine"
else
    export KOS_SUBARCH
fi
 
# KOS Root Path
#
# Specifies the path to the KOS root directory
#
export KOS_BASE="/media/chris/development/dreamcast/toolchains/kos"
 
# KOS-Ports Path
#
# Specifies the path to the KOS-ports directory
#
export KOS_PORTS="${KOS_BASE}/../kos-ports"
 
# SH Compiler Prefixes
#
# Specifies the path to and prefix for the main SH
# GCC toolchain used to target the Dreamcast's SH4 CPU.
#
export KOS_CC_BASE="/media/chris/development/dreamcast/toolchains/sh-elf"
export KOS_CC_PREFIX="sh-elf"
 
# ARM Compiler Prefixes
#
# Specifies the path to and prefix for the additional ARM
# GCC toolchain used to target the Dreamcast's AICA SPU.
#
export DC_ARM_BASE="/media/chris/development/dreamcast/toolchains/arm-eabi"
export DC_ARM_PREFIX="arm-eabi"
 
# External Dreamcast Tools Path
#
# Specifies the path where Dreamcast tools that are not part of KOS are to be
# installed. This includes, for example, dc-tool-ip, dc-tool-serial, and the
# mrbc bytecode compiler. This directory, along with SH and ARM compiler
# toolchains, will be added to your PATH environment variable.
#
export DC_TOOLS_BASE="/media/chris/development/dreamcast/tools"
 
# CMake Toolchain Path
#
# Specifies the path to the toolchain file used to target
# KOS with the "cmake" build utility.
#
export KOS_CMAKE_TOOLCHAIN="${KOS_BASE}/utils/cmake/dreamcast.toolchain.cmake"
 
# Genromfs Utility Path
#
# Specifies the path to the utility which is used by KOS
# to create romdisk filesystem images.
#
export KOS_GENROMFS="${KOS_BASE}/utils/genromfs/genromfs"
 
# Make Utility
#
# Configures the tool to be used as the main "make" utility
# for building GNU Makefiles. On a platform such as BSD,
# the default can be changed to "gmake," for the GNU
# implementation.
#
export KOS_MAKE="make"
#export KOS_MAKE="gmake"
 
# Loader Utility
#
# Specifies the loader to be used with the "make run" targets
# in the KOS examples. Defaults to using a preconfigured version
# of dc-tool. Use one of the other options for a manual dc-tool-ip
# or dc-tool-serial configuration, remembering to change the values
# for the Dreamcast's IP address or the serial port interface.
#
#export KOS_LOADER="dc-tool -x"
export KOS_LOADER="dc-tool-ip -t dreamcast -x"
#export KOS_LOADER="dc-tool-ser -t /dev/ttyS0 -x"
 
# Default Compiler Flags
#
# Resets build flags. You can also initialize them to some preset
# default values here if you wish.
#
export KOS_INC_PATHS=""
export KOS_CFLAGS=""
export KOS_CPPFLAGS=""
export KOS_LDFLAGS=""
export KOS_AFLAGS=""
export DC_ARM_LDFLAGS=""
 
# Debug Builds
#
# Controls whether to disable additional debugging checks and assertions,
# such as for parameter validation or internal errors. Uncomment this if
# you do not wish to compile with this additional logic enabled.
#
#export KOS_CFLAGS="${KOS_CFLAGS} -DNDEBUG"


= SH-ELF =
# Optimization Level
#
# Controls the baseline optimization level to use when building.
# Typically this is -Og (debugging), -O0, -O1, -O2, or -O3.
# NOTE: For our target, -O4 is a valid optimization level that has
# been seen to have some performance impact as well.
#
export KOS_CFLAGS="${KOS_CFLAGS} -O2"
 
# Additional Optimizations
#
# Uncomment this to enable what has been found empirically to be
# the optimal set of additional flags for release build performance
# on the current stable toolchain. NOTE: Certain KOS-ports and examples
# do not work properly with "-flto=auto"!
#
#export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple -flto=auto"
 
# Frame Pointers
#
# Controls whether frame pointers are emitted or not. Disabled by
# default. Enable them if you plan to use GDB for debugging.
#
export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer"
#export KOS_CFLAGS="${KOS_CFLAGS} -fno-omit-frame-pointer -DFRAME_POINTERS"
 
# Stack Protector
#
# Controls whether GCC emits extra code to check for buffer overflows or stack
# smashing, which can be very useful for debugging. -fstack-protector only
# covers vulnerable objects, while -fstack-protector-strong provides medium
# coverage, and -fstack-protector-all provides full coverage. You may also
# override the default stack excepton handler by providing your own
# implementation of "void __stack_chk_fail(void)."
#
#export KOS_CFLAGS="${KOS_CFLAGS} -fstack-protector-all"
 
# GCC Builtin Functions
#
# Comment out this line to enable GCC to use its own builtin implementations of
# certain standard library functions. Under certain conditions, this can allow
# compiler-optimized implementations to replace standard function invocations.
# The downside of this is that it COULD interfere with Newlib or KOS implementations
# of these functions, and it has not been tested thoroughly to ensure compatibility.
#
export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin"
 
# Fast Math Instructions
#
# Uncomment this line to enable the optimized fast-math instructions (FSSRA,
# FSCA, and FSQRT) for calculating sin/cos, inverse square root, and square roots.
# These can result in substantial performance gains for these kinds of operations;
# however, they do so at the price of accuracy and are not IEEE compliant.
# NOTE: Enabling this option will also override -fno-builtin!
#
#export KOS_CFLAGS="${KOS_CFLAGS} -fbuiltin -ffast-math -ffp-contract=fast"
 
# SH4 Floating-Point Arithmetic Precision
#
# KallistiOS supports both the single-precision-default ABI (m4-single) and the
# single-precision-only ABI (m4-single-only). When using m4-single, the SH4 will
# be in single-precision mode upon function entry but will switch to double-
# precision mode if 64-bit doubles are used. When using m4-single-only, the SH4
# will always be in single-precision mode and 64-bit doubles will be truncated to
# 32-bit floats. Historically, m4-single-only was used in both official and
# homebrew Dreamcast software, but m4-single is the default as of KOS 2.2.0 to
# increase compatibility with newer libraries which require 64-bit doubles.
#
# WARNING: When adjusting this setting, make sure all software, including
#          kos-ports and linked external libraries, are rebuilt using the same
#          floating-point precision ABI setting!
#
export KOS_SH4_PRECISION="-m4-single"
 
# Use LRA (Local Register Allocator) Pass
#
# Uncomment this line to use the modern Local Register Allocator pass during
# code generation instead of the default older reload pass. This option is
# known to be unstable or less performant for SH at this time, but will likely
# become mandatory in future versions of GCC, so feel free to help us test.
# Only enable this setting if you understand what you are doing!
#
#export KOS_CFLAGS="${KOS_CFLAGS} -mlra"
 
# Shared Compiler Configuration
#
# Include sub architecture-independent configuration file for shared
# environment settings. If you want to configure additional compiler
# options or see where other build flags are set, look at this file.
#
. ${KOS_BASE}/environ_base.sh
</pre>


<pre>
<pre>
USE="-threads -nptl" crossdev -t sh-elf -P -v
. environ.sh
make
</pre>
</pre>
=== KOS-ports bauen ===


<pre>
<pre>
crossdev -t sh-elf -S -P -v
git clone --recursive https://github.com/KallistiOS/kos-ports kos-ports
kos-ports/utils/build-all.sh
</pre>
</pre>

Aktuelle Version vom 18. April 2025, 22:17 Uhr

KallistiOS Toolchain

Voraussetzungen:

  • Wenn die Toolchain innerhalb eines CIFS-Mounts installiert wird müssen mfsymlinks in den Mountoptions aktiviert sein!

Crosscompiler bauen

mkdir /media/chris/development/dreamcast/toolchains
cd /media/chris/development/dreamcast/toolchains
git clone https://github.com/KallistiOS/KallistiOS.git kos
cd kos/utils/dc-chain/
cp -av Makefile.default.cfg Makefile.cfg

Makefile.cfg bearbeiten

# Sega Dreamcast Toolchains Maker (dc-chain)
# This file is part of KallistiOS.

#########################
### TOOLCHAIN PROFILE ###
#########################

# Choose a toolchain profile from the following available options:
# No longer supported upstream:
# - 9.3.0-legacy: Former 'stable' option, based on GCC 9.3.0 and Newlib 3.3.0.
# - 9.5.0-winxp:  Most recent versions of tools which run on Windows XP.
# - 10.5.0:       Last release in the GCC 10 series, released 2023-07-07.
# - 11.5.0:       Last release in the GCC 11 series, released 2024-07-19.
# Supported upstream:
# - 12.4.0:       Latest release in the GCC 12 series, released 2024-06-20.
# - stable:       Tested stable; based on GCC 13.2.0, released 2023-07-27.
# - 13.3.0:       Latest release in the GCC 13 series, released 2024-05-21.
# - 14.2.0:       Latest release in the GCC 14 series, released 2024-08-01.
# Development versions:
# - 13.3.1-dev    Bleeding edge GCC 13 series from git.
# - 14.2.1-dev    Bleeding edge GCC 14 series from git.
# - 15.0.0-dev    Bleeding edge GCC 15 series from git.
# - gccrs-dev:    GCC fork for development of the GCCRS Rust compiler.
# - rustc-dev:    GCC fork for development of the libgccjit rustc GCC codegen.
# If unsure, select stable. See README.md for more detailed descriptions.
toolchain_profile=stable

########################
### DOWNLOAD OPTIONS ###
########################

### Download protocol (http|https|ftp)
# Specify the protocol you want to use for downloading package files.
download_protocol=https

### Force downloader (curl|wget)
# Specify here if you'd prefer to use 'wget' or 'curl'. If neither is specified,
# a web downloader tool will be auto-detected in the following order: cURL, Wget
# You must have either Wget or cURL installed to use dc-chain.
#force_downloader=wget

### Specify GNU mirror override
# The default mirror for GNU sources is 'ftpmirror.gnu.org'
# This setting overrides the default mirror with a preferred mirror.
#gnu_mirror=mirrors.kernel.org

#####################
### BUILD OPTIONS ###
#####################

### SH toolchain install path
# Specify the directory where the SH toolchain will be installed. This setting
# must match the KOS_CC_BASE setting in your KOS "environ.sh" configuration.
sh_toolchain_path=/media/chris/development/dreamcast/toolchains/sh-elf

### ARM toolchain install path
# Specify the directory where the ARM toolchain will be installed. This setting
# must match the DC_ARM_BASE setting in your KOS "environ.sh" configuration.
arm_toolchain_path=/media/chris/development/dreamcast/toolchains/arm-eabi

### Make jobs (n|<empty>)
# Set this value to the number of parallel jobs you want to run with make.
# For fastest toolchain building, set to the number of CPU threads available.
# Using multiple jobs may cause issues in certain environments and may be
# automatically disabled. If you encounter errors building your toolchain,
# reduce the number of jobs to 1 to avoid issues and ease troubleshooting.
makejobs=16

### Verbose (1|0)
# Choose whether to actively display compilation messages on the screen.
# Messages are saved to the build log files regardless of this setting.
verbose=1

### Erase (1|0)
# Erase build directories as toolchain components are installed to save space.
erase=1

### Install toolchain debug symbols (1|0)
# Choose whether to keep the debugging symbols for the toolchain.
# This is only useful if you wish to debug the toolchain itself.
#toolchain_debug=1

########################
### LANGUAGE OPTIONS ###
########################

### Enable C++
# Builds C++ support, including the C++ compiler and its standard library. The
# vast majority of language features are supported, with C++23 and early C++26
# support included. KallistiOS provides several examples with C++ support, so it
# is enabled by default. Adding C++ support requires extra disk space and
# compilation time, so you may disable it here if you do not plan on using C++.
enable_cpp=1

### Enable Objective-C
# Builds Objective-C support. Currently, this builds the Obj-C compiler and
# runtime, but does not build a standard library. The GNUStep Base Library is
# currently in active development for future inclusion in the kos-ports library.
# KallistiOS provides examples with Obj-C support, so it is enabled by default.
enable_objc=1

### Enable Objective C++
# Builds Objective C++ support. This hybrid language allows both C++ and Obj-C
# methods to be called from both contexts. Enabled by default as both the C++
# and Obj-C languages are already enabled by default.
enable_objcpp=1

### Enable D
# Builds D support. This will build the D compiler, but does not build the
# Phobos Runtime Library. D support may only be enabled on POSIX platforms which
# have its external dependencies provided through a host DMD, GDC, or LDC
# compiler installation.
#enable_d=1

### Enable Ada
# Builds Ada support. This will build the GNAT Ada compiler and tools but does
# not build the libada runtime library. In order for this build to succeed, the
# host's GCC version must match the target Dreamcast version, plus the same
# version of GNAT and its tools must be preinstalled (and in your path).
#enable_ada=1

### Enable Rust
# Builds the work-in-progress GCCRS Rust compiler frontend for GCC. Requires a
# development version of GCC. Use with the gccrs-dev toolchain profile for the
# most recent updates to the GCCRS compiler. This option is not to be confused
# with using this toolchain as a backend for rustc; see libgccjit below.
#enable_rust=1

### Enable libgccjit
# Enables the libgccjit embeddable GCC library. This is most commonly enabled to
# allow using this toolchain as a backend for the official rustc compiler. Use
# with the rustc-dev toolchain profile if this is your use case.
#enable_libgccjit=1

###################
### GCC OPTIONS ###
###################

### Floating point precision support (m4-single-only|m4-single|m4)
# Build support for various SH4 floating-point operation ABIs. KallistiOS only
# officially supports single-precision-only mode (m4-single-only); however,
# experimental support for single-precision-default mode (m4-single) has been
# added to allow for the use of full 64-bit doubles. You may also include
# double-precision-default (m4) which is untested and unsupported, or you may
# choose to specify only m4-single-only to save disk space.
precision_modes=m4-single-only,m4-single

### Default floating point mode (m4|m4-single|m4-single-only)
# Choose the default floating point precision ABI used when GCC is invoked. This
# may be overridden by passing -m4-single-only, -m4-single, or -m4 to GCC.
# KOS currently only officially supports m4-single-only, so it is the default.
default_precision=m4-single-only

### GCC threading model (single|kos)
# KallistiOS patches to GCC provide a 'kos' thread model, which should be used.
# If you want to disable threading support for C++, Objective-C, and so forth,
# you can set this option to 'single'.
thread_model=kos

### Automatic patching for KallistiOS (1|0)
# Uncomment this option if you want to disable applying KallistiOS patches to
# toolchain source files before building. This will disable usage of the 'kos'
# thread model. Only do this if you understand what you are doing.
#use_kos_patches=0

### Disable GCC Native Language Support (1|0)
# By default, NLS allows GCC to output diagnostics in non-English languages.
# Uncomment this option to disable NLS and force GCC to output in English.
#disable_nls=1

######################
### NEWLIB OPTIONS ###
######################

### Automatic patching for Newlib (1|0)
# Uncomment this option if you want to disable the automatic patching of Newlib
# needed by KallistiOS. This will keep the generated toolchain completely raw.
# This will also disable the 'kos' thread model. Only do this if you understand
# what you are doing.
#auto_fixup_sh4_newlib=0

### C99 format specifier support (1|0)
# Define this to build Newlib with additional support for the C99 format
# specifiers, used by printf and friends. These include support for size_t,
# ptrdiff_t, intmax_t, and sized integral types.
newlib_c99_formats=1

### Multibyte character set support (1|0)
# Define this to build Newlib with additional multibyte support. This enables
# three special locales: "C-JIS", "C-SJIS", and "C-EUCJP". The multibyte
# support extends to the mb and wc functions in stdlib as well as format
# characters for the printf and scanf family of routines.
#newlib_multibyte=1

### iconv() character encoding conversions support (encoding list)
# Define a list here to enable support for the iconv() function and <iconv.h>
# header file. The given comma separated list defines for which encoding types
# to include bidirectional conversion support. For the full list of available
# encodings, see the Newlib configuration documentation.
#newlib_iconv_encodings=us_ascii,utf8,utf16,ucs_2_internal,ucs_4_internal

### Optimize Newlib for space (1|0)
# Uncomment this option to optimize for space when building Newlib. This will
# build Newlib with compiler flags which favor smaller code sizes over faster
# performance.
#newlib_opt_space=1

###################
### C++ OPTIONS ###
###################

### Timezone database support (1|0|path)
# Uncomment this option to enable building support for C++'s std::chrono::tzdb
# into your C++ standard library by using a combination of the system's local
# timezone DB and one dynamically fetched from the "IANA Time Zone Database."
# Without support enabled, only the "UTC" and "GMT" timezones will be defined.
# You can optionally provide the path to a directory with a custom "tzdata.zi"
# database file. NOTE: Enabling this will result in larger C++ binaries!
#libstdcxx_tzdb=1

#######################
### WINDOWS OPTIONS ###
#######################

### MinGW/MSYS
# Standalone binaries (1|0)
# Uncomment this option if you want static binaries that are standalone and
# require no dependencies. When this option is used, binaries can be run outside
# the MinGW/MSYS environment. This is NOT recommended; only do this if you know
# what you are doing.
#standalone_binary=1

### Force installation of BFD for SH (1|0)
# Uncomment this option if you want to force installation of 'libbfd' for the SH
# toolchain. This is required for MinGW/MSYS and can't be disabled in this
# scenario. This option is here mainly if you want to force the installation of
# 'libbfd' under other environments, but this won't be necessary in most cases,
# as 'libelf' is used almost everywhere. Please note, 'libbfd' is not portable
# if you built it on another environment. Only use this flag if you understand
# what you are doing.
#sh_force_libbfd_installation=1

Make durchführen:

PATH=/usr/bin make all

KOS bauen

eviron.sh:

# KallistiOS Environment Settings
#
# This is a sample script for configuring and customizing your
# KOS build environment. Modify it to suit your setup. Several
# settings may be enabled optionally or are provided with
# alternative values.
#
# This script is typically sourced in your current shell environment
# (probably by .bashrc, .bash_profile, or something similar), so that
# the KOS environment is set up automatically for each shell session.
#

# Build Architecture
#
# Set the major architecture you'll be building for.
# The only option here is "dreamcast" as of KOS 2.0.0.
#
export KOS_ARCH="dreamcast"

# Build Sub-Architecture
#
# Defines the sub architecture your configuration
# is targeting or uses an existing value that
# can be set externally via your IDE.
#
# Valid values:
#   "pristine" - Dreamcast console or HKT-0120 devkit (default)
#   "naomi"    - NAOMI or NAOMI 2 arcade board
#
if [ -z "${KOS_SUBARCH}" ] ; then
    export KOS_SUBARCH="pristine"
else
    export KOS_SUBARCH
fi

# KOS Root Path
#
# Specifies the path to the KOS root directory
#
export KOS_BASE="/media/chris/development/dreamcast/toolchains/kos"

# KOS-Ports Path
#
# Specifies the path to the KOS-ports directory
#
export KOS_PORTS="${KOS_BASE}/../kos-ports"

# SH Compiler Prefixes
#
# Specifies the path to and prefix for the main SH
# GCC toolchain used to target the Dreamcast's SH4 CPU.
#
export KOS_CC_BASE="/media/chris/development/dreamcast/toolchains/sh-elf"
export KOS_CC_PREFIX="sh-elf"

# ARM Compiler Prefixes
#
# Specifies the path to and prefix for the additional ARM
# GCC toolchain used to target the Dreamcast's AICA SPU.
#
export DC_ARM_BASE="/media/chris/development/dreamcast/toolchains/arm-eabi"
export DC_ARM_PREFIX="arm-eabi"

# External Dreamcast Tools Path
#
# Specifies the path where Dreamcast tools that are not part of KOS are to be
# installed. This includes, for example, dc-tool-ip, dc-tool-serial, and the
# mrbc bytecode compiler. This directory, along with SH and ARM compiler
# toolchains, will be added to your PATH environment variable.
#
export DC_TOOLS_BASE="/media/chris/development/dreamcast/tools"

# CMake Toolchain Path
#
# Specifies the path to the toolchain file used to target
# KOS with the "cmake" build utility.
#
export KOS_CMAKE_TOOLCHAIN="${KOS_BASE}/utils/cmake/dreamcast.toolchain.cmake"

# Genromfs Utility Path
#
# Specifies the path to the utility which is used by KOS
# to create romdisk filesystem images.
#
export KOS_GENROMFS="${KOS_BASE}/utils/genromfs/genromfs"

# Make Utility
#
# Configures the tool to be used as the main "make" utility
# for building GNU Makefiles. On a platform such as BSD,
# the default can be changed to "gmake," for the GNU
# implementation.
#
export KOS_MAKE="make"
#export KOS_MAKE="gmake"

# Loader Utility
#
# Specifies the loader to be used with the "make run" targets
# in the KOS examples. Defaults to using a preconfigured version
# of dc-tool. Use one of the other options for a manual dc-tool-ip
# or dc-tool-serial configuration, remembering to change the values
# for the Dreamcast's IP address or the serial port interface.
#
#export KOS_LOADER="dc-tool -x"
export KOS_LOADER="dc-tool-ip -t dreamcast -x"
#export KOS_LOADER="dc-tool-ser -t /dev/ttyS0 -x"

# Default Compiler Flags
#
# Resets build flags. You can also initialize them to some preset
# default values here if you wish.
#
export KOS_INC_PATHS=""
export KOS_CFLAGS=""
export KOS_CPPFLAGS=""
export KOS_LDFLAGS=""
export KOS_AFLAGS=""
export DC_ARM_LDFLAGS=""

# Debug Builds
#
# Controls whether to disable additional debugging checks and assertions,
# such as for parameter validation or internal errors. Uncomment this if
# you do not wish to compile with this additional logic enabled.
#
#export KOS_CFLAGS="${KOS_CFLAGS} -DNDEBUG"

# Optimization Level
#
# Controls the baseline optimization level to use when building.
# Typically this is -Og (debugging), -O0, -O1, -O2, or -O3.
# NOTE: For our target, -O4 is a valid optimization level that has
# been seen to have some performance impact as well.
#
export KOS_CFLAGS="${KOS_CFLAGS} -O2"

# Additional Optimizations
#
# Uncomment this to enable what has been found empirically to be
# the optimal set of additional flags for release build performance
# on the current stable toolchain. NOTE: Certain KOS-ports and examples
# do not work properly with "-flto=auto"!
#
#export KOS_CFLAGS="${KOS_CFLAGS} -freorder-blocks-algorithm=simple -flto=auto"

# Frame Pointers
#
# Controls whether frame pointers are emitted or not. Disabled by
# default. Enable them if you plan to use GDB for debugging.
#
export KOS_CFLAGS="${KOS_CFLAGS} -fomit-frame-pointer"
#export KOS_CFLAGS="${KOS_CFLAGS} -fno-omit-frame-pointer -DFRAME_POINTERS"

# Stack Protector
#
# Controls whether GCC emits extra code to check for buffer overflows or stack
# smashing, which can be very useful for debugging. -fstack-protector only
# covers vulnerable objects, while -fstack-protector-strong provides medium
# coverage, and -fstack-protector-all provides full coverage. You may also
# override the default stack excepton handler by providing your own
# implementation of "void __stack_chk_fail(void)."
#
#export KOS_CFLAGS="${KOS_CFLAGS} -fstack-protector-all"

# GCC Builtin Functions
#
# Comment out this line to enable GCC to use its own builtin implementations of
# certain standard library functions. Under certain conditions, this can allow
# compiler-optimized implementations to replace standard function invocations.
# The downside of this is that it COULD interfere with Newlib or KOS implementations
# of these functions, and it has not been tested thoroughly to ensure compatibility.
#
export KOS_CFLAGS="${KOS_CFLAGS} -fno-builtin"

# Fast Math Instructions
#
# Uncomment this line to enable the optimized fast-math instructions (FSSRA,
# FSCA, and FSQRT) for calculating sin/cos, inverse square root, and square roots.
# These can result in substantial performance gains for these kinds of operations;
# however, they do so at the price of accuracy and are not IEEE compliant.
# NOTE: Enabling this option will also override -fno-builtin!
#
#export KOS_CFLAGS="${KOS_CFLAGS} -fbuiltin -ffast-math -ffp-contract=fast"

# SH4 Floating-Point Arithmetic Precision
#
# KallistiOS supports both the single-precision-default ABI (m4-single) and the
# single-precision-only ABI (m4-single-only). When using m4-single, the SH4 will
# be in single-precision mode upon function entry but will switch to double-
# precision mode if 64-bit doubles are used. When using m4-single-only, the SH4
# will always be in single-precision mode and 64-bit doubles will be truncated to
# 32-bit floats. Historically, m4-single-only was used in both official and
# homebrew Dreamcast software, but m4-single is the default as of KOS 2.2.0 to
# increase compatibility with newer libraries which require 64-bit doubles.
#
# WARNING: When adjusting this setting, make sure all software, including
#          kos-ports and linked external libraries, are rebuilt using the same
#          floating-point precision ABI setting!
#
export KOS_SH4_PRECISION="-m4-single"

# Use LRA (Local Register Allocator) Pass
#
# Uncomment this line to use the modern Local Register Allocator pass during
# code generation instead of the default older reload pass. This option is
# known to be unstable or less performant for SH at this time, but will likely
# become mandatory in future versions of GCC, so feel free to help us test.
# Only enable this setting if you understand what you are doing!
#
#export KOS_CFLAGS="${KOS_CFLAGS} -mlra"

# Shared Compiler Configuration
#
# Include sub architecture-independent configuration file for shared
# environment settings. If you want to configure additional compiler
# options or see where other build flags are set, look at this file.
#
. ${KOS_BASE}/environ_base.sh
. environ.sh
make

KOS-ports bauen

git clone --recursive https://github.com/KallistiOS/kos-ports kos-ports
kos-ports/utils/build-all.sh