Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: |
mkdir build-linux
cd build-linux
../configure --prefix /opt/gcc/linux
../configure --disable-debug --prefix /opt/gcc/linux
make -j$(nproc) stamps/build-gcc-stage2

- name: Build Win32
Expand All @@ -37,7 +37,7 @@ jobs:
cd ../..
mkdir build-win32
cd build-win32
../configure --prefix /opt/gcc/win32 --with-host=x86_64-w64-mingw32
../configure --disable-debug --prefix /opt/gcc/win32 --with-host=x86_64-w64-mingw32
make -j$(nproc) stamps/build-binutils-tc
export PATH="/opt/gcc/linux/bin:$PATH"
make -j$(nproc) stamps/build-gcc-stage2-only
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
run: |
mkdir build-linux
cd build-linux
../configure --prefix /opt/gcc/linux
../configure --disable-debug --prefix /opt/gcc/linux
make -j$(nproc) stamps/build-qemu

- name: Package
Expand Down Expand Up @@ -111,7 +111,7 @@ jobs:
run: |
mkdir build-win32
cd build-win32
../configure --prefix /opt/gcc/win32 --with-host=x86_64-w64-mingw32
../configure --disable-debug --prefix /opt/gcc/win32 --with-host=x86_64-w64-mingw32
make -j$(nproc) stamps/build-qemu

- name: Package
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
run: |
mkdir build-linux
cd build-linux
../configure --prefix /opt/gcc/linux
../configure --disable-debug --prefix /opt/gcc/linux
make -j$(nproc) stamps/build-gdb

- name: Package
Expand Down Expand Up @@ -178,7 +178,7 @@ jobs:
run: |
mkdir build-win32
cd build-win32
../configure --prefix /opt/gcc/win32 --with-host=x86_64-w64-mingw32
../configure --disable-debug --prefix /opt/gcc/win32 --with-host=x86_64-w64-mingw32
make -j$(nproc) stamps/build-gdb

- name: Package
Expand Down
125 changes: 68 additions & 57 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GCC_SRCDIR := @with_gcc_src@

CONFIGURE_LIBSTDCXX = @configure_libstdcxx@
CONFIGURE_HOST = @configure_host@
CONFIGURE_DEBUG = @configure_debug@
QEMU_CONFIGURE_HOST = @qemu_configure_host@

QEMU_VERSION := 9.2.3
Expand Down Expand Up @@ -62,6 +63,17 @@ else
QEMU_ENV_VARS :=
endif

CFLAGS := -O2 $(CONFIGURE_DEBUG)
CXXFLAGS := -O2 $(CONFIGURE_DEBUG)

ifeq ($(CONFIGURE_DEBUG),-g)
QEMU_CONFIGURE_DEBUG := --enable-debug-info
LDFLAGS :=
else
QEMU_CONFIGURE_DEBUG := --disable-debug-info
LDFLAGS := -s
endif

all: stamps/build-qemu stamps/build-gcc-stage2

clean-binutils-tc:
Expand Down Expand Up @@ -112,6 +124,24 @@ $(ISL_PACKAGE):
$(ISL_SRCDIR): $(ISL_PACKAGE)
tar xf $<

$(QEMU_PACKAGE):
curl --http1.1 -L -o $@ $(QEMU_DOWNLOAD_URL)

$(QEMU_SRCDIR): $(QEMU_PACKAGE)
tar xf $<

$(NCURSES_PACKAGE):
curl --http1.1 -L -o $@ $(NCURSES_DOWNLOAD_URL)

$(NCURSES_SRCDIR): $(NCURSES_PACKAGE)
tar xf $<

$(ICONV_PACKAGE):
curl --http1.1 -L -o $@ $(ICONV_DOWNLOAD_URL)

$(ICONV_SRCDIR): $(ICONV_PACKAGE)
tar xf $<

stamps/build-gmp: $(GMP_SRCDIR)
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
Expand All @@ -121,9 +151,9 @@ stamps/build-gmp: $(GMP_SRCDIR)
--disable-assembly \
--enable-static \
--disable-shared \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@
Expand All @@ -137,9 +167,9 @@ stamps/build-isl: $(ISL_SRCDIR) stamps/build-gmp
--enable-static \
--disable-shared \
--with-gmp-prefix=$(INSTALL_DIR)/deps \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@
Expand All @@ -154,9 +184,9 @@ stamps/build-mpfr: $(MPFR_SRCDIR) stamps/build-isl
--with-gmp-lib=$(INSTALL_DIR)/deps/lib \
--enable-static \
--disable-shared \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@
Expand All @@ -173,9 +203,9 @@ stamps/build-mpc: $(MPC_SRCDIR) stamps/build-mpfr
--with-mpfr-lib=$(INSTALL_DIR)/deps/lib \
--enable-static \
--disable-shared \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@
Expand Down Expand Up @@ -217,9 +247,9 @@ stamps/build-binutils-mcs: $(BINUTILS_SRCDIR) stamps/build-mpc
--with-gnu-ld \
--with-gnu-as \
--disable-werror \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@) MAKEINFO=true
$(MAKE) -C $(notdir $@) MAKEINFO=true install
mkdir -p $(dir $@) && touch $@
Expand Down Expand Up @@ -263,9 +293,9 @@ stamps/build-binutils-tc: $(BINUTILS_SRCDIR) stamps/build-binutils-mcs
--with-gnu-ld \
--with-gnu-as \
--disable-werror \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@) MAKEINFO=true
$(MAKE) -C $(notdir $@) MAKEINFO=true install
mkdir -p $(dir $@) && touch $@
Expand Down Expand Up @@ -305,9 +335,9 @@ stamps/build-gcc-stage1: $(GCC_SRCDIR) stamps/build-binutils-tc
--disable-test-suite \
CFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \
CXXFLAGS_FOR_TARGET='-g -O2 -gdwarf-3' \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@) all-gcc
$(MAKE) -C $(notdir $@) install-gcc
mkdir -p $(dir $@) && touch $@
Expand Down Expand Up @@ -375,9 +405,9 @@ stamps/build-gcc-stage2: $(GCC_SRCDIR) stamps/build-newlib
--disable-test-suite \
CFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \
CXXFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@) all
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@
Expand Down Expand Up @@ -420,46 +450,33 @@ stamps/build-gcc-stage2-only: $(GCC_SRCDIR) stamps/build-mpc
--disable-test-suite \
CFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \
CXXFLAGS_FOR_TARGET='-g -gdwarf-3 -O2 -ffast-math -ffunction-sections -mfast-div -fno-common -mno-eabi-bitfield-limit' \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@) all
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

$(QEMU_SRCDIR): $(QEMU_PACKAGE)
tar xf $<

$(QEMU_PACKAGE):
curl --http1.1 -L -o $@ $(QEMU_DOWNLOAD_URL)

stamps/build-qemu: $(QEMU_SRCDIR)
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
if test "$(QEMU_CONFIGURE_HOST)" = "--cross-prefix=x86_64-w64-mingw32-"; then cd $(notdir $@) && $(srcdir)/scripts/build-mingw32-deps $(INSTALL_DIR); fi
cd $(notdir $@) && $(QEMU_ENV_VARS) $</configure \
--prefix=$(INSTALL_DIR) \
$(QEMU_CONFIGURE_HOST) \
$(QEMU_CONFIGURE_DEBUG) \
--target-list=tricore-softmmu \
--bindir=bin \
--datadir=share/qemu \
--localedir=share/locale \
--static \
--without-default-features \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@) all
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@


$(NCURSES_PACKAGE):
curl --http1.1 -L -o $@ $(NCURSES_DOWNLOAD_URL)

$(NCURSES_SRCDIR): $(NCURSES_PACKAGE)
tar xf $<

stamps/build-ncurses: $(NCURSES_SRCDIR)
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
Expand All @@ -478,19 +495,13 @@ stamps/build-ncurses: $(NCURSES_SRCDIR)
--without-manpages \
--without-progs \
--without-tests \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@

$(ICONV_PACKAGE):
curl --http1.1 -L -o $@ $(ICONV_DOWNLOAD_URL)

$(ICONV_SRCDIR): $(ICONV_PACKAGE)
tar xf $<

stamps/build-iconv: $(ICONV_SRCDIR)
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
Expand All @@ -499,9 +510,9 @@ stamps/build-iconv: $(ICONV_SRCDIR)
$(CONFIGURE_HOST) \
--enable-static \
--disable-shared \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS)"
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) install
mkdir -p $(dir $@) && touch $@
Expand Down Expand Up @@ -547,9 +558,9 @@ stamps/build-gdb: $(BINUTILS_SRCDIR) stamps/build-mpc stamps/build-iconv
--with-gnu-ld \
--with-gnu-as \
--disable-unit-tests \
CFLAGS="-O2" \
CXXFLAGS="-O2" \
LDFLAGS="-s -L$(INSTALL_DIR)/deps/lib"
CFLAGS="$(CFLAGS)" \
CXXFLAGS="$(CXXFLAGS)" \
LDFLAGS="$(LDFLAGS) -L$(INSTALL_DIR)/deps/lib"
$(MAKE) -C $(notdir $@)
$(MAKE) -C $(notdir $@) prefix=$(INSTALL_DIR) install
mkdir -p $(dir $@) && touch $@
23 changes: 23 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ LIBOBJS
with_gcc_src
with_newlib_src
with_binutils_src
configure_debug
configure_libstdcxx
qemu_configure_host
configure_host
Expand Down Expand Up @@ -677,6 +678,7 @@ ac_user_opts='
enable_option_checking
with_host
enable_libstdcxx
enable_debug
with_binutils_src
with_newlib_src
with_gcc_src
Expand Down Expand Up @@ -1311,6 +1313,8 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-libstdcxx do not build GCC libstdcxx-v3
--enable-debug build toolchain with debug symbols and avoid
stripping final executables

Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
Expand Down Expand Up @@ -3597,6 +3601,25 @@ else $as_nop

fi

# Check whether --enable-debug was given.
if test ${enable_debug+y}
then :
enableval=$enable_debug;
else $as_nop
enable_debug=yes

fi


if test "x$enable_debug" != xno
then :
configure_debug="-g"

else $as_nop
configure_debug=""

fi


# Check whether --with-binutils-src was given.
if test ${with_binutils_src+y}
Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@ AS_IF([test "x$enable_libstdcxx" != xno],
[AC_SUBST(configure_libstdcxx,"--enable-libstdcxx --enable-libstdcxx-debug-flags='-gdwarf-3 -g -O0 -D_GLIBCXX_ASSERTIONS' --disable-libstdcxx-pch")],
[AC_SUBST(configure_libstdcxx,--disable-libstdcxx)])

AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],
[build toolchain with debug symbols and avoid stripping final executables])],
[],
[enable_debug=yes]
)

AS_IF([test "x$enable_debug" != xno],
[AC_SUBST(configure_debug,"-g")],
[AC_SUBST(configure_debug,"")])

AC_ARG_WITH(binutils-src,
[AS_HELP_STRING([--with-binutils-src],[Set binutils source path, use builtin source by default])],
[],
Expand Down