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