ar71xx: disable CONFIG_{I2C,SPI}_GPIO
[openwrt.git] / toolchain / uClibc / Makefile
1 #
2 # Copyright (C) 2006-2012 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 ifeq ($(PKG_VERSION),0.9.32)
13 PKG_SOURCE_URL:=git://git.busybox.net/uClibc
14 PKG_SOURCE_PROTO:=git
15 PKG_SOURCE_VERSION:=9152c4d67c763fde5712e2d181d92c0d7e1e2ab9
16 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
18 PKG_MIRROR_MD5SUM:=723dfa4f1f766cbd675d2c9a8238abb0
19 LIBC_SO_VERSION:=$(PKG_VERSION).1-git
20 else
21 PKG_SOURCE_URL:=http://www.uclibc.org/downloads
22 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
23 LIBC_SO_VERSION:=$(PKG_VERSION)
24 endif
25 PATCH_DIR:=./patches-$(PKG_VERSION)
26 CONFIG_DIR:=./config-$(PKG_VERSION)
27
28 PKG_MD5SUM_0.9.33 = cf9d25e4b3c87af1a99d33a6b959fbf1
29 PKG_MD5SUM=$(PKG_MD5SUM_$(PKG_VERSION))
30
31 HOST_BUILD_DIR:=$(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)-$(PKG_VERSION)
32
33 include $(INCLUDE_DIR)/toolchain-build.mk
34
35 HOST_STAMP_BUILT:=$(TOOLCHAIN_DIR)/stamp/.uclibc_installed
36 HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc-utils_installed
37
38 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
39 -e 's/i.86/i386/' \
40 -e 's/sparc.*/sparc/' \
41 -e 's/arm.*/arm/g' \
42 -e 's/avr32.*/avr32/g' \
43 -e 's/m68k.*/m68k/' \
44 -e 's/ppc/powerpc/g' \
45 -e 's/v850.*/v850/g' \
46 -e 's/sh64/sh/' \
47 -e 's/sh[234].*/sh/' \
48 -e 's/mips.*/mips/' \
49 -e 's/mipsel.*/mips/' \
50 -e 's/cris.*/cris/' \
51 )
52
53
54 define Host/SetToolchainInfo
55 $(SED) 's,^\(LIBC_TYPE\)=.*,\1=$(PKG_NAME),' $(TOOLCHAIN_DIR)/info.mk
56 $(SED) 's,^\(LIBC_URL\)=.*,\1=http://www.uclibc.org/,' $(TOOLCHAIN_DIR)/info.mk
57 $(SED) 's,^\(LIBC_VERSION\)=.*,\1=$(PKG_VERSION),' $(TOOLCHAIN_DIR)/info.mk
58 $(SED) 's,^\(LIBC_SO_VERSION\)=.*,\1=$(LIBC_SO_VERSION),' $(TOOLCHAIN_DIR)/info.mk
59 endef
60
61 GEN_CONFIG=$(SCRIPT_DIR)/kconfig.pl -n \
62 $(if $(wildcard $(CONFIG_DIR)/common),'+' $(CONFIG_DIR)/common) \
63 $(if $(CONFIG_UCLIBC_ENABLE_DEBUG),$(if $(wildcard $(CONFIG_DIR)/debug),'+' $(CONFIG_DIR)/debug)) \
64 $(CONFIG_DIR)/$(ARCH)$(strip \
65 $(if $(wildcard $(CONFIG_DIR)/$(ARCH).$(BOARD)),.$(BOARD), \
66 $(if $(CONFIG_HAS_SPE_FPU),$(if $(wildcard $(CONFIG_DIR)/$(ARCH).e500),.e500))))
67
68 define Host/Prepare
69 $(call Host/Prepare/Default)
70 $(if $(strip $(QUILT)), \
71 cd $(HOST_BUILD_DIR); \
72 if $(QUILT_CMD) next >/dev/null 2>&1; then \
73 $(QUILT_CMD) push -a; \
74 fi
75 )
76 ln -snf $(PKG_NAME)-$(PKG_VERSION) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
77 $(GEN_CONFIG) > $(HOST_BUILD_DIR)/.config
78 $(SED) 's,^KERNEL_HEADERS=.*,KERNEL_HEADERS=\"$(BUILD_DIR_TOOLCHAIN)/linux-dev/include\",g' \
79 -e 's,^.*UCLIBC_HAS_FPU.*,UCLIBC_HAS_FPU=$(if $(CONFIG_SOFT_FLOAT),n,y),g' \
80 -e 's,^.*UCLIBC_HAS_SOFT_FLOAT.*,UCLIBC_HAS_SOFT_FLOAT=$(if $(CONFIG_SOFT_FLOAT),y,n),g' \
81 -e 's,^.*UCLIBC_HAS_SHADOW.*,UCLIBC_HAS_SHADOW=$(if $(CONFIG_SHADOW_PASSWORDS),y,n),g' \
82 -e 's,^.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=$(if $(CONFIG_BUILD_NLS),y,n),g' \
83 $(HOST_BUILD_DIR)/.config
84 $(MAKE) -C $(HOST_BUILD_DIR) oldconfig KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS"
85 $(MAKE) -C $(HOST_BUILD_DIR)/extra/config conf KBUILD_HAVE_NLS= HOSTCFLAGS="-DKBUILD_NO_NLS"
86 PATH='$(TARGET_PATH)' $(MAKE) -C $(HOST_BUILD_DIR) \
87 PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
88 DEVEL_PREFIX=/ \
89 RUNTIME_PREFIX="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/" \
90 HOSTCC="$(HOSTCC)" \
91 CC="$(TARGET_CC)" \
92 CPU_CFLAGS="$(TARGET_CFLAGS)" \
93 ARCH="$(CONFIG_ARCH)" \
94 pregen \
95 install_headers
96 endef
97
98 define Host/Configure
99 endef
100
101 CPU_CFLAGS = \
102 -funsigned-char -fno-builtin -fno-asm \
103 --std=gnu99 -ffunction-sections -fdata-sections \
104 $(TARGET_CFLAGS)
105
106 UCLIBC_MAKE = PATH='$(TARGET_PATH)' $(MAKE) -C $(HOST_BUILD_DIR) \
107 $(TARGET_CONFIGURE_OPTS) \
108 DEVEL_PREFIX=/ \
109 RUNTIME_PREFIX=/ \
110 HOSTCC="$(HOSTCC)" \
111 CPU_CFLAGS="$(CPU_CFLAGS)" \
112 ARCH="$(CONFIG_ARCH)" \
113 LIBGCC="$(subst libgcc.a,libgcc_initial.a,$(shell $(TARGET_CC) -print-libgcc-file-name))" \
114 DOSTRIP=""
115
116 define Host/Compile
117 $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(HOST_BUILD_DIR)/Rules.mak
118 $(UCLIBC_MAKE) $(TOOLCHAIN_JOBS) PREFIX= all
119 $(UCLIBC_MAKE) PREFIX="$(TOOLCHAIN_DIR)/" install_runtime install_dev
120 $(CP) $(HOST_BUILD_DIR)/libc/libc_so.a $(TOOLCHAIN_DIR)/lib/
121 $(CP) $(HOST_BUILD_DIR)/libpthread/*/libpthread_so.a $(TOOLCHAIN_DIR)/lib/
122 ( cd $(TOOLCHAIN_DIR) ; \
123 for d in lib usr/lib ; do \
124 for f in libc.so libpthread.so libgcc_s.so ; do \
125 if [ -f $$$$d/$$$$f -a ! -L $$$$d/$$$$f ] ; then \
126 $(SED) 's,/usr/lib/,,g;s,/lib/,,g' $$$$d/$$$$f ; \
127 fi \
128 done \
129 done \
130 )
131 rm -f \
132 $(TOOLCHAIN_DIR)/lib/libresolv*.so* \
133 $(TOOLCHAIN_DIR)/lib/libnsl*.so*
134 endef
135
136 define Host/Install
137 $(call Host/SetToolchainInfo)
138 $(UCLIBC_MAKE) PREFIX= utils
139 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/bin
140 $(INSTALL_BIN) \
141 $(HOST_BUILD_DIR)/utils/ldd \
142 $(TOOLCHAIN_DIR)/bin/
143 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/sbin
144 $(INSTALL_BIN) \
145 $(HOST_BUILD_DIR)/utils/ldconfig \
146 $(TOOLCHAIN_DIR)/sbin/
147 endef
148
149 define Host/Clean
150 rm -rf \
151 $(HOST_BUILD_DIR) \
152 $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME) \
153 $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev
154 endef
155
156 $(eval $(call HostBuild))
This page took 0.048982 seconds and 5 git commands to generate.