
# Core language conformance tests deliverables
CORE_LANGUAGE_ICS_ARCHIVE = ts_10295001v011001p.zip
CORE_LANGUAGE_TSS_ARCHIVE = ts_10295002v011001p.zip
CORE_LANGUAGE_ATS_ARCHIVE = ts_10295003v011001p.zip

# XML and JSON conformance tests deliverables
XML_JSON_ATS_ARCHIVE = ts_103255v010701p.zip

# Object oriented features conformance tests deliverables
OO_ICS_ARCHIVE = ts_10366301v010301p.zip
OO_TSS_ARCHIVE = ts_10366302v010301p.zip
OO_ATS_ARCHIVE = ts_10366303v010301p.zip

DELIVERABLES = $(CORE_LANGUAGE_ICS_ARCHIVE) $(CORE_LANGUAGE_TSS_ARCHIVE) $(CORE_LANGUAGE_ATS_ARCHIVE) $(XML_JSON_ATS_ARCHIVE) $(OO_ICS_ARCHIVE) $(OO_TSS_ARCHIVE) $(OO_ATS_ARCHIVE)

VPATH=docs
.PHONY: all ## Build all deliverables
all: $(DELIVERABLES)

$(CORE_LANGUAGE_ATS_ARCHIVE): $(shell find ATS/core_language -type f)
$(XML_JSON_ATS_ARCHIVE): $(shell find ATS/json ATS/xml -type f)
$(OO_ATS_ARCHIVE): $(shell find ATS/oo -type f)

.PHONY: clean ## Remove all artifacts.
clean:
	@rm -fv $(DELIVERABLES) $(DELIVERABLES:.zip=.pdf)

# It's good practice to provide a help target describing available targets.
# This script greps through the Makefile and displays all phony-targets having a
# `##` help string.
.PHONY: help
help:
	@echo Available targets:
	@perl -ne 'printf("\t%-10s\t%s\n", $$1, $$2)  if /^\.PHONY:\s*(.*)\s*##\s*(.*)$$/' <$(MAKEFILE_LIST)

# Convert docx files to PDF
%.pdf: docs/%.docx
	libreoffice --headless --convert-to pdf $<

# Every deliverable requires a PDF file
%.zip: %.pdf
	zip -r9 $@ $^
