CRYPT_ROOT=..
QT_UI := $(CRYPT_ROOT)/qt_ui
QT_BUILD := ./qt_build
QMAKE := qmake

include ../deps/makefiles/platform.mak

ifeq ($(PLATFORM),GNULINUX)
    QMAKE_SPEC := linux-g++
else ifeq ($(PLATFORM),FREEBSD)
    QMAKE_SPEC := freebsd-clang
else ifeq ($(PLATFORM),MACOS)
    QMAKE_SPEC := macx-clang
else
    QMAKE_SPEC := win32-g++
endif

ifeq ($(RELEASE),on)
    QMAKE_CONFIG := release
else
    QMAKE_CONFIG := debug
endif

ifeq ($(USE_SYSTEM_LIBS),on)
    QMAKE_CONFIG += USE_SYSTEM_LIBS
endif

ifeq ($(LOCALIZATION),on)
    QMAKE_CONFIG += LOCALIZATION
endif

all:: x_make

x_qmake::
	mkdir -p $(QT_BUILD)
	cd $(QT_BUILD) && $(QMAKE) -r -spec $(QMAKE_SPEC) "CONFIG+=$(QMAKE_CONFIG)" ../../qt_ui/EncryptPad.pro
x_make:: x_qmake
	$(MAKE) -C $(QT_BUILD)
clean::
	if [ -d $(QT_BUILD) ]; \
	then \
		$(MAKE) -C $(QT_BUILD) clean RELEASE=$(RELEASE); \
	fi
