# makefile for mtd-utils

-include ../../path.mk

PKG_BUILD_DIR:=mtd-utils-2.1.2

all: mtd-utils

mtd-utils: 
	if [ ! -f ./$(PKG_BUILD_DIR)/Makefile ]; then \
		cd ./$(PKG_BUILD_DIR); \
		autoreconf; \
		./configure \
		--target=x86_64-pc-linux-gnu  \
		--host=x86_64-pc-linux-gnu  \
		--build=x86_64-pc-linux-gnu  \
		--program-prefix="" \
		--program-suffix="" \
		--prefix=$(TOPDIR)/tools/mtd-utils-2.1.2/host \
		--exec-prefix=$(TOPDIR)/tools/mtd-utils-2.1.2/host \
		--sysconfdir=$(TOPDIR)/tools/mtd-utils-2.1.2/host/etc \
		--localstatedir=$(TOPDIR)/tools/mtd-utils-2.1.2/host/var \
		--sbindir=$(TOPDIR)/tools/mtd-utils-2.1.2/host/bin \
		--disable-tests \
		--without-crypto \
		--without-xattr \
		--without-zstd \
		--without-lzo; \
	fi
	make -j1 -C ./$(PKG_BUILD_DIR) PROGRAMS="mkfs.jffs2 ubinize mkfs.ubifs" 

clean:
	if [ -f ./$(PKG_BUILD_DIR)/Makefile ]; then \
		make -C ./$(PKG_BUILD_DIR) clean; \
	fi

.PHONY: all clean
