123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- # This file is part of the OpenADK project. OpenADK is copyrighted
- # material, please see the LICENCE file in the top-level directory.
- include $(TOPDIR)/rules.mk
- include ../rules.mk
- include Makefile.inc
- ifeq ($(ADK_CXX),y)
- TARGET_LANGUAGES:= c,c++
- else
- TARGET_LANGUAGES:= c
- endif
- GCC_CONFOPTS= --prefix=$(STAGING_TOOLS) \
- --build=$(GNU_HOST_NAME) \
- --host=$(GNU_HOST_NAME) \
- --target=$(REAL_GNU_TARGET_NAME) \
- --with-gmp=$(STAGING_TOOLS) \
- --with-mpfr=$(STAGING_TOOLS) \
- --disable-__cxa_atexit \
- --enable-target-optspace \
- --with-gnu-ld \
- --disable-libmudflap \
- --disable-libgomp \
- --disable-biarch \
- --disable-multilib \
- --disable-sjlj-exceptions \
- --disable-nls
- ifeq ($(ADK_SSP),y)
- GCC_CONFOPTS+= --enable-libssp
- else
- GCC_CONFOPTS+= --disable-libssp
- endif
- ifeq ($(ADK_TARGET_NO_FPU),y)
- GCC_CONFOPTS+= --with-float=soft
- endif
- ifeq ($(ADK_LINUX_64),y)
- GCC_CONFOPTS+= --with-abi=64
- endif
- ifeq ($(ADK_TARGET_LIB_UCLIBC),y)
- GCC_CONFOPTS+= --disable-tls
- endif
- include ${TOPDIR}/mk/buildhlp.mk
- GCC_BUILD_DIR_MINIMAL:= $(WRKBUILD)-minimal
- GCC_BUILD_DIR_INITIAL:= $(WRKBUILD)-initial
- GCC_BUILD_DIR_FINAL:= $(WRKBUILD)-final
- $(GCC_BUILD_DIR_MINIMAL)/.configured:
- mkdir -p $(GCC_BUILD_DIR_MINIMAL)
- (cd $(GCC_BUILD_DIR_MINIMAL); rm -f config.cache; \
- PATH=$(TARGET_PATH) \
- $(WRKBUILD)/configure \
- ${GCC_CONFOPTS} \
- --enable-languages=c \
- --disable-shared \
- --with-newlib \
- --without-headers \
- );
- touch $@
- $(GCC_BUILD_DIR_MINIMAL)/.compiled: $(GCC_BUILD_DIR_MINIMAL)/.configured
- PATH=$(TARGET_PATH) \
- $(MAKE) -C $(GCC_BUILD_DIR_MINIMAL) all-gcc
- touch $@
- $(WRKBUILD)/.headers: $(GCC_BUILD_DIR_MINIMAL)/.compiled
- PATH=$(TARGET_PATH) \
- $(MAKE) -C $(GCC_BUILD_DIR_MINIMAL) install-gcc
- touch $@
- $(GCC_BUILD_DIR_INITIAL)/.configured:
- rm -rf $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
- ln -sf ${STAGING_DIR}/include $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
- rm -rf ${STAGING_TOOLS}/$(REAL_GNU_TARGET_NAME)/lib
- ln -sf ${STAGING_DIR}/lib $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/lib
- mkdir -p $(GCC_BUILD_DIR_INITIAL)
- (cd $(GCC_BUILD_DIR_INITIAL); rm -f config.cache; \
- PATH=$(TARGET_PATH) \
- $(WRKBUILD)/configure \
- ${GCC_CONFOPTS} \
- --enable-languages=c \
- --disable-shared \
- --with-sysroot=$(TOOLCHAIN_SYSROOT) \
- );
- touch $@
- $(GCC_BUILD_DIR_INITIAL)/.compiled: $(GCC_BUILD_DIR_INITIAL)/.configured
- PATH=$(TARGET_PATH) \
- $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) all
- touch $@
- $(WRKBUILD)/.configured: $(GCC_BUILD_DIR_INITIAL)/.compiled
- PATH=$(TARGET_PATH) \
- $(MAKE) -C $(GCC_BUILD_DIR_INITIAL) install
- touch $@
- $(GCC_BUILD_DIR_FINAL)/.configured:
- mkdir -p $(GCC_BUILD_DIR_FINAL)
- (cd $(GCC_BUILD_DIR_FINAL); rm -f config.cache; \
- PATH=$(TARGET_PATH) \
- $(WRKBUILD)/configure \
- ${GCC_CONFOPTS} \
- --enable-languages=$(TARGET_LANGUAGES) \
- --with-sysroot=$(STAGING_DIR) \
- --with-slibdir=$(STAGING_DIR)/lib \
- --enable-shared \
- );
- touch $@
- $(WRKBUILD)/.compiled: $(GCC_BUILD_DIR_FINAL)/.configured
- PATH=$(TARGET_PATH) \
- $(MAKE) -C $(GCC_BUILD_DIR_FINAL) all
- touch $@
- $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
- PATH=$(TARGET_PATH) \
- $(MAKE) -C $(GCC_BUILD_DIR_FINAL) install
- # workaround if you cross-compile binutils
- @-rm $(STAGING_DIR)/lib/libiberty.a
- # Set up the symlinks to enable lying about target name.
- set -e; \
- (cd $(STAGING_TOOLS); \
- ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
- cd bin; \
- for app in $(REAL_GNU_TARGET_NAME)-* ; do \
- ln -sf $${app} \
- $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
- done; \
- )
- touch $@
- include ${TOPDIR}/mk/toolchain.mk
|