source: freewrt/toolchain/gcc/Makefile@ 31d285b

freewrt_1_0 freewrt_2_0
Last change on this file since 31d285b was 31d285b, checked in by Thorsten Glaser <tg@…>, 19 years ago
  • 920-integer-overflow.patch: apply to freewrt-1.0-stable branch as requested by wbx@ in Message-ID: <20070128011553.GA2222@…>
  • Makefile: apply same patch as in trunk: add svn revision to gcc version information, so that people can see if they have the updates

git-svn-id: svn://www.freewrt.org/branches/freewrt_1_0@1784 afb5a338-a214-0410-bd46-81f09a774fd1

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