diff --git a/Makefile b/Makefile
index 7867087a7d5ba733c09feb5f40e12df8c615741d..f609971f15772d62fdd9d21f238f0578ac534f1a 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@
 SHELL := /bin/bash -e
 
 VERSION_FILE=./src/utils/version/version_git.h
+RELEASED_VERSION_FILE=./src/utils/version/version_release.txt
 
 
 # define our object and binary directories
@@ -79,7 +80,7 @@ UTIL_SUBDIRS =	$(SRC_DIR)/utils/bedFile \
 BUILT_OBJECTS = $(OBJ_DIR)/*.o
 
 
-all: print_banner $(OBJ_DIR) $(BIN_DIR) version $(UTIL_SUBDIRS) $(SUBDIRS)
+all: print_banner $(OBJ_DIR) $(BIN_DIR) autoversion $(UTIL_SUBDIRS) $(SUBDIRS)
 	@echo "- Building main bedtools binary."
 	@$(CXX) $(CXXFLAGS) -c src/bedtools.cpp -o obj/bedtools.o -I$(UTIL_DIR)/version/
 	@$(CXX) $(LDFLAGS) $(CXXFLAGS) -o $(BIN_DIR)/bedtools $(BUILT_OBJECTS) -L$(UTIL_DIR)/BamTools/lib/ -lbamtools $(LIBS)
@@ -128,15 +129,75 @@ test: all
 
 .PHONY: test
 
-.PHONY: version
-version:
-	@( BEDTOOLS_VERSION="" ; \
-	[ -e "$(VERSION_FILE)" ] && BEDTOOLS_VERSION=$$(grep "define VERSION_GIT " "$(VERSION_FILE)" | cut -f3 -d" " | sed 's/"//g') ; \
-	GIT_VERSION=$$(git describe --always --tags --dirty) ; \
-	echo "BEDTOOLS_VERSION = $$BEDTOOLS_VERSION" ; \
-	echo "GIT_VERSION = $$GIT_VERSION" ; \
-	if [ "$${GIT_VERSION}" != "$${BEDTOOLS_VERSION}" ] ; then \
-		mkdir -p ./src/utils/version ; \
+
+## For BEDTools developers (not users):
+## When you want to release (and tag) a new version, run:
+##   $ make setversion VERSION=v2.17.2
+## This will:
+##   1. Update the "/src/utils/version/version_release.txt" file
+##   2. Commit the file
+##   3. Git-Tag the commit with the latest version
+##
+.PHONY: setversion
+setversion:
+    ifeq "$(VERSION)" ""
+		$(error please set VERSION variable to the new version (e.g "make setversion VERSION=v2.17.2"))
+    endif
+		@echo "# This file was auto-generated by running \"make setversion VERSION=$(VERSION)\"" > "$(RELEASED_VERSION_FILE)"
+		@echo "# on $$(date) ." >> "$(RELEASED_VERSION_FILE)"
+		@echo "# Please do not edit or commit this file manually." >> "$(RELEASED_VERSION_FILE)"
+		@echo "#" >> "$(RELEASED_VERSION_FILE)"
+		@echo "$(VERSION)" >> $(RELEASED_VERSION_FILE)
+		@git add $(RELEASED_VERSION_FILE)
+		@git commit -q -m "Setting Release-Version $(VERSION)"
+		@git tag "$(VERSION)"
+		@echo "Version updated to $(VERSION)."
+		@echo ""
+		@echo "Don't forget to push the commits AND the tags:"
+		@echo "  git push --all --tags"
+		@echo ""
+
+
+## Automatic version detection
+##
+## What's going on here?
+## 1. If there's a ".git" repository - use the version from the repository.
+##    ignore any released-version file. git repository is authorative.
+##
+## 2, If there's no ".git" repository,
+##    get the "released" version number from the release-version file.
+##
+##    2.1. If the current directory looks like "arq5x-bedtools-XXXXXXX",
+##         assume "-XXXXXX" is the last revision number (and the user
+##         probably downloaded the ZIP from github).
+##         Append the revision number to the released version string.
+##
+## 3. Compare the detected version (from steps 1,2) to the current string
+##    in ./src/utils/version/version_git.h .
+##    If they differ, update the header file - will cause a recompilation
+##    of version.o .
+##
+.PHONY: autoversion
+autoversion:
+	@( \
+	if [ -d ".git" ] && which git > /dev/null ; then \
+		DETECTED_VERSION=$$(git describe --always --tags --dirty) ; \
+	else \
+		DETECTED_VERSION=$$(grep -v "^#" "$(RELEASED_VERSION_FILE)") ; \
+		if basename $$(pwd) | grep -q "^[[:alnum:]]*-bedtools-[[:alnum:]]*$$" ; then \
+			DETECTED_VERSION=$${DETECTED_VERSION}-zip-$$(basename "$$(pwd)" | sed 's/^[[:alnum:]]*-bedtools-//') ; \
+		fi ; \
+	fi ; \
+	\
+	CURRENT_VERSION="" ; \
+	[ -e "$(VERSION_FILE)" ] && CURRENT_VERSION=$$(grep "define VERSION_GIT " "$(VERSION_FILE)" | cut -f3 -d" " | sed 's/"//g') ; \
+	\
+	echo "DETECTED_VERSION = $$DETECTED_VERSION" ; \
+	echo "CURRENT_VERSION  = $$CURRENT_VERSION" ; \
+	if [ "$${DETECTED_VERSION}" != "$${CURRENT_VERSION}" ] ; then \
 		echo "Updating version file." ; \
-		printf "#ifndef VERSION_GIT_H\n#define VERSION_GIT_H\n\n#define VERSION_GIT \"$${GIT_VERSION}\"\n\n#endif /* VERSION_GIT_H */\n" > $(VERSION_FILE) ; \
+		echo "#ifndef VERSION_GIT_H" > $(VERSION_FILE) ; \
+		echo "#define VERSION_GIT_H" >> $(VERSION_FILE) ; \
+		echo "#define VERSION_GIT \"$${DETECTED_VERSION}\"" >> $(VERSION_FILE) ; \
+		echo "#endif /* VERSION_GIT_H */" >> $(VERSION_FILE) ; \
 	fi )
diff --git a/src/utils/version/version_release.txt b/src/utils/version/version_release.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6a4ae45a048ad6dc8707d6f618b6aa6890fe9b0e
--- /dev/null
+++ b/src/utils/version/version_release.txt
@@ -0,0 +1,5 @@
+# This file was auto-generated by running "make setversion VERSION=v2.16.0.tagTest"
+# on Fri Mar  9 13:50:40 EST 2012 .
+# Please do not edit or commit this file manually.
+#
+v2.16.0.tagTest