added zlib as a dependency for the KVM tools, and made some other fixes
[kvm-coreboot.git] / packages / libpayload / libpayload.mk
blob0f724c731f7fa68b8c72de21486bc8afa8cd36ea
1 LIBPAYLOAD_URL=svn://coreboot.org/repos/trunk/payloads/libpayload
2 LIBPAYLOAD_TAG=3289
4 LIBPAYLOAD_DIR=$(BUILD_DIR)/libpayload
5 LIBPAYLOAD_SRC_DIR=$(LIBPAYLOAD_DIR)/svn
6 LIBPAYLOAD_STAMP_DIR=$(LIBPAYLOAD_DIR)/stamps
7 LIBPAYLOAD_LOG_DIR=$(LIBPAYLOAD_DIR)/logs
9 ifeq ($(CONFIG_VERBOSE),y)
10 LIBPAYLOAD_FETCH_LOG=/dev/stdout
11 LIBPAYLOAD_BUILD_LOG=/dev/stdout
12 LIBPAYLOAD_INSTALL_LOG=/dev/stdout
13 else
14 LIBPAYLOAD_BUILD_LOG=$(LIBPAYLOAD_LOG_DIR)/build.log
15 LIBPAYLOAD_INSTALL_LOG=$(LIBPAYLOAD_LOG_DIR)/install.log
16 LIBPAYLOAD_FETCH_LOG=$(LIBPAYLOAD_LOG_DIR)/fetch.log
17 endif
19 ifeq ($(call custom-config-exists,libpayload), 1)
20 LIBPAYLOAD_CONFIG=$(call custom-config-name,libpayload)
21 else
22 ifeq ($(CONFIG_PLATFORM_GEODE),y)
23 LIBPAYLOAD_CONFIG=$(PACKAGE_DIR)/libpayload/conf/defconfig.geode
24 else
25 LIBPAYLOAD_CONFIG=$(PACKAGE_DIR)/libpayload/conf/defconfig
26 endif
27 endif
29 LIBPAYLOAD_TARBALL=libpayload-svn-$(LIBPAYLOAD_TAG).tar.gz
31 $(SOURCE_DIR)/$(LIBPAYLOAD_TARBALL):
32 @ mkdir -p $(SOURCE_DIR)/libpayload
33 @ $(BIN_DIR)/fetchsvn.sh $(LIBPAYLOAD_URL) $(SOURCE_DIR)/libpayload \
34 $(LIBPAYLOAD_TAG) $(SOURCE_DIR)/$(LIBPAYLOAD_TARBALL) \
35 > $(LIBPAYLOAD_FETCH_LOG) 2>&1
37 $(LIBPAYLOAD_STAMP_DIR)/.unpacked: $(SOURCE_DIR)/$(LIBPAYLOAD_TARBALL) | $(LIBPAYLOAD_STAMP_DIR) $(LIBPAYLOAD_DIR)
38 @ echo "Unpacking libpayload..."
39 @ tar -C $(LIBPAYLOAD_DIR) -zxf $(SOURCE_DIR)/$(LIBPAYLOAD_TARBALL)
40 @ touch $@
42 $(LIBPAYLOAD_SRC_DIR)/.config: $(LIBPAYLOAD_STAMP_DIR)/.unpacked
43 @ cp $(LIBPAYLOAD_CONFIG) $@
44 @ make -C $(LIBPAYLOAD_SRC_DIR) oldconfig > $(LIBPAYLOAD_BUILD_LOG) 2>&1
46 $(LIBPAYLOAD_SRC_DIR)/lib/libpayload.a: $(LIBPAYLOAD_SRC_DIR)/.config
47 @ echo "Building libpayload..."
48 ifeq ($(findstring customconfig,$(LIBPAYLOAD_CONFIG)),customconfig)
49 @ echo "Using custom config $(LIBPAYLOAD_CONFIG)"
50 endif
51 @ make -C $(LIBPAYLOAD_SRC_DIR) > $(LIBPAYLOAD_BUILD_LOG) 2>&1
52 @ mkdir -p $(OUTPUT_DIR)/config/libpayload
53 @ cp $(LIBPAYLOAD_SRC_DIR)/.config $(OUTPUT_DIR)/config/libpayload
55 $(LIBPAYLOAD_STAMP_DIR)/.installed: $(LIBPAYLOAD_SRC_DIR)/lib/libpayload.a
56 @ echo "Installing libpayload..."
57 @ make -C $(LIBPAYLOAD_SRC_DIR) DESTDIR=$(STAGING_DIR) install \
58 > $(LIBPAYLOAD_INSTALL_LOG) 2>&1
59 @ touch $@
61 $(LIBPAYLOAD_STAMP_DIR) $(LIBPAYLOAD_LOG_DIR):
62 @ mkdir -p $@
64 libpayload: $(LIBPAYLOAD_STAMP_DIR) $(LIBPAYLOAD_LOG_DIR) $(LIBPAYLOAD_STAMP_DIR)/.installed
66 libpayload-clean:
67 @ echo "Cleaning libpayload..."
68 ifneq ($(wildcard $(LIBPAYLOAD_SRC_DIR)/Makefile),)
69 @ $(MAKE) -C $(LIBPAYLOAD_SRC_DIR) clean > /dev/null 2>&1
70 endif
71 @ rm -f $(LIBPAYLOAD_STAMP_DIR)/.installed
73 libpayload-distclean:
74 @ rm -rf $(LIBPAYLOAD_DIR)/*
76 libpayload-extract: $(LIBPAYLOAD_STAMP_DIR)/.patched
78 libpayload-config: | $(LIBPAYLOAD_SRC_DIR)/.config
79 ifeq ($(call custom-config-exists,libpayload), 1)
80 @ cp -f $(call custom-config-name,libpayload) $(LIBPAYLOAD_SRC_DIR)/.config
81 endif
82 @ echo "Configure libpayload..."
83 @ $(MAKE) -C $(LIBPAYLOAD_SRC_DIR) menuconfig
84 @ echo
85 ifeq ($(call custom-config-exists,libpayload),1)
86 @ echo "Found an existing custom configuration file:"
87 @ echo " $(call custom-config-name,libpayload)"
88 @ echo "I've copied it back to the source directory for modification."
89 @ echo "Remove the above file and re-run this command if you want to create a new customer configuration from scratch for this payload/board."
90 @ echo
91 endif
92 @ cp -f $(LIBPAYLOAD_SRC_DIR)/.config $(call custom-config-name,libpayload)
93 @ echo "Your custom config file has been saved as $(call custom-config-name,libpayload)."
94 @ echo