mkimage: cross compile fix: pass HOST_*FLAGS in to uboot's makefile
[openwrt/openwrt.git] / tools / mkimage / Makefile
1 #
2 # Copyright (C) 2006-2014 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
9 PKG_NAME:=mkimage
10 PKG_VERSION:=2014.10
11
12 PKG_SOURCE:=u-boot-$(PKG_VERSION).tar.bz2
13 PKG_SOURCE_URL:=\
14 http://mirror2.openwrt.org/sources \
15 ftp://ftp.denx.de/pub/u-boot
16 PKG_MD5SUM:=3ddcaee2f05b7c464778112ec83664b5
17 PKG_CAT:=bzcat
18
19 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/u-boot-$(PKG_VERSION)
20
21 include $(INCLUDE_DIR)/host-build.mk
22
23 define Host/Prepare
24 $(Host/Prepare/Default)
25 rm -f \
26 $(HOST_BUILD_DIR)/include/errno.h \
27 $(HOST_BUILD_DIR)/include/malloc.h \
28 $(HOST_BUILD_DIR)/tools/.depend
29 touch $(HOST_BUILD_DIR)/include/config.mk
30 touch $(HOST_BUILD_DIR)/include/config.h
31 endef
32
33 define Host/Compile
34 $(MAKE) -C $(HOST_BUILD_DIR) defconfig HOSTCFLAGS="$(HOST_CPPFLAGS) $(HOST_CFLAGS)" HOSTLDFLAGS="$(HOST_LDFLAGS)"
35 $(MAKE) -C $(HOST_BUILD_DIR) tools-only HOSTCFLAGS="$(HOST_CPPFLAGS) $(HOST_CFLAGS)" HOSTLDFLAGS="$(HOST_LDFLAGS)"
36 endef
37
38 define Host/Install
39 $(CP) $(HOST_BUILD_DIR)/tools/mkimage $(STAGING_DIR_HOST)/bin/
40 endef
41
42 define Host/Clean
43 rm -f $(STAGING_DIR_HOST)/bin/mkimage
44 endef
45
46 $(eval $(call HostBuild))