From 42034dabb899c3734a51f6624dbb8e967dc48f8a Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 2 Aug 2020 16:24:12 +0200 Subject: Add Makefile for validating and creating target kit distribution files. --- Makefile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..05903c5 --- /dev/null +++ b/Makefile @@ -0,0 +1,53 @@ +AUDIO_SOURCES ?= none +WORK_DIR ?= /tmp +DGPREFIX ?= /usr/bin +DGVALIDATOR ?= $(DGPREFIX)/dgvalidator +FUSE_ZIP ?= fuse-zip +FUZERMOUNT ?= fusermount +ZIP ?= zip +MD5SUM ?= md5sum + +KITS = \ + DRSKit2 + +.PHONY: tool-check $(KITS) + +all: + @echo Available targets: $(KITS) + +tool-check: + @$(DGVALIDATOR) --help > /dev/null 2>&1 || (echo "dgvalidator application not found"; false) + @$(FUSE_ZIP) --help > /dev/null 2>&1 || (echo "fuse-zip application not found"; false) + @$(FUSERMOUNT) --help > /dev/null 2>&1 || (echo "fusermount application not found"; false) + @$(ZIP) --help > /dev/null 2>&1 || (echo "zip application not found"; false) + @$(MD5SUM) --help > /dev/null 2>&1 || (echo "md5 application not found"; false) + +DRSKit2: tool-check +# Target config: + $(eval VER=2.1) + $(eval FILES=DRSKit_basic.xml DRSKit_full.xml DRSKit_minimal.xml DRSKit_no_whiskers.xml DRSKit_whiskers_only.xml) +# + $(eval ZIP_FILE=$(WORK_DIR)/$@-$(VER).zip) + $(eval PATCH_FILE=$(WORK_DIR)/$@-$(VER)-patch.zip) + mkdir -p $(WORK_DIR) + [ ! -f $(ZIP_FILE) ] || rm -f $(ZIP_FILE) + [ ! -f $(ZIP_FILE).md5 ] || rm -f $(ZIP_FILE).md5 + [ ! -f $(PATCH_FILE) ] || rm -f $(PATCH_FILE) + [ ! -f $(PATCH_FILE).md5 ] || rm -f $(PATCH_FILE).md5 +## Pre compress validation (no audio): + $(foreach F,$(FILES),(echo "Validating $(F) (no audio)"; $(DGVALIDATOR) -p -D-all -n $@/$(F)) &&) true +## Compressed target creation: + @[ $(AUDIO_SOURCES) != none ] || (echo "AUDIO_SOURCES not set"; false) + @[ -d $(AUDIO_SOURCES)/$@ ] || (echo "$@ dir does not exist in AUDIO_SOURCES"; false) + $(ZIP) -r $(ZIP_FILE) $@ + cp $(ZIP_FILE) $(PATCH_FILE) + (cd $(AUDIO_SOURCES); $(ZIP) -r $(ZIP_FILE) $@) +# + $(eval MOUNT_TARGET=$(WORK_DIR)/$@-$(VER).dir) + mkdir -p $(MOUNT_TARGET) + $(FUSE_ZIP) -r $(ZIP_FILE) $(MOUNT_TARGET) + $(foreach F,$(FILES),(echo "Validating $(F) (with audio)"; $(DGVALIDATOR) -p -D-all $(MOUNT_TARGET)/$@/$(F)) &&) true + $(FUZERMOUNT) -u $(MOUNT_TARGET) + rmdir $(MOUNT_TARGET) + $(MD5SUM) $(ZIP_FILE) > $(ZIP_FILE).md5 + $(MD5SUM) $(PATCH_FILE) > $(PATCH_FILE).md5 -- cgit v1.2.3