# /****************************************************************************
# **
# ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
# ** Contact: Nokia Corporation (qt-info@nokia.com)
# **
# ** This file is part of symbian-sbsv2 mkspec.
# **
# ****************************************************************************/


SINGLETON:=$(call sanitise,TSTORE_SINGLETON_$(EXTENSION_ROOT))

ifeq ($($(SINGLETON)),)
# Prevent duplicate targets from being created, as that can lead to build breaks
# in multiprocessor systems if two or more targets try to write to .make.cache at
# the same time.
$(SINGLETON):=1

STORE_BUILD_TARGET:=$(call sanitise,TSTORE_BUILD_$(PLATFORM_PATH)_$(CFG_PATH)_$(EXTENSION_ROOT))
CACHE_FILENAME:=$(EXTENSION_ROOT)/.make.cache

ifeq "$(CFG_PATH)" "udeb"
VISUAL_CFG:=DEBUG
else
VISUAL_CFG:=RELEASE
endif

define qmake_store_build
$(ALLTARGET):: $(STORE_BUILD_TARGET)

$(STORE_BUILD_TARGET):
	$(call startrule,qmake_store_build) \
	echo "# ==============================================================================" > $(CACHE_FILENAME) && \
	echo "# This file is generated by make and should not be modified by the user" >> $(CACHE_FILENAME) && \
	echo "#  Name        : .make.cache" >> $(CACHE_FILENAME) && \
	echo "#  Part of     : " >> $(CACHE_FILENAME) && \
	echo "#  Description : This file is used to cache last build target for" >> $(CACHE_FILENAME) && \
	echo "#                make sis target." >> $(CACHE_FILENAME) && \
	echo "#  Version     : " >> $(CACHE_FILENAME) && \
	echo "# ==============================================================================" >> $(CACHE_FILENAME) && \
	echo QT_SIS_TARGET ?= $(VISUAL_CFG)-$(PLATFORM_PATH) >> $(CACHE_FILENAME)
	$(call endrule,qmake_store_build)
endef

$(eval $(qmake_store_build))
$(eval $(call GenerateStandardCleanTarget,$(CACHE_FILENAME),''))
endif

