aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 0e37c269bc0c7ab66a0c316845d942b87bc7aae4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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) $(LUA_LIBDIR) $(UUID_LIBDIR) $< -o $@
	$(LUA) test/lua_uuid_test.lua

%.o: %.c
	$(CC) -c $(CFLAGS) -fPIC $(LUA_INCDIR) $(UUID_INCDIR) $< -o $@

install: lua_uuid.so
	cp lua_uuid.so $(INST_LIBDIR)

clean:
	rm -f *.so *.o *.rock