add support for the AVR32 platform, namely the ATNGW100 board - joint work with wigyori
[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/avr32.*/avr32/g' \
28 -e 's/m68k.*/m68k/' \
29 -e 's/ppc/powerpc/g' \
30 -e 's/v850.*/v850/g' \
31 -e 's/sh64/sh/' \
32 -e 's/sh[234].*/sh/' \
33 -e 's/mips.*/mips/' \
34 -e 's/mipsel.*/mips/' \
35 -e 's/cris.*/cris/' \
36 )
37
38 define Build/Prepare
39 $(call Build/Prepare/Default)
40 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
41 if [ -e config/$(ARCH).$(BOARD) ]; then \
42 $(CP) config/$(ARCH).$(BOARD) $(PKG_BUILD_DIR)/.config; \
43 else \
44 $(CP) config/$(ARCH) $(PKG_BUILD_DIR)/.config; \
45 fi
46 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
47 $(PKG_BUILD_DIR)/.config
48 ifeq ($(CONFIG_LARGEFILE),y)
49 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(PKG_BUILD_DIR)/.config
50 else
51 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(PKG_BUILD_DIR)/.config
52 endif
53 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(PKG_BUILD_DIR)/.config
54 ifeq ($(CONFIG_SOFT_FLOAT),y)
55 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(PKG_BUILD_DIR)/.config
56 endif
57 ifeq ($(CONFIG_C99_MATH),y)
58 $(SED) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(PKG_BUILD_DIR)/.config
59 endif
60 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/include
61 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/lib
62 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/lib
63 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
64 PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
65 DEVEL_PREFIX=/usr/ \
66 RUNTIME_PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
67 HOSTCC="$(HOSTCC)" \
68 CPU_CFLAGS="$(TARGET_CFLAGS)" \
69 pregen install_dev;
70 endef
71
72 define Build/Configure
73 endef
74
75 define Build/Compile
76 PATH=$(TARGET_PATH) $(MAKE) -j $(CONFIG_JLEVEL) -C $(PKG_BUILD_DIR) \
77 PREFIX= \
78 DEVEL_PREFIX=/ \
79 RUNTIME_PREFIX=/ \
80 HOSTCC="$(HOSTCC)" \
81 CPU_CFLAGS="$(TARGET_CFLAGS)" \
82 all
83 endef
84
85 define Build/Install
86 $(MAKE) -C $(PKG_BUILD_DIR) \
87 PREFIX=$(STAGING_DIR)/ \
88 DEVEL_PREFIX=/ \
89 RUNTIME_PREFIX=/ \
90 install_runtime
91 $(MAKE) -C $(PKG_BUILD_DIR) \
92 PREFIX=$(STAGING_DIR)/ \
93 DEVEL_PREFIX=/ \
94 RUNTIME_PREFIX=/ \
95 install_dev
96 echo $(PKG_VERSION) > $(STAGING_DIR)/uclibc_version
97 echo $(PKG_VERSION)$(PKG_EXTRAVERSION) > $(STAGING_DIR)/uclibc_extra_version
98 endef
99
100 define Build/Clean
101 rm -rf $(PKG_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR)/uClibc_dev
102 endef
103
104 $(eval $(call HostBuild))
This page took 0.051443 seconds and 5 git commands to generate.