aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-01-16 01:53:45 +0000
committerMatthew Wild <mwild1@gmail.com>2012-01-16 01:53:45 +0000
commitc7faf570a716329f0d0991cbb019a6fc5ed5b0de (patch)
treeaee4b8acc3c5b71276b754136472103e4d158cbc /Makefile
parent2ba1c9dd465a9d659198ac63fbc8cbd918f0d31e (diff)
parentdb628bce216e74a0f7507e614e9db5289ee972ee (diff)
downloadluaevent-prosody-c7faf570a716329f0d0991cbb019a6fc5ed5b0de.tar.gz
luaevent-prosody-c7faf570a716329f0d0991cbb019a6fc5ed5b0de.zip
Merge with upstream
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile41
1 files changed, 29 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index be58b48..611d705 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,49 @@
+.PHONY: all install clean dist dist-all dist-bzip2 dist-gzip dist-zip
+
+DIST_DIR=dist
+
# Utilities
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
# Flags
-CFLAGS = -O2 -c -Wall -fpic
+CFLAGS = -Wall -fpic
LDFLAGS = -shared
# Directories
-LUA_INC_DIR=/usr/include/lua5.1
-LUA_LIB_DIR=/usr/lib
+LUA_INC_DIR ?= /usr/include/lua5.1
-INSTALL_DIR_LUA=/usr/share/lua/5.1
-INSTALL_DIR_BIN=/usr/lib/lua/5.1
+INSTALL_DIR_LUA ?= /usr/share/lua/5.1
+INSTALL_DIR_BIN ?= /usr/lib/lua/5.1
# Files
-LUA_LIB = lua5.1
LIB = core.so
all:
- $(CC) $(CFLAGS) -Iinclude -I$(LUA_INC_DIR) src/*.c
- $(CC) $(LDFLAGS) -o $(LIB) *.o -L$(LUA_LIB_DIR) -l$(LUA_LIB) -levent
+ $(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
- $(INSTALL_DATA) -D lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua
- $(INSTALL_PROGRAM) -D $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB)
+ mkdir -p $(DESTDIR)$(INSTALL_DIR_LUA)
+ $(INSTALL_DATA) lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua
+ mkdir -p $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/
+ $(INSTALL_PROGRAM) $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB)
clean:
- rm *.so
- rm *.o
+ rm -f *.so
+ rm -f *.o