Resync ar7 kernel config (#2966)
[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.29
12 PKG_EXTRAVERSION:=
13
14 PKG_SOURCE:=uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION).tar.bz2
15 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
16 PKG_MD5SUM:=61dc55f43b17a38a074f347e74095b20
17 PKG_CAT:=bzcat
18
19 STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
20 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
21 PKG_BUILD_DIR:=$(BUILD_DIR_HOST)/uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION)
22
23 include $(INCLUDE_DIR)/host-build.mk
24
25 STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.uclibc_installed
26 STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc-utils_installed
27
28 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
29 -e 's/i.86/i386/' \
30 -e 's/sparc.*/sparc/' \
31 -e 's/arm.*/arm/g' \
32 -e 's/avr32.*/avr32/g' \
33 -e 's/m68k.*/m68k/' \
34 -e 's/ppc/powerpc/g' \
35 -e 's/v850.*/v850/g' \
36 -e 's/sh64/sh/' \
37 -e 's/sh[234].*/sh/' \
38 -e 's/mips.*/mips/' \
39 -e 's/mipsel.*/mips/' \
40 -e 's/cris.*/cris/' \
41 )
42
43 define Build/Prepare
44 $(call Build/Prepare/Default)
45 $(CP) config/$(ARCH)$(if $(wildcard config/$(ARCH).$(BOARD)),$(BOARD)) $(PKG_BUILD_DIR)/.config
46 $(SED) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(LINUX_HEADERS_DIR)/include\",g' \
47 -e 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,y),g' \
48 -e 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
49 $(PKG_BUILD_DIR)/.config
50 mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/usr/include
51 mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/usr/lib
52 mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/lib
53 # if [ ! -f $(BUILD_DIR_HOST)/uClibc_dev/usr/include/linux/version.h ] ; then \
54 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
55 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(TOOLCHAIN_DIR)/include/ ; \
56 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(PKG_BUILD_DIR)/include/ ; \
57 # fi;
58 if [ ! -f $(BUILD_DIR_HOST)/uClibc_dev/usr/include/linux/version.h ] ; then \
59 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
60 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-$(UCLIBC_TARGET_ARCH) $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
61 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-generic $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
62 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/linux $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
63 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm $(TOOLCHAIN_DIR)/include/ ; \
64 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-$(UCLIBC_TARGET_ARCH) $(TOOLCHAIN_DIR)/include/ ; \
65 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-generic $(TOOLCHAIN_DIR)/include/ ; \
66 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/linux $(TOOLCHAIN_DIR)/include/ ; \
67 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm $(PKG_BUILD_DIR)/include/ ; \
68 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/include/ ; \
69 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-generic $(PKG_BUILD_DIR)/include/ ; \
70 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/linux $(PKG_BUILD_DIR)/include/ ; \
71 fi;
72 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
73 PREFIX=$(BUILD_DIR_HOST)/uClibc_dev/ \
74 DEVEL_PREFIX=/usr/ \
75 RUNTIME_PREFIX=$(BUILD_DIR_HOST)/uClibc_dev/ \
76 HOSTCC="$(HOSTCC)" \
77 CPU_CFLAGS="$(TARGET_CFLAGS)" \
78 pregen install_dev;
79 endef
80
81 define Build/Configure
82 endef
83
84 UCLIBC_MAKE := PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
85 $(TARGET_CONFIGURE_OPTS) \
86 DEVEL_PREFIX=/ \
87 RUNTIME_PREFIX=/ \
88 HOSTCC="$(HOSTCC)" \
89 CPU_CFLAGS="$(TARGET_CFLAGS)"
90
91 define Build/Compile
92 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
93 $(UCLIBC_MAKE) PREFIX= all
94 $(UCLIBC_MAKE) PREFIX=$(STAGING_DIR_HOST)/ install_runtime install_dev
95 $(SED) 's,UCLIBC_VERSION=.*,UCLIBC_VERSION=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
96 $(SED) 's,UCLIBC_PATCHVER=.*,UCLIBC_PATCHVER=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR)/info.mk
97 rm -rf $(TOOLCHAIN_DIR)/lib/libc.so
98 ln -s $(TOOLCHAIN_DIR)/lib/libc.so.0 $(TOOLCHAIN_DIR)/lib/libc.so
99 endef
100
101 define Build/Install
102 $(UCLIBC_MAKE) PREFIX= utils
103 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/target-utils
104 $(INSTALL_BIN) \
105 $(PKG_BUILD_DIR)/utils/ldd \
106 $(PKG_BUILD_DIR)/utils/ldconfig \
107 $(TOOLCHAIN_DIR)/target-utils/
108 endef
109
110 define Build/Clean
111 rm -rf $(PKG_BUILD_DIR) $(BUILD_DIR_HOST)/uClibc_dev
112 endef
113
114 $(eval $(call HostBuild))
This page took 0.04043 seconds and 5 git commands to generate.