source: freewrt/toolchain/gcc/Makefile@ 1ff2d01

freewrt_2_0
Last change on this file since 1ff2d01 was 1ff2d01, checked in by Waldemar Brodkorb <wbx@…>, 4 months ago

gcc: remove revision in version string

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