Merge branch 'release/0.4.6'
[luaevent.git] / Makefile
blob611d705294b00dc0e64cb5aac6a9d95e3c0fe79c
1 .PHONY: all install clean dist dist-all dist-bzip2 dist-gzip dist-zip
3 DIST_DIR=dist
5 # Utilities
6 INSTALL = install
7 INSTALL_PROGRAM = $(INSTALL)
8 INSTALL_DATA = $(INSTALL) -m 644
10 # Flags
11 CFLAGS = -Wall -fpic
12 LDFLAGS = -shared
14 # Directories
15 LUA_INC_DIR ?= /usr/include/lua5.1
17 INSTALL_DIR_LUA ?= /usr/share/lua/5.1
18 INSTALL_DIR_BIN ?= /usr/lib/lua/5.1
20 # Files
21 LIB = core.so
23 all:
24 $(CC) $(CFLAGS) -c -Iinclude -I$(LUA_INC_DIR) src/*.c
25 $(CC) $(LDFLAGS) -o $(LIB) *.o -levent
27 dist dist-all: distdir dist-bzip2 dist-gzip dist-zip
29 distdir:
30 mkdir -p $(DIST_DIR)
32 VERSION=luaevent-$(shell git describe --abbrev=4 HEAD 2>/dev/null)
33 dist-bzip2: distdir
34 git archive --format=tar --prefix=$(VERSION)/ HEAD | bzip2 -9v > $(DIST_DIR)/$(VERSION).tar.bz2
35 dist-gzip: distdir
36 git archive --format=tar --prefix=$(VERSION)/ HEAD | gzip -9v > $(DIST_DIR)/$(VERSION).tar.gz
37 dist-zip: distdir
38 git archive --format=zip --prefix=$(VERSION)/ HEAD > $(DIST_DIR)/$(VERSION).zip
40 install: all
41 mkdir -p $(DESTDIR)$(INSTALL_DIR_LUA)
42 $(INSTALL_DATA) lua/luaevent.lua $(DESTDIR)$(INSTALL_DIR_LUA)/luaevent.lua
43 mkdir -p $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/
44 $(INSTALL_PROGRAM) $(LIB) $(DESTDIR)$(INSTALL_DIR_BIN)/luaevent/$(LIB)
46 clean:
47 rm -f *.so
48 rm -f *.o