#
# Copyright (C) 2008-Present      Sigma Designs
#
# Sigma Designs
# 1778 McCarthy BLVD
# Milpitas CA 95035, USA
#
#############################################################
#############################################################
#
# mkcramfs to build to target cramfs filesystems
#
#############################################################
TARGETS+=cramfs
ifeq ($(strip $(BR2_TARGET_ROOTFS_CRAMFS)),y)
SUBDIR:=target/$(TARGETS)
BUILD_DIR:=$(BASE_DIR)/$(SUBDIR)
VERSION:=$(strip $(subst ",, $(BR2_CRAMFS_VERSION)))
#"))
SOURCE:=$(TARGETS)-$(VERSION).tar.gz
UNZIP:=$(TAR)
UNZIP_OPTIONS:=$(GZ_EXT)
ifeq ($(strip $(DOWNLOAD_SITE_PUBLIC)),y)
SITE:=http://aleron.dl.sourceforge.net/sourceforge/$(TARGETS)
else
SITE:=$(DOWNLOAD_SITE)
endif
SOURCE_DIR:=$(BUILD_DIR)/$(TARGETS)-$(VERSION)
SOURCE_BINS:=$(SOURCE_DIR)/mk$(TARGETS)
STAGING_BINS:=$(STAGING_DIR)/bin/mk$(TARGETS)
-include $(BASE_DIR)/makefile.newrules
CONFIGURE:=
############################################################################
#
# Build the $(TARGETS) root filesystem image
#
############################################################################
CRAMFS_BASE:=$(subst ",,$(BR2_TARGET_ROOTFS_CRAMFS_OUTPUT))
#")
CRAMFS_TARGET:=$(CRAMFS_BASE)
.PHONY:$(TARGET_DEVICE_TABLE) 
$(CRAMFS_BASE): $(TARGET_DEVICE_TABLE)
	-@find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIP) 2>/dev/null || true;
	@$(SOURCE_DIR)/mk$(TARGETS) -n $(TARGETS) -sp -b $(BR2_TARGET_ROOTFS_CRAMFS_BSIZE) -D $^ $(TARGET_DIR) $@
extra-operations: $(CRAMFS_TARGET)
extra-remove:; @-rm -f $(CRAMFS_TARGET)
ifneq '$(shell find $(TARGET_DIR)/bin/ -name busybox -type f)' ''
BUILD:=$(MAKE) CFLAGS="-Wall -O2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" -C $(SOURCE_DIR)
else
BUILD:=
$(warning Please build busybox first)
endif
else
$(error Please use "make menuconfig" to enable $(TARGETS))
endif
