1 # Makefile for to build a gcc/uClibc toolchain
3 # Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
4 # Copyright (C) 2004 Manuel Novoa III <mjn3@uclibc.org>
5 # Copyright (C) 2005-2006 Felix Fietkau <nbd@openwrt.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 include $(TOPDIR
)/rules.mk
24 PKG_VERSION
:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))#"))
26 PATCH_DIR
=.
/patches
/$(PKG_VERSION
)
27 PKG_SOURCE_URL
:=ftp
://ftp.fu-berlin.de
/unix
/languages
/gcc
/releases
/gcc-
$(PKG_VERSION
) \
28 http
://mirrors.rcn.net
/pub
/sourceware
/gcc
/releases
/gcc-
$(PKG_VERSION
) \
29 ftp
://ftp.gnu.org
/gnu
/gcc
/releases
/gcc-
$(PKG_VERSION
)
31 PKG_SOURCE
:=gcc-
$(PKG_VERSION
).
tar.bz2
35 PKG_BUILD_DIR
:=$(TOOLCHAIN_BUILD_DIR
)/gcc-
$(PKG_VERSION
)
38 ifeq ($(CONFIG_INSTALL_LIBSTDCPP
),y
)
39 TARGET_LANGUAGES
:=$(TARGET_LANGUAGES
),c
++
41 ifeq ($(CONFIG_INSTALL_LIBGCJ
),y
)
42 TARGET_LANGUAGES
:=$(TARGET_LANGUAGES
),java
45 include $(INCLUDE_DIR
)/host-build.mk
47 BUILD_DIR1
:=$(TOOLCHAIN_BUILD_DIR
)/gcc-
$(PKG_VERSION
)-initial
48 BUILD_DIR2
:=$(TOOLCHAIN_BUILD_DIR
)/gcc-
$(PKG_VERSION
)-final
50 define Stage1
/Configure
51 mkdir
-p
$(BUILD_DIR1
)
52 (cd
$(BUILD_DIR1
); rm -f config.cache
; \
54 $(PKG_BUILD_DIR
)/configure \
55 --prefix=$(STAGING_DIR
) \
56 --build
=$(GNU_HOST_NAME
) \
57 --host
=$(GNU_HOST_NAME
) \
58 --target
=$(REAL_GNU_TARGET_NAME
) \
59 --enable-languages
=c \
61 --with-sysroot
=$(TOOLCHAIN_BUILD_DIR
)/uClibc_dev
/ \
62 --disable-__cxa_atexit \
63 --enable-target-optspace \
66 --disable-libmudflap \
70 export SHELL
="$(BASH)"; $(MAKE
) -C
$(BUILD_DIR1
) all-gcc
73 export SHELL
="$(BASH)"; $(MAKE
) -C
$(BUILD_DIR1
) install-gcc
76 define Stage2
/Configure
77 mkdir
-p
$(BUILD_DIR2
)
78 # Important! Required for limits.h to be fixed.
79 rm -rf
$(STAGING_DIR
)/$(REAL_GNU_TARGET_NAME
)/sys-include
80 ln
-sf ..
/include $(STAGING_DIR
)/$(REAL_GNU_TARGET_NAME
)/sys-include
81 rm -rf
$(STAGING_DIR
)/$(REAL_GNU_TARGET_NAME
)/lib
82 ln
-sf ..
/lib
$(STAGING_DIR
)/$(REAL_GNU_TARGET_NAME
)/lib
83 (cd
$(BUILD_DIR2
); rm -f config.cache
; \
85 $(PKG_BUILD_DIR
)/configure \
86 --prefix=$(STAGING_DIR
) \
87 --build
=$(GNU_HOST_NAME
) \
88 --host
=$(GNU_HOST_NAME
) \
89 --target
=$(REAL_GNU_TARGET_NAME
) \
90 --enable-languages
=$(TARGET_LANGUAGES
) \
92 --disable-__cxa_atexit \
93 --enable-target-optspace \
96 --disable-libmudflap \
100 export SHELL
="$(BASH)"; $(MAKE
) -C
$(BUILD_DIR2
) all
102 define Stage2
/Install
103 export SHELL
="$(BASH)"; $(MAKE
) -C
$(BUILD_DIR2
) install
104 echo
$(PKG_VERSION
) > $(STAGING_DIR
)/gcc_version
105 # Set up the symlinks to enable lying about target name.
107 (cd
$(STAGING_DIR
); \
108 ln
-sf
$(REAL_GNU_TARGET_NAME
) $(GNU_TARGET_NAME
); \
110 for app in
$(REAL_GNU_TARGET_NAME
)-* ; do \
112 $(GNU_TARGET_NAME
)$$$${app
##$(REAL_GNU_TARGET_NAME)}; \
118 $(call Build
/Prepare
/Default
)
119 $(SED
) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(PKG_BUILD_DIR
)/gcc
/version.c
120 $(SED
) 's,\(bug_report_url.. = "\).*\(";\),\1<URL:https://dev.openwrt.org/>\2,' $(PKG_BUILD_DIR
)/gcc
/version.c
121 (cd
$(PKG_BUILD_DIR
)/libstdc
++-v3
; autoconf
;);
122 $(SED
) 's,gcc_no_link=yes,gcc_no_link=no,' $(PKG_BUILD_DIR
)/libstdc
++-v3
/configure
125 define Build
/Configure
126 $(call Stage1
/Configure
)
130 $(call Stage1
/Compile
)
131 $(call Stage1
/Install
)
135 $(call Stage2
/Configure
)
136 $(call Stage2
/Compile
)
137 $(call Stage2
/Install
)
141 rm -rf
$(PKG_BUILD_DIR
)
144 rm -f
$(STAGING_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)-gc
*
145 rm -f
$(STAGING_DIR
)/bin
/$(REAL_GNU_TARGET_NAME
)-c
*
148 $(eval
$(call HostBuild
))
This page took 0.053959 seconds and 5 git commands to generate.