summaryrefslogtreecommitdiff
path: root/mk/uclibc.mk
blob: f502457630a8a5870d635e2bf90f85adba76e0da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
################################################################################
# GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>
# Copyright(C) 2009 GAYE Abdoulaye Walsimou. All rights reserved.
#
# This program is free software; you can distribute it and/or modify it
# under the terms of the GNU General Public License
# (Version 2 or later) published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
################################################################################
#
# \file         uclibc.mk
# \brief	uclibc.mk of Embtoolkit
# \author       GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>
# \date         August 2009
################################################################################

UCLIBC_VERSION := $(subst ",,$(strip $(CONFIG_EMBTK_UCLIBC_VERSION_STRING)))
UCLIBC_SITE := http://www.uclibc.org/downloads
UCLIBC_PACKAGE := uClibc-$(UCLIBC_VERSION).tar.bz2
UCLIBC_BUILD_DIR := $(TOOLS_BUILD)/uClibc-$(UCLIBC_VERSION)

uclibc_install: $(UCLIBC_BUILD_DIR)/.installed

$(UCLIBC_BUILD_DIR)/.installed: uclibc_download \
$(UCLIBC_BUILD_DIR)/.decompressed $(UCLIBC_BUILD_DIR)/.configured
	$(call EMBTK_GENERIC_MESSAGE,"Building and installing \
	uClibc-$(UCLIBC_VERSION) ...")
	$(MAKE) -C $(UCLIBC_BUILD_DIR) oldconfig
	$(MAKE) -C $(UCLIBC_BUILD_DIR) \
	CROSS_COMPILER_PREFIX="$(TOOLS)/bin/$(STRICT_GNU_TARGET)-" \
	SHARED_LIB_LOADER_PREFIX="/lib/" \
	RUNTIME_PREFIX="/" DEVEL_PREFIX="/usr/" \
	KERNEL_HEADERS="$(SYSROOT)/usr/include/" \
	UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) -pipe"
	$(MAKE) -C $(UCLIBC_BUILD_DIR) PREFIX=$(SYSROOT)/ \
	CROSS_COMPILER_PREFIX="$(TOOLS)/bin/$(STRICT_GNU_TARGET)-" \
	SHARED_LIB_LOADER_PREFIX="/lib/" \
	RUNTIME_PREFIX="/" DEVEL_PREFIX="/usr/" \
	KERNEL_HEADERS="$(SYSROOT)/usr/include/" \
	UCLIBC_EXTRA_CFLAGS="$(TARGET_CFLAGS) -pipe" install

uclibc_download:
	$(call EMBTK_GENERIC_MESSAGE,"downloading uClibc-$(UCLIBC_VERSION) \
	if necessary ...")
	@test -e $(DOWNLOAD_DIR)/$(UCLIBC_PACKAGE) || \
	wget $(UCLIBC_SITE)/$(UCLIBC_PACKAGE) \
	-O $(DOWNLOAD_DIR)/$(UCLIBC_PACKAGE)

$(UCLIBC_BUILD_DIR)/.decompressed:
	$(call EMBTK_GENERIC_MESSAGE,"Decompressing \
	uClibc-$(UCLIBC_VERSION) ...")
	$(Q)tar -C $(TOOLS_BUILD) -xjvf $(DOWNLOAD_DIR)/$(UCLIBC_PACKAGE)
	$(Q)cd $(UCLIBC_BUILD_DIR); \
	cat $(DOWNLOAD_DIR)/uClibc-$(UCLIBC_VERSION)-*.patch | \
	patch -p1

$(UCLIBC_BUILD_DIR)/.configured:
	$(call EMBTK_GENERIC_MESSAGE,"Configuring \
	uClibc-$(UCLIBC_VERSION) ...")
	grep "CONFIG_KEMBTK_UCLIBC_" $(EMBTK_ROOT)/.config | \
	sed -e 's/CONFIG_KEMBTK_UCLIBC_*//g' \
	> $(UCLIBC_BUILD_DIR)/.config