changed the kvm version to kvm-63
[kvm-coreboot.git] / packages / uclibc / uclibc.mk
blob6e0fa2c859c5f8f8a453edbab9f23b7b3b8b134a
1 # Defaults, if not set in the platform config
2 ifeq ($(CONFIG_TARGET_64BIT),y)
3 UCLIBC_VER ?= 0.9.29
4 UCLIBC_ARCH ?= x86_64
5 UCLIBC_CONFIG ?= defconfig-x86_64
6 else
7 UCLIBC_VER ?= 0.9.29
8 UCLIBC_ARCH ?= i386
9 UCLIBC_CONFIG ?= defconfig
10 endif
12 ifeq ($(findstring defconfig,$(UCLIBC_CONFIG)),defconfig)
13 ifeq ($(shell if [ -f $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD) ]; then echo 1; fi),1)
14 UCLIBC_CONFIG = customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD)
15 endif
16 endif
18 UCLIBC_URL=http://www.uclibc.org/downloads
19 UCLIBC_SOURCE=uClibc-$(UCLIBC_VER).tar.bz2
20 UCLIBC_DIR=$(BUILD_DIR)/uclibc
21 UCLIBC_SRC_DIR=$(UCLIBC_DIR)/uClibc-$(UCLIBC_VER)
22 UCLIBC_STAMP_DIR=$(UCLIBC_DIR)/stamps
23 UCLIBC_LOG_DIR=$(UCLIBC_DIR)/logs
25 ifeq ($(CONFIG_VERBOSE),y)
26 UCLIBC_BUILD_LOG=/dev/stdout
27 UCLIBC_INSTALL_LOG=/dev/stdout
28 else
29 UCLIBC_BUILD_LOG=$(UCLIBC_LOG_DIR)/build.log
30 UCLIBC_INSTALL_LOG=$(UCLIBC_LOG_DIR)/install.log
31 endif
33 $(SOURCE_DIR)/$(UCLIBC_SOURCE):
34 @ echo "Downloading uclibc..."
35 @ mkdir -p $(SOURCE_DIR)
36 @ wget $(WGET_Q) -P $(SOURCE_DIR) $(UCLIBC_URL)/$(UCLIBC_SOURCE)
38 $(UCLIBC_STAMP_DIR)/.unpacked: $(SOURCE_DIR)/$(UCLIBC_SOURCE) | $(UCLIBC_STAMP_DIR) $(UCLIBC_DIR)
39 @ echo "Unpacking uclibc..."
40 @ tar -C $(UCLIBC_DIR) -jxf $(SOURCE_DIR)/$(UCLIBC_SOURCE)
41 @ touch $@
43 $(UCLIBC_SRC_DIR)/.config: $(UCLIBC_STAMP_DIR)/.unpacked
44 @ cat $(PACKAGE_DIR)/uclibc/conf/$(UCLIBC_CONFIG) | sed -e s:^KERNEL_HEADERS=.*:KERNEL_HEADERS=\"$(KERNEL_SRC_DIR)/include\": > $(UCLIBC_SRC_DIR)/.config
46 $(UCLIBC_SRC_DIR)/lib/libc.a: $(UCLIBC_SRC_DIR)/.config
47 @ echo "Building uclibc..."
48 ifneq ($(findstring defconfig,$(UCLIBC_CONFIG)),defconfig)
49 @ echo "Using custom config $(PACKAGE_DIR)/uclibc/conf/$(UCLIBC_CONFIG)"
50 endif
51 @ ( unset CFLAGS; unset LDFLAGS; \
52 $(MAKE) $(PARALLEL_MAKE) -C $(UCLIBC_SRC_DIR) TARGET_ARCH="$(UCLIBC_ARCH)" \
53 CC="$(CC) $(CROSS_CFLAGS)" LD="$(LD) $(CROSS_LDFLAGS)" \
54 HOSTCC="$(HOST_CC)" KERNEL_SOURCE="$(KERNEL_SRC_DIR)" \
55 RUNTIME_PREFIX="/" \
56 SHARED_LIB_LOADER_PATH="/lib" \
57 SHARED_LIB_LOADER_PREFIX="/lib" \
58 all > $(UCLIBC_BUILD_LOG) 2>&1)
59 @ mkdir -p $(OUTPUT_DIR)/config/uclibc
60 @ cp $(UCLIBC_SRC_DIR)/.config $(OUTPUT_DIR)/config/uclibc/
62 $(STAGING_DIR)/lib/libc.a: $(UCLIBC_SRC_DIR)/lib/libc.a
63 @ $(MAKE) -C $(UCLIBC_SRC_DIR) \
64 PREFIX= \
65 DEVEL_PREFIX=$(STAGING_DIR)/ \
66 RUNTIME_PREFIX=$(STAGING_DIR)/ \
67 install_runtime install_dev > $(UCLIBC_INSTALL_LOG) 2>&1
69 $(UCLIBC_SRC_DIR)/utils/ldd: $(UCLIBC_SRC_DIR)/lib/libc.a
70 @ $(MAKE) -C $(UCLIBC_SRC_DIR)/utils ldd
72 $(STAGING_DIR)/bin/ldd: $(UCLIBC_SRC_DIR)/utils/ldd
73 @ install -m 755 -d $(STAGING_DIR)/bin
74 @ install -m 755 $< $@
76 $(UCLIBC_STAMP_DIR) $(UCLIBC_LOG_DIR) $(UCLIBC_DIR):
77 @ mkdir -p $@
79 uclibc: $(UCLIBC_STAMP_DIR) $(UCLIBC_LOG_DIR) $(STAGING_DIR)/lib/libc.a
81 uclibc-clean:
82 @ echo "Cleaning uclibc..."
83 ifneq ($(wildcard $(UCLIBC_SRC_DIR)/Makefile),)
84 @ $(MAKE) -C $(UCLIBC_SRC_DIR) clean > /dev/null 2>&1
85 endif
87 uclibc-distclean:
88 @ rm -rf $(UCLIBC_DIR)/*
90 uclibc-bom:
91 @ echo "Package: uclibc"
92 @ echo "Source: $(UCLIBC_URL)/$(UCLIBC_SOURCE)"
93 @ echo ""
95 uclibc-extract: $(UCLIBC_STAMP_DIR)/.unpacked
97 uclibc-config: | $(UCLIBC_SRC_DIR)/.config
98 ifeq ($(shell if [ -f $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD) ]; then echo 1; fi),1)
99 @ cp -f $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD) $(UCLIBC_SRC_DIR)/.config
100 endif
101 ifeq (uclibc,$(filter uclibc,$(PAYLOAD-y)))
102 @ echo "Configure uclibc..."
103 @ $(MAKE) -C $(UCLIBC_SRC_DIR) TARGET_ARCH="$(UCLIBC_ARCH)" menuconfig
104 @ echo
105 ifeq ($(shell if [ -f $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD) ]; then echo 1; fi),1)
106 @ echo "Found an existing custom configuration file:"
107 @ echo " $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD)"
108 @ echo "I've copied it back to the source directory for modification."
109 @ echo "Remove the above file and re-run this command if you want to create a new custom configuration from scratch for this payload/board."
110 @ echo
111 endif
112 @ cp -f $(UCLIBC_SRC_DIR)/.config $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD)
113 @ echo "Your custom uclibc config file has been saved as $(PACKAGE_DIR)/uclibc/conf/customconfig--$(PAYLOAD)--$(UCLIBC_ARCH)--$(COREBOOT_VENDOR)-$(COREBOOT_BOARD)."
114 @ echo
115 else
116 @ echo "Your payload does not require uclibc."
117 endif