ramips: do not "local" variables outside of a function
[openwrt/openwrt.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.gz
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_MD5SUM:=
18 PKG_CAT:=zcat
19
20 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
21
22 include $(INCLUDE_DIR)/host-build.mk
23
24 HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs
25 CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) -L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT
26 ifneq ($(HOST_OS),Linux)
27 CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include getline.h -include endian.h -I$(CURDIR)/include -include fls.h
28 MTD_STATIC := 0
29 else
30 MTD_STATIC := 1
31 endif
32
33 MTD_MAKEOPTS = \
34 CFLAGS="$(CFLAGS)" \
35 LDFLAGS="$(HOST_LDFLAGS)" \
36 WITHOUT_LZO=1 WITHOUT_XATTR=1 \
37 SUBDIRS="" \
38 BUILDDIR="$(HOST_BUILD_DIR)" \
39 STATIC=$(MTD_STATIC) \
40 V=$(if $(findstring c,$(OPENWRT_VERBOSE)),1)
41
42 define Host/Compile
43 $(MAKE) -C $(HOST_BUILD_DIR) \
44 $(MTD_MAKEOPTS) \
45 TARGETS="mkfs.jffs2 ubi-utils/ubinize mkfs.ubifs/mkfs.ubifs"
46 endef
47
48 define Host/Install
49 $(CP) \
50 $(HOST_BUILD_DIR)/mkfs.jffs2 \
51 $(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \
52 $(HOST_BUILD_DIR)/ubi-utils/ubinize \
53 $(STAGING_DIR_HOST)/bin/
54 endef
55
56 define Host/Clean
57 rm -f $(STAGING_DIR_HOST)/bin/{mkfs.jffs2,mkfs.ubifs,ubinize}
58 endef
59
60 $(eval $(call HostBuild))