diff --git a/litecross/Makefile b/litecross/Makefile index d0fbe0c..33d1b79 100644 --- a/litecross/Makefile +++ b/litecross/Makefile @@ -86,8 +86,15 @@ ifneq ($(NATIVE),) HOST:=$(TARGET) endif +ifeq ($(BUILD),) +GUESS = $(shell cd $(GCC_SRCDIR) && ./config.guess) +TARGET_CANON = $(shell cd $(GCC_SRCDIR) && ./config.sub $(TARGET)) +BUILD = $(GUESS)$(if $(subst $(TARGET_CANON),,$(GUESS)),,xx) +endif + ifeq ($(HOST),) SYSROOT = /$(TARGET) +FULL_BINUTILS_CONFIG += --build=$(BUILD) --host=$(BUILD) FULL_GCC_CONFIG += --with-build-sysroot=$(CURDIR)/obj_sysroot \ AR_FOR_TARGET=$(PWD)/obj_binutils/binutils/ar \ AS_FOR_TARGET=$(PWD)/obj_binutils/gas/as-new \ @@ -98,6 +105,7 @@ FULL_GCC_CONFIG += --with-build-sysroot=$(CURDIR)/obj_sysroot \ RANLIB_FOR_TARGET=$(PWD)/obj_binutils/binutils/ranlib \ READELF_FOR_TARGET=$(PWD)/obj_binutils/binutils/readelf \ STRIP_FOR_TARGET=$(PWD)/obj_binutils/binutils/strip-new \ + --build=$(BUILD) --host=$(BUILD) \ # end FULL_MUSL_CONFIG += CC="$(XGCC)" LIBCC="../obj_gcc/$(TARGET)/libgcc/libgcc.a" MUSL_VARS = AR=../obj_binutils/binutils/ar RANLIB=../obj_binutils/binutils/ranlib @@ -108,8 +116,8 @@ obj_gcc/.lc_built: | obj_sysroot/.lc_libs obj_sysroot/.lc_headers obj_gcc/.lc_configured: obj_binutils/.lc_built else SYSROOT = / -FULL_BINUTILS_CONFIG += --host=$(HOST) -FULL_GCC_CONFIG += --host=$(HOST) +FULL_BINUTILS_CONFIG += --build=$(BUILD) --host=$(HOST) +FULL_GCC_CONFIG += --build=$(BUILD) --host=$(HOST) MUSL_VARS = endif