source: freewrt/toolchain/gcc/Makefile@ e495198

Last change on this file since e495198 was e495198, checked in by Thorsten Glaser <tg@…>, 18 years ago

use setjmp/longjmp exceptions

git-svn-id: svn://www.freewrt.org/trunk/freewrt@3097 afb5a338-a214-0410-bd46-81f09a774fd1

  • Property mode set to 100644
File size: 4.2 KB
RevLine 
[9317cd4]1# $FreeWRT$
[475ad56]2
3include $(TOPDIR)/rules.mk
[8e4e7a3]4include ../rules.mk
[475ad56]5
[e495198]6WRKDIR?= ${WRKDIR_BASE}/w-gcc-${GCC_VERSION}-2
[99cbe83]7
[8fba93c]8GCC_VERSION:= 3.4.4
[99cbe83]9MASTER_SITES:= ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(GCC_VERSION)/ \
10 http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(GCC_VERSION)/
11PKG_MD5SUM:= b594ff4ea4fbef4ba9220887de713dfe
[8fba93c]12SOURCE:= gcc-$(GCC_VERSION).tar.bz2
[99cbe83]13GCC_DIR:= $(WRKDIR)/gcc-$(GCC_VERSION)
[475ad56]14
[8fba93c]15TARGET_LANGUAGES:= c,c++
[475ad56]16
[99cbe83]17GCC_BUILD_DIR1:= $(WRKDIR)/gcc-$(GCC_VERSION)-initial
[475ad56]18
[892d28e]19GCC_CONFOPTS= --prefix=$(STAGING_TOOLS) \
20 --build=$(GNU_HOST_NAME) \
21 --host=$(GNU_HOST_NAME) \
22 --target=$(REAL_GNU_TARGET_NAME) \
23 --disable-__cxa_atexit \
[e495198]24 --enable-sjlj-exceptions \
[892d28e]25 --enable-target-optspace \
26 --with-gnu-ld \
27 --disable-nls \
28 --disable-dependency-tracking \
29 --disable-libtool-lock
[212f6ef]30
[99cbe83]31include ${TOPDIR}/mk/fetch.mk
[c17ae22]32include ${TOPDIR}/mk/targets.mk
[475ad56]33
[99cbe83]34$(GCC_DIR)/.unpacked: ${_CHECKSUM_COOKIE}
[8e4e7a3]35 ${EXTRACT_CMD}
[2e24236]36 touch $@
[475ad56]37
38$(GCC_DIR)/.patched: $(GCC_DIR)/.unpacked
39 # Apply any files named gcc-*.patch from the source directory to gcc
[eab0bcd]40 ${MBSH} $(SCRIPT_DIR)/patch-kernel.sh $(GCC_DIR) ./$(GCC_VERSION) \*.patch
[892d28e]41 typeset -i REV; \
42 if fgrep xml .svn/entries >/dev/null 2>&1; then \
43 let REV="$$(sed -n '/revision=/s/^.*"\([0-9]*\)".*$$/\1/p' \
44 .svn/entries)"; \
45 else \
46 let REV="$$(head -n 4 .svn/entries | tail -1)"; \
47 fi; ${SED} 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (FreeWRT rev. '"$$REV"')\2,' ${GCC_DIR}/gcc/version.c
[9317cd4]48 $(SED) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:http://www.freewrt.org/development/freewrt>\2,' $(GCC_DIR)/gcc/version.c
[2e24236]49 touch $@
[475ad56]50
51$(GCC_BUILD_DIR1)/.configured: $(GCC_DIR)/.patched
52 mkdir -p $(GCC_BUILD_DIR1)
53 (cd $(GCC_BUILD_DIR1); rm -f config.cache; PATH=$(TARGET_PATH) \
54 $(GCC_DIR)/configure \
[892d28e]55 ${GCC_CONFOPTS} \
[475ad56]56 --enable-languages=c \
57 --disable-shared \
[0ea1f3f]58 --with-sysroot=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
[2e24236]59 );
60 touch $@
[475ad56]61
62$(GCC_BUILD_DIR1)/.compiled: $(GCC_BUILD_DIR1)/.configured
63 PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) all-gcc
[2e24236]64 touch $@
[475ad56]65
[9baf0a6]66$(STAGING_TOOLS)/bin/$(REAL_GNU_TARGET_NAME)-gcc: $(GCC_BUILD_DIR1)/.compiled
[475ad56]67 PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR1) install-gcc
68
[99cbe83]69GCC_BUILD_DIR2:=$(WRKDIR)/gcc-$(GCC_VERSION)-final
[475ad56]70$(GCC_BUILD_DIR2)/.configured: $(GCC_DIR)/.patched $(STAGING_DIR)/lib/libc.a
[9baf0a6]71 mkdir -p $(GCC_BUILD_DIR2) ${STAGING_TOOLS}/$(REAL_GNU_TARGET_NAME)
[475ad56]72 # Important! Required for limits.h to be fixed.
[9baf0a6]73 rm -rf $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
74 ln -sf ${STAGING_DIR}/include $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/sys-include
75 rm -rf ${STAGING_TOOLS}/$(REAL_GNU_TARGET_NAME)/lib
76 ln -sf ${STAGING_DIR}/lib $(STAGING_TOOLS)/$(REAL_GNU_TARGET_NAME)/lib
[475ad56]77 (cd $(GCC_BUILD_DIR2); rm -f config.cache; PATH=$(TARGET_PATH) \
78 $(GCC_DIR)/configure \
[892d28e]79 ${GCC_CONFOPTS} \
[475ad56]80 --enable-languages=$(TARGET_LANGUAGES) \
81 --enable-shared \
[9baf0a6]82 --with-sysroot=${STAGING_DIR} \
[2e24236]83 );
84 touch $@
[475ad56]85
86$(GCC_BUILD_DIR2)/.compiled: $(GCC_BUILD_DIR2)/.configured
87 PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) all
[2e24236]88 touch $@
[475ad56]89
[9baf0a6]90${STAGING_TOOLS}/gcc_installed: $(GCC_BUILD_DIR2)/.compiled
[475ad56]91 PATH=$(TARGET_PATH) $(MAKE) -C $(GCC_BUILD_DIR2) install
[9baf0a6]92 echo $(GCC_VERSION) > $(STAGING_TOOLS)/gcc_version
[475ad56]93 # Set up the symlinks to enable lying about target name.
94 set -e; \
[9baf0a6]95 (cd $(STAGING_TOOLS); \
[475ad56]96 ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
97 cd bin; \
98 for app in $(REAL_GNU_TARGET_NAME)-* ; do \
99 ln -sf $${app} \
100 $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \
101 done; \
[b9492d5]102 )
[475ad56]103# We do another ugly hack here because the standard behaviour is
104# to include a reference to libgcc.so.1 in all binaries. For flash space
[8e4e7a3]105# saving, we change the specs file to link in a static libgcc here.
[b27da3ee]106ifeq ($(CPU_ARCH),mipsel)
[9baf0a6]107 if [ -f $(STAGING_TOOLS)/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/specs ] ; then \
108 patch -d $(STAGING_TOOLS)/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(GCC_VERSION)/ -p0 < ./$(GCC_VERSION)/static-libgcc.patch.conditional ; \
[b9492d5]109 fi
[c17ae22]110endif
[b9492d5]111 touch $@
[475ad56]112
[99cbe83]113source: ${_CHECKSUM_COOKIE}
[9baf0a6]114prepare: $(STAGING_TOOLS)/bin/$(REAL_GNU_TARGET_NAME)-gcc
115compile: ${STAGING_TOOLS}/gcc_installed
[475ad56]116install:
117clean: gcc-clean
[b9492d5]118 rm -rf $(GCC_DIR) $(GCC_BUILD_DIR1) $(GCC_BUILD_DIR2)
[9baf0a6]119 rm -f $(STAGING_TOOLS)/bin/$(REAL_GNU_TARGET_NAME)-{,g}c* \
120 ${STAGING_TOOLS}/gcc_installed
Note: See TracBrowser for help on using the repository browser.