aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Harning Jr <harningt@gmail.com>2011-07-05 22:23:15 -0400
committerThomas Harning Jr <harningt@gmail.com>2011-07-05 22:23:15 -0400
commitd813466fadaced2c4c75e8d8a57bc9dc60b0a8f4 (patch)
tree273e3216f2132e1cecedcedf9d3e8b115ccb4a2e
parenta9060c1c633cec8e4e6124b718bbe064726a2b7e (diff)
downloadluaevent-prosody-d813466fadaced2c4c75e8d8a57bc9dc60b0a8f4.tar.gz
luaevent-prosody-d813466fadaced2c4c75e8d8a57bc9dc60b0a8f4.zip
base: adds distribution archive generation functionality to Makefile
-rw-r--r--Makefile17
1 files changed, 17 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c04dc89..611d705 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
+.PHONY: all install clean dist dist-all dist-bzip2 dist-gzip dist-zip
+
+DIST_DIR=dist
+
# Utilities
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
@@ -20,6 +24,19 @@ all:
$(CC) $(CFLAGS) -c -Iinclude -I$(LUA_INC_DIR) src/*.c
$(CC) $(LDFLAGS) -o $(LIB) *.o -levent
+dist dist-all: distdir dist-bzip2 dist-gzip dist-zip
+
+distdir:
+ mkdir -p $(DIST_DIR)
+
+VERSION=luaevent-$(shell git describe --abbrev=4 HEAD 2>/dev/null)
+dist-bzip2: distdir
+ git archive --format=tar --prefix=$(VERSION)/ HEAD | bzip2 -9v > $(DIST_DIR)/$(VERSION).tar.bz2
+dist-gzip: distdir
+ git archive --format=tar --prefix=$(VERSION)/ HEAD | gzip -9v > $(DIST_DIR)/$(VERSION).tar.gz
+dist-zip: distdir
+ git archive --format=zip --prefix=$(VERSION)/ HEAD > $(DIST_DIR)/$(VERSION).zip
+
install: all
mkdir -p $(DESTDIR)$(INSTALL_DIR_LUA)
$(INSTALL_DATA) lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua