#
# Copyright (C) 2008-Present      Sigma Designs
#
# Sigma Designs
# 1778 McCarthy BLVD
# Milpitas CA 95035, USA
#
#############################################################
#############################################################
#
# mkyaffs2image to build to target yaffs2 filesystems
#
#############################################################
TARGETS+=yaffs
ifeq ($(strip $(BR2_TARGET_ROOTFS_YAFFS2)),y)
SUBDIR:=target/$(TARGETS)
BUILD_DIR:=$(BASE_DIR)/$(SUBDIR)
VERSION:=$(strip $(subst ",, $(BR2_YAFFS_VERSION)))
#"))
SOURCE:=$(TARGETS)-$(VERSION).tar.gz
UNZIP:=$(TAR)
UNZIP_OPTIONS:=$(GZ_EXT)
ifeq ($(strip $(DOWNLOAD_SITE_PUBLIC)),y)
SITE:=$(DOWNLOAD_SITE)
else
SITE:=$(DOWNLOAD_SITE)
endif
SOURCE_DIR:=$(BUILD_DIR)/$(TARGETS)-$(VERSION)
SOURCE_BINS:=$(SOURCE_DIR)/utils/mk$(TARGETS)2image
STAGING_BINS:=$(STAGING_DIR)/bin/mk$(TARGETS)2image
-include $(BASE_DIR)/makefile.newrules
CONFIGURE:=
############################################################################
#
# Build the $(TARGETS) root filesystem image
#
############################################################################
YAFFS2_BASE:=$(subst ",,$(BR2_TARGET_ROOTFS_YAFFS2_OUTPUT))
#")
YAFFS2_TARGET:=$(YAFFS2_BASE)
.PHONY:$(TARGET_DEVICE_TABLE) 
$(YAFFS2_BASE): $(TARGET_DEVICE_TABLE)
	-@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true;
	$(SOURCE_DIR)/utils/mk$(TARGETS)2image -i -n -c $(BR2_TARGET_ROOTFS_YAFFS2_CSIZE) $(TARGET_DIR) $@
extra-operations: $(YAFFS2_TARGET)
extra-remove:; @-rm -f $(YAFFS2_TARGET)
ifneq '$(shell find $(TARGET_DIR)/bin/ -name busybox -type f)' ''
BUILD:=$(MAKE) -C $(SOURCE_DIR)/utils mk$(TARGETS)2image
else
BUILD:=
$(warning Please build busybox first)
endif
else
$(error Please use "make menuconfig" to enable $(TARGETS))
endif

