-#############################################################
-#
-# build the first pass gcc compiler
-#
-#############################################################
-
-GCC_BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-$(GCC_VERSION)-initial
-
-$(DL_DIR)/$(GCC_SOURCE):
- mkdir -p $(DL_DIR)
- $(SCRIPT_DIR)/download.pl $(DL_DIR) $(GCC_SOURCE) x $(GCC_SITE)
-
-$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)
- mkdir -p $(TOOL_BUILD_DIR)
- $(GCC_CAT) $(DL_DIR)/$(GCC_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
- touch $(GCC_DIR)/.unpacked
-
-$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked
- # Apply any files named gcc-*.patch from the source directory to gcc
- $(SCRIPT_DIR)/patch-kernel.sh $(GCC_DIR) ./$(GCC_VERSION) \*.patch
- # Note: The soft float situation has improved considerably with gcc 3.4.x.
- # We can dispense with the custom spec files, as well as libfloat for the arm case.
- # However, we still need a patch for arm. There's a similar patch for gcc 3.3.x
- # which needs to be integrated so we can kill of libfloat for good.
- $(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(GCC_DIR)/gcc/version.c
- $(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,' $(GCC_DIR)/gcc/version.c
- touch $(GCC_DIR)/.patched
-
-# The --without-headers option stopped working with gcc 3.0 and has never been
-# # fixed, so we need to actually have working C library header files prior to
-# # the step or libgcc will not build...
-
-$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
- mkdir -p $(GCC_BUILD_DIR1)
- (cd $(GCC_BUILD_DIR1); rm -f config.cache; PATH=$(TARGET_PATH) \
- $(GCC_DIR)/configure \
- --prefix=$(STAGING_DIR) \
+PATCH_DIR=./patches/$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/toolchain-build.mk
+
+HOST_STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.gcc-initial_installed
+
+HOST_BUILD_DIR0:=$(HOST_BUILD_DIR)-minimal
+HOST_BUILD_DIR1:=$(HOST_BUILD_DIR)-initial
+HOST_BUILD_DIR2:=$(HOST_BUILD_DIR)-final
+
+SEP:=,
+TARGET_LANGUAGES:="c$(if $(CONFIG_INSTALL_LIBSTDCPP),$(SEP)c++)$(if $(CONFIG_INSTALL_LIBGCJ),$(SEP)java)"
+
+GCC_CONFIGURE:= \
+ SHELL="$(BASH)" \
+ $(HOST_BUILD_DIR)/configure \
+ --prefix=$(TOOLCHAIN_DIR)/usr \