PLUGIN_NAME = pdf-creator
PLUGIN_PATH = easydb-pdf-creator-plugin

EASYDB_LIB = easydb-library

L10N_FILES = l10n/$(PLUGIN_NAME).csv
L10N_GOOGLE_KEY = 1Z3UPJ6XqLBp-P8SUf-ewq4osNJ3iZWKJB83tc6Wrfn0
L10N_GOOGLE_GID = 675547281

PRINT_CSS = $(WEB)/${PLUGIN_NAME}-print.css

INSTALL_FILES = \
	$(WEB)/l10n/cultures.json \
	$(WEB)/l10n/de-DE.json \
	$(WEB)/l10n/en-US.json \
	$(WEB)/l10n/es-ES.json \
	$(WEB)/l10n/it-IT.json \
	$(CSS) \
	$(JS) \
	$(PRINT_CSS) \
	manifest.yml

COFFEE_FILES = src/webfrontend/PdfCreator.coffee \
	src/webfrontend/PdfCreatorTemplate.coffee \
	src/webfrontend/PdfCreatorTemplateRow.coffee \
	src/webfrontend/PdfCreatorUtils.coffee \
	src/webfrontend/PdfCreatorModal.coffee \
	src/webfrontend/PdfCreatorFieldsFormNode.coffee \
	src/webfrontend/PdfCreatorNode.coffee \
	src/webfrontend/PdfCreatorObjecttypePlugin.coffee \
	src/webfrontend/PdfCreatorHeader.coffee \
	src/webfrontend/PdfCreatorFooter.coffee \
	src/webfrontend/node/BodyNode.coffee \
	src/webfrontend/node/DocumentNode.coffee \
	src/webfrontend/node/DivNode.coffee \
	src/webfrontend/node/FixedTextNode.coffee \
	src/webfrontend/node/EASNode.coffee \
	src/webfrontend/node/AssetNode.coffee \
	src/webfrontend/node/FieldNode.coffee


all: build

SCSS_FILES = src/webfrontend/scss/pdf-creator.scss \
	src/webfrontend/scss/fylr-pdf-creator.scss

# Print CSS
PRINT_SCSS_FILES = src/webfrontend/scss/pdf-creator-print.scss

print_css: $(PRINT_CSS)

$(PRINT_CSS): $(PRINT_SCSS_FILES)
	mkdir -p $(dir $@)
	cat $(PRINT_SCSS_FILES) | $(WEBFRONTEND_SASS) --stdin > $(PRINT_CSS) || ( rm -f $(PRINT_CSS) ; false )

include $(EASYDB_LIB)/tools/base-plugins.make

build: code $(L10N) buildinfojson

code: $(JS) css print_css

clean: clean-base

wipe: wipe-base

zip: build
	mkdir -p zip/$(PLUGIN_NAME)
	cp -r build zip/$(PLUGIN_NAME)/
	cp manifest.yml zip/$(PLUGIN_NAME)/
	(cd zip; zip - -r . > ../$(PLUGIN_NAME).zip)
	rm -r zip/
