aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorThibault Charbonnier <thibaultcha@me.com>2015-11-13 18:50:48 -0800
committerThibault Charbonnier <thibaultcha@me.com>2015-11-13 20:44:39 -0800
commite803e0c1dcb7dbb0c6cb85e3ae26925c2b687543 (patch)
tree99a724c9a15d7cca214f3a6c533ee35f2ec1c518 /Makefile
parent54af6a4aecdca9f0b8df5d2425da82b1e31b03d5 (diff)
downloadlua_uuid-e803e0c1dcb7dbb0c6cb85e3ae26925c2b687543.tar.gz
lua_uuid-e803e0c1dcb7dbb0c6cb85e3ae26925c2b687543.tar.bz2
lua_uuid-e803e0c1dcb7dbb0c6cb85e3ae26925c2b687543.zip
chore(makefile) fixes
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 17 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index fb6e6ca..0e37c26 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,26 @@
+LUA ?= lua5.1
+LUA_LIBDIR ?= $(shell pkg-config $(LUA) --libs)
+LUA_INCDIR ?= $(shell pkg-config $(LUA) --cflags)
+
+UUID_LIBDIR ?= $(shell pkg-config uuid --libs)
+UUID_INCDIR ?= $(shell pkg-config uuid --cflags)
+
+LIBFLAG ?= -shared
+CFLAGS ?= -O2 -Wall -Werror
+
+.PHONY: all clean install
+
all: lua_uuid.so
lua_uuid.so: lua_uuid.o
- $(CC) $(LIBFLAG) -luuid -o $@ -L$(LUA_LIBDIR) $<
+ $(CC) $(LIBFLAG) $(LUA_LIBDIR) $(UUID_LIBDIR) $< -o $@
+ $(LUA) test/lua_uuid_test.lua
-lua_uuid.o: lua_uuid.c
- $(CC) -c $(CFLAGS) -I$(LUA_INCDIR) $< -o $@
+%.o: %.c
+ $(CC) -c $(CFLAGS) -fPIC $(LUA_INCDIR) $(UUID_INCDIR) $< -o $@
install: lua_uuid.so
cp lua_uuid.so $(INST_LIBDIR)
clean:
- rm -f lua_uuid.so lua_uuid.o *.rock
+ rm -f *.so *.o *.rock