Quantcast

Added a makefile (just makes the .zip for now)

Kevin Lyles [01-24-14 - 04:30]
Added a makefile (just makes the .zip for now)
Filename
Makefile
make-zip.sh
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1275bd2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,22 @@
+#!/usr/bin/make -f
+
+SHELL = /bin/sh
+.SUFFIXES:			# We don't use suffixes for this Makefile
+.DELETE_ON_ERROR:	# We want make to delete partially-created targets
+VERSION := $(shell grep '^\#\# Version: ' WeightsWatcher.toc | sed -e 's/.* //')
+OUTPUT_FILENAME := "WeightsWatcher-$(VERSION).zip"
+EXCLUDED_FILES = .git* Todo* *~ *.sh gem-ids* create-* Makefile
+EXCLUDE_PATTERNS = $(foreach str,$(EXCLUDED_FILES),-xr!'$(str)')
+
+
+.PHONY: clean
+clean:
+
+.PHONY: distclean
+distclean:
+	-rm -f ../$(OUTPUT_FILENAME)
+
+.PHONY: dist
+dist:
+	@[ -f ../$(OUTPUT_FILENAME) ] || exit 0 && echo "Output file $(OUTPUT_FILENAME) exists! Aborting..." && exit 1
+	cd .. && 7z a -tzip $(EXCLUDE_PATTERNS) -mx=9 $(OUTPUT_FILENAME) WeightsWatcher/
diff --git a/make-zip.sh b/make-zip.sh
deleted file mode 100755
index 4e6bedd..0000000
--- a/make-zip.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-VERSION="`grep '^## Version: ' WeightsWatcher.toc | sed -e 's/.* //'`"
-
-## Debug code
-# echo "'$VERSION'"
-# exit
-
-cd .. && 7z a -tzip -xr!'.git*' -xr!'Todo*' -xr!'*~' -xr-!'WeightsWatcher/goals' -xr-!'WeightsWatcher/future-features' -xr-!'WeightsWatcher/wowhead values' -xr-!'WeightsWatcher/localization notes' -xr-!'WeightsWatcher/*.sh' -xr-!'WeightsWatcher/gem-ids*' -xr-!'WeightsWatcher/create-*' -mx=9 WeightsWatcher-$VERSION.zip WeightsWatcher/