firmware-utils: kernel image generator for TP-Link RE450
[openwrt/staging/chunkeey.git] / tools / mtd-utils / Makefile
1 #
2 # Copyright (C) 2006-2015 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:=mtd-utils
10 PKG_VERSION:=1.5.2
11
12 PKG_SOURCE_VERSION:=aea36417067dade75192bafa03af70b6eb2677b1
13 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
14 PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
15 PKG_SOURCE_PROTO:=git
16 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
17 PKG_MIRROR_HASH:=e11b342b85a36b2e438a8412ec52f87621d3046aec1a93039f8c72de9990b2a7
18
19 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
20
21 include $(INCLUDE_DIR)/host-build.mk
22
23 HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs
24 CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) -L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT
25 ifneq ($(HOST_OS),Linux)
26 CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include getline.h -include endian.h -I$(CURDIR)/include -include fls.h
27 MTD_STATIC := 0
28 else
29 MTD_STATIC := 1
30 endif
31
32 MTD_MAKEOPTS = \
33 CFLAGS="$(CFLAGS)" \
34 LDFLAGS="$(HOST_LDFLAGS)" \
35 WITHOUT_LZO=1 WITHOUT_XATTR=1 \
36 SUBDIRS="" \
37 BUILDDIR="$(HOST_BUILD_DIR)" \
38 STATIC=$(MTD_STATIC) \
39 V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1)
40
41 define Host/Compile
42 $(MAKE) -C $(HOST_BUILD_DIR) \
43 $(MTD_MAKEOPTS) \
44 TARGETS="mkfs.jffs2 ubi-utils/ubinize mkfs.ubifs/mkfs.ubifs"
45 endef
46
47 define Host/Install
48 $(CP) \
49 $(HOST_BUILD_DIR)/mkfs.jffs2 \
50 $(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \
51 $(HOST_BUILD_DIR)/ubi-utils/ubinize \
52 $(STAGING_DIR_HOST)/bin/
53 endef
54
55 define Host/Clean
56 rm -f $(STAGING_DIR_HOST)/bin/{mkfs.jffs2,mkfs.ubifs,ubinize}
57 endef
58
59 $(eval $(call HostBuild))