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