fix pesky kmod-* ipkg install bug
[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 ifeq ($(CONFIG_C99_MATH),y)
56 $(SED) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(PKG_BUILD_DIR)/.config
57 endif
58 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/include
59 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/usr/lib
60 mkdir -p $(TOOLCHAIN_BUILD_DIR)/uClibc_dev/lib
61 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
62 PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
63 DEVEL_PREFIX=/usr/ \
64 RUNTIME_PREFIX=$(TOOLCHAIN_BUILD_DIR)/uClibc_dev/ \
65 HOSTCC="$(HOSTCC)" \
66 CPU_CFLAGS="$(TARGET_CFLAGS)" \
67 pregen install_dev;
68 endef
69
70 define Build/Configure
71 endef
72
73 define Build/Compile
74 PATH=$(TARGET_PATH) $(MAKE) -j $(CONFIG_JLEVEL) -C $(PKG_BUILD_DIR) \
75 PREFIX= \
76 DEVEL_PREFIX=/ \
77 RUNTIME_PREFIX=/ \
78 HOSTCC="$(HOSTCC)" \
79 CPU_CFLAGS="$(TARGET_CFLAGS)" \
80 all
81 endef
82
83 define Build/Install
84 $(MAKE) -C $(PKG_BUILD_DIR) \
85 PREFIX=$(STAGING_DIR)/ \
86 DEVEL_PREFIX=/ \
87 RUNTIME_PREFIX=/ \
88 install_runtime
89 $(MAKE) -C $(PKG_BUILD_DIR) \
90 PREFIX=$(STAGING_DIR)/ \
91 DEVEL_PREFIX=/ \
92 RUNTIME_PREFIX=/ \
93 install_dev
94 echo $(PKG_VERSION) > $(STAGING_DIR)/uclibc_version
95 endef
96
97 define Build/Clean
98 rm -rf $(PKG_BUILD_DIR) $(TOOLCHAIN_BUILD_DIR)/uClibc_dev
99 endef
100
101 $(eval $(call HostBuild))
This page took 0.046994 seconds and 5 git commands to generate.