finally move buildroot-ng to trunk
[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
13 PKG_SOURCE:=uClibc-$(PKG_VERSION).tar.bz2
14 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
15 PKG_MD5SUM:=1ada58d919a82561061e4741fb6abd29
16 PKG_CAT:=bzcat
17
18 PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/uClibc-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/host-build.mk
21
22 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
23 -e 's/i.86/i386/' \
24 -e 's/sparc.*/sparc/' \
25 -e 's/arm.*/arm/g' \
26 -e 's/m68k.*/m68k/' \
27 -e 's/ppc/powerpc/g' \
28 -e 's/v850.*/v850/g' \
29 -e 's/sh64/sh/' \
30 -e 's/sh[234].*/sh/' \
31 -e 's/mips.*/mips/' \
32 -e 's/mipsel.*/mips/' \
33 -e 's/cris.*/cris/' \
34 )
35
36 define Build/Prepare
37 $(call Build/Prepare/Default)
38 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
39 if [ -e config/$(ARCH).$(BOARD) ]; then \
40 $(CP) config/$(ARCH).$(BOARD) $(PKG_BUILD_DIR)/.config; \
41 else \
42 $(CP) config/$(ARCH) $(PKG_BUILD_DIR)/.config; \
43 fi
44 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
45 $(PKG_BUILD_DIR)/.config
46 ifeq ($(CONFIG_LARGEFILE),y)
47 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' $(PKG_BUILD_DIR)/.config
48 else
49 $(SED) 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=n,g' $(PKG_BUILD_DIR)/.config
50 endif
51 $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(PKG_BUILD_DIR)/.config
52 ifeq ($(CONFIG_SOFT_FLOAT),y)
53 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(PKG_BUILD_DIR)/.config
54 endif
55 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/include
56 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/lib
57 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/lib
58 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
59 PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
60 DEVEL_PREFIX=/usr/ \
61 RUNTIME_PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
62 HOSTCC="$(HOSTCC)" \
63 CPU_CFLAGS="$(TARGET_CFLAGS)" \
64 pregen install_dev;
65 endef
66
67 define Build/Configure
68 endef
69
70 define Build/Compile
71 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
72 PREFIX= \
73 DEVEL_PREFIX=/ \
74 RUNTIME_PREFIX=/ \
75 HOSTCC="$(HOSTCC)" \
76 CPU_CFLAGS="$(TARGET_CFLAGS)" \
77 all
78 endef
79
80 define Build/Install
81 $(MAKE) -C $(PKG_BUILD_DIR) \
82 PREFIX=$(STAGING_DIR)/ \
83 DEVEL_PREFIX=/ \
84 RUNTIME_PREFIX=/ \
85 install_runtime
86 $(MAKE) -C $(PKG_BUILD_DIR) \
87 PREFIX=$(STAGING_DIR)/ \
88 DEVEL_PREFIX=/ \
89 RUNTIME_PREFIX=/ \
90 install_dev
91 echo $(PKG_VERSION) > $(STAGING_DIR)/uclibc_version
92 endef
93
94 define Build/Clean
95 rm -rf $(PKG_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR)/uClibc_dev
96 endef
97
98 $(eval $(call HostBuild))
This page took 0.050146 seconds and 5 git commands to generate.