Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #
  2. # Copyright (C) 2006-2012 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. PKG_NAME:=mtd-utils
  9. PKG_VERSION:=1.4.5
  10. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  11. PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
  12. PKG_SOURCE_PROTO:=git
  13. PKG_SOURCE_VERSION:=5319b84974fcb71504aed2d1b8285e9c0a4a4bb8
  14. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  15. PKG_CAT:=zcat
  16. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
  17. include $(INCLUDE_DIR)/host-build.mk
  18. HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs
  19. CFLAGS := $(HOST_CFLAGS) -I$(HOST_BUILD_DIR)/include -L$(HOST_BUILD_DIR) -L$(STAGING_DIR_HOST)/lib -DNO_NATIVE_SUPPORT
  20. ifneq ($(HOST_OS),Linux)
  21. CFLAGS += -Dloff_t=off_t -D__BYTE_ORDER=BYTE_ORDER -include getline.h -include endian.h -I$(CURDIR)/include -include fls.h
  22. endif
  23. MTD_MAKEOPTS = \
  24. CFLAGS="$(CFLAGS)" \
  25. LDFLAGS="$(HOST_LDFLAGS) $(HOST_STATIC_LINKING)" \
  26. WITHOUT_LZO=1 WITHOUT_XATTR=1 \
  27. LZMA_STATIC_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a" \
  28. SUBDIRS="" \
  29. BUILDDIR="$(HOST_BUILD_DIR)"
  30. define Host/Compile
  31. $(MAKE) -C $(HOST_BUILD_DIR)/lib \
  32. $(MTD_MAKEOPTS) \
  33. TARGETS="libmtd.a libcrc32.a" \
  34. LIBS="libmtd libcrc32"
  35. $(MAKE) -C $(HOST_BUILD_DIR) \
  36. $(MTD_MAKEOPTS) \
  37. TARGETS=mkfs.jffs2
  38. $(MAKE) -C $(HOST_BUILD_DIR)/ubi-utils \
  39. $(MTD_MAKEOPTS) \
  40. TARGETS=ubinize
  41. $(MAKE) -C $(HOST_BUILD_DIR)/mkfs.ubifs \
  42. $(MTD_MAKEOPTS) \
  43. BUILDDIR="$(HOST_BUILD_DIR)/mkfs.ubifs"
  44. endef
  45. define Host/Install
  46. $(CP) \
  47. $(HOST_BUILD_DIR)/mkfs.jffs2 \
  48. $(HOST_BUILD_DIR)/mkfs.ubifs/mkfs.ubifs \
  49. $(HOST_BUILD_DIR)/ubinize \
  50. $(STAGING_DIR_HOST)/bin/
  51. endef
  52. define Host/Clean
  53. rm -f $(STAGING_DIR_HOST)/bin/{mkfs.jffs2,mkfs.ubifs,ubinize}
  54. endef
  55. $(eval $(call HostBuild))