[PATCH] Update mac80211 and make b43 driver build and load on targets other than...
[openwrt.git] / toolchain / uClibc / Makefile
1 #
2 # Copyright (C) 2006-2008 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:=$(call qstrip,$(CONFIG_UCLIBC_VERSION))
12 PKG_EXTRAVERSION:=$(call qstrip,$(CONFIG_UCLIBC_EXTRA_VERSION))
13 PKG_VERSION_SNAPSHOT:=$(call qstrip,$(CONFIG_UCLIBC_VERSION_SNAPSHOT))
14 ifeq ($(PKG_VERSION_SNAPSHOT),y)
15 PKG_SOURCE_URL:=http://www.uclibc.org/downloads/snapshots
16 PKG_SOURCE:=uClibc-snapshot.tar.bz2
17 else
18 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
19 PKG_SOURCE:=uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION).tar.bz2
20 endif
21 PATCH_DIR:=./patches/$(PKG_VERSION)$(PKG_EXTRAVERSION)
22 CONFIG_DIR:=./config/$(PKG_VERSION)$(PKG_EXTRAVERSION)
23
24 ifeq ($(PKG_VERSION),0.9.28)
25 ifeq ($(PKG_EXTRAVERSION),.2)
26 PKG_MD5SUM:=959f25286e317f0d9e2103445c5a14c2
27 endif
28 ifeq ($(PKG_EXTRAVERSION),.3)
29 PKG_MD5SUM:=428405a36b4662980d9343b32089b5a6
30 endif
31 endif
32
33 ifeq ($(PKG_VERSION),0.9.29)
34 ifeq ($(PKG_EXTRAVERSION),)
35 # currently the default version, no special sub-directory needed
36 PATCH_DIR:=./patches
37 CONFIG_DIR:=./config
38 PKG_MD5SUM:=61dc55f43b17a38a074f347e74095b20
39 endif
40 endif
41
42 ifeq ($(PKG_VERSION_SNAPSHOT),y)
43 PATCH_DIR:=
44 CONFIG_DIR:=./config
45 PKG_MD5SUM:=
46 endif
47
48 PKG_CAT:=bzcat
49
50 STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
51 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
52 ifeq ($(PKG_VERSION_SNAPSHOT),y)
53 PKG_BUILD_DIR:=$(BUILD_DIR_HOST)/uClibc-$(PKG_EXTRAVERSION)
54 else
55 PKG_BUILD_DIR:=$(BUILD_DIR_HOST)/uClibc-$(PKG_VERSION)$(PKG_EXTRAVERSION)
56 endif
57 override CONFIG_AUTOREBUILD=
58
59 include $(INCLUDE_DIR)/host-build.mk
60
61 STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.uclibc_installed
62 STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc-utils_installed
63
64 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
65 -e 's/i.86/i386/' \
66 -e 's/sparc.*/sparc/' \
67 -e 's/arm.*/arm/g' \
68 -e 's/avr32.*/avr32/g' \
69 -e 's/m68k.*/m68k/' \
70 -e 's/ppc/powerpc/g' \
71 -e 's/v850.*/v850/g' \
72 -e 's/sh64/sh/' \
73 -e 's/sh[234].*/sh/' \
74 -e 's/mips.*/mips/' \
75 -e 's/mipsel.*/mips/' \
76 -e 's/cris.*/cris/' \
77 )
78
79 # Remove me when there are no 2.6.23 targets
80 ifeq ($(findstring 86,$(ARCH)),86)
81 ifneq ($(LINUX_2_6_23),y)
82 UCLIBC_TARGET_ARCH:=x86
83 endif
84 endif
85
86 define Build/Prepare/Snapshot
87 $(PKG_UNPACK)
88 rm -Rf $(PKG_BUILD_DIR)
89 ln -snf $(BUILD_DIR_TOOLCHAIN)/uClibc $(PKG_BUILD_DIR)
90 $(Build/Patch)
91 $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
92 endef
93
94 define Build/Prepare/V_0_9_28
95 $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_HEADERS_DIR)\",g' \
96 $(PKG_BUILD_DIR)/.config
97 ifeq ($(CONFIG_SOFT_FLOAT),y)
98 $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' $(PKG_BUILD_DIR)/.config
99 endif
100 ifeq ($(CONFIG_C99_MATH),y)
101 $(SED) 's,.*DO_C99_MATH.*,DO_C99_MATH=y,g' $(PKG_BUILD_DIR)/.config
102 endif
103 endef
104
105 define Build/Prepare
106 @echo prepare uClibc version $(PKG_VERSION)$(PKG_EXTRAVERSION)
107 ifeq ($(PKG_VERSION_SNAPSHOT),y)
108 $(call Build/Prepare/Snapshot)
109 else
110 $(call Build/Prepare/Default)
111 endif
112 $(CP) ./$(CONFIG_DIR)/$(ARCH)$(if $(wildcard $(CONFIG_DIR)/$(ARCH).$(BOARD)),.$(BOARD)) $(PKG_BUILD_DIR)/.config
113 ifeq ($(PKG_VERSION),0.9.28)
114 $(call Build/Prepare/V_0_9_28)
115 endif
116 $(SED) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(LINUX_HEADERS_DIR)/include\",g' \
117 -e 's,.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,y),g' \
118 -e 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=$(if $(CONFIG_LARGEFILE),y,n),g' \
119 -e 's,^.*CONFIG_ARM_EABI.*,CONFIG_ARM_EABI=$(if $(CONFIG_EABI_SUPPORT),y,n),g' \
120 -e 's,^.*CONFIG_ARM_OABI.*,CONFIG_ARM_OABI=$(if $(CONFIG_EABI_SUPPORT),n,y),g' \
121 -e 's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
122 $(PKG_BUILD_DIR)/.config
123 mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/usr/include
124 mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/usr/lib
125 mkdir -p $(BUILD_DIR_HOST)/uClibc_dev/lib
126 # if [ ! -f $(BUILD_DIR_HOST)/uClibc_dev/usr/include/linux/version.h ] ; then \
127 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
128 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(TOOLCHAIN_DIR)/include/ ; \
129 # cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/* $(PKG_BUILD_DIR)/include/ ; \
130 # fi;
131 if [ ! -f $(BUILD_DIR_HOST)/uClibc_dev/usr/include/linux/version.h ] ; then \
132 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
133 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-$(UCLIBC_TARGET_ARCH) $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
134 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-generic $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
135 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/linux $(BUILD_DIR_HOST)/uClibc_dev/usr/include/; \
136 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm $(TOOLCHAIN_DIR)/include/ ; \
137 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-$(UCLIBC_TARGET_ARCH) $(TOOLCHAIN_DIR)/include/ ; \
138 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-generic $(TOOLCHAIN_DIR)/include/ ; \
139 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/linux $(TOOLCHAIN_DIR)/include/ ; \
140 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm $(PKG_BUILD_DIR)/include/ ; \
141 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/include/ ; \
142 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/asm-generic $(PKG_BUILD_DIR)/include/ ; \
143 cp -pLR $(BUILD_DIR_TOOLCHAIN)/linux/include/linux $(PKG_BUILD_DIR)/include/ ; \
144 fi;
145 $(MAKE) -C $(PKG_BUILD_DIR)/extra/config conf KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS"
146 PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
147 PREFIX=$(BUILD_DIR_HOST)/uClibc_dev/ \
148 DEVEL_PREFIX=/usr/ \
149 RUNTIME_PREFIX=$(BUILD_DIR_HOST)/uClibc_dev/ \
150 HOSTCC="$(HOSTCC)" \
151 CPU_CFLAGS="$(TARGET_CFLAGS)" \
152 pregen install_dev;
153 endef
154
155 define Build/Configure
156 endef
157
158 UCLIBC_MAKE := PATH=$(TARGET_PATH) $(MAKE) -C $(PKG_BUILD_DIR) \
159 $(TARGET_CONFIGURE_OPTS) \
160 DEVEL_PREFIX=/ \
161 RUNTIME_PREFIX=/ \
162 HOSTCC="$(HOSTCC)" \
163 CPU_CFLAGS="$(TARGET_CFLAGS)"
164
165 define Build/Compile
166 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(PKG_BUILD_DIR)/Rules.mak
167 $(UCLIBC_MAKE) PREFIX= all
168 $(UCLIBC_MAKE) PREFIX=$(STAGING_DIR_HOST)/ install_runtime install_dev
169 $(SED) 's,UCLIBC_VERSION=.*,UCLIBC_VERSION=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
170 $(SED) 's,UCLIBC_PATCHVER=.*,UCLIBC_PATCHVER=$(PKG_EXTRAVERSION),' $(TOOLCHAIN_DIR)/info.mk
171 rm -rf $(TOOLCHAIN_DIR)/lib/libc.so
172 ln -s libc.so.0 $(TOOLCHAIN_DIR)/lib/libc.so
173 endef
174
175 define Build/Install
176 $(UCLIBC_MAKE) PREFIX= utils
177 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/target-utils
178 $(INSTALL_BIN) \
179 $(PKG_BUILD_DIR)/utils/ldd \
180 $(PKG_BUILD_DIR)/utils/ldconfig \
181 $(TOOLCHAIN_DIR)/target-utils/
182 endef
183
184 define Build/Clean
185 rm -rf $(PKG_BUILD_DIR) $(BUILD_DIR_HOST)/uClibc_dev
186 endef
187
188 $(eval $(call HostBuild))
This page took 0.045105 seconds and 5 git commands to generate.