fix gcc version selection
[openwrt.git] / toolchain / uClibc / Makefile
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/target.mk
9
10 PKG_NAME:=uClibc
11 PKG_VERSION:=0.9.28
12 PKG_EXTRAVERSION:=.2
13
14 PKG_SOURCE:=uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
16 PKG_MD5SUM:=959f25286e317f0d9e2103445c5a14c2
17 PKG_CAT:=bzcat
18
19 PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION)
20
21 include $(INCLUDE_DIR)/host-build.mk
22
23 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
24 -e 's/i.86/i386/' \
25 -e 's/sparc.*/sparc/' \
26 -e 's/arm.*/arm/g' \
27 -e 's/m68k.*/m68k/' \
28 -e 's/ppc/powerpc/g' \
29 -e 's/v850.*/v850/g' \
30 -e 's/sh64/sh/' \
31 -e 's/sh[234].*/sh/' \
32 -e 's/mips.*/mips/' \
33 -e 's/mipsel.*/mips/' \
34 -e 's/cris.*/cris/' \
35 )
36
37 define Build/Prepare
38 $(call Build/Prepare/Default)
39 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
40 if [ -e config/$(ARCH).$(BOARD) ]; then \
41 $(CP) config/$(ARCH).$(BOARD) $(PKG_BUILD_DIR)/.config; \
42 else \
43 $(CP) config/$(ARCH) $(PKG_BUILD_DIR)/.config; \
44 fi
45 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
46 $(PKG_BUILD_DIR)/.config
47 ifeq ($(CONFIG_LARGEFILE),y)
48 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(PKG_BUILD_DIR)/.config
49 else
50 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(PKG_BUILD_DIR)/.config
51 endif
52 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(PKG_BUILD_DIR)/.config
53 ifeq ($(CONFIG_SOFT_FLOAT),y)
54 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(PKG_BUILD_DIR)/.config
55 endif
56 ifeq ($(CONFIG_C99_MATH),y)
57 $(SED) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(PKG_BUILD_DIR)/.config
58 endif
59 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/include
60 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/lib
61 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/lib
62 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
63 PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
64 DEVEL_PREFIX=/usr/ \
65 RUNTIME_PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
66 HOSTCC="$(HOSTCC)" \
67 CPU_CFLAGS="$(TARGET_CFLAGS)" \
68 pregen install_dev;
69 endef
70
71 define Build/Configure
72 endef
73
74 define Build/Compile
75 PATH=$(TARGET_PATH) $(MAKE) -j $(CONFIG_JLEVEL) -C $(PKG_BUILD_DIR) \
76 PREFIX= \
77 DEVEL_PREFIX=/ \
78 RUNTIME_PREFIX=/ \
79 HOSTCC="$(HOSTCC)" \
80 CPU_CFLAGS="$(TARGET_CFLAGS)" \
81 all
82 endef
83
84 define Build/Install
85 $(MAKE) -C $(PKG_BUILD_DIR) \
86 PREFIX=$(STAGING_DIR)/ \
87 DEVEL_PREFIX=/ \
88 RUNTIME_PREFIX=/ \
89 install_runtime
90 $(MAKE) -C $(PKG_BUILD_DIR) \
91 PREFIX=$(STAGING_DIR)/ \
92 DEVEL_PREFIX=/ \
93 RUNTIME_PREFIX=/ \
94 install_dev
95 echo $(PKG_VERSION) > $(STAGING_DIR)/uclibc_version
96 endef
97
98 define Build/Clean
99 rm -rf $(PKG_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR)/uClibc_dev
100 endef
101
102 $(eval $(call HostBuild))
This page took 0.042091 seconds and 5 git commands to generate.