-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
29 lines (22 loc) · 798 Bytes
/
Makefile
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
27
28
29
LUA_CLIB_PATH ?= luaclib
LUA_INC ?= lua53/src
CC ?= gcc
SHARED := -fPIC --shared
CFLAGS = -g -O2 -Wall -I$(LUA_INC) $(MYCFLAGS)
LUA_CLIB = lpeg sproto lfs
PLAT = linux
all : luabin \
$(foreach v, $(LUA_CLIB), $(LUA_CLIB_PATH)/$(v).so)
luabin:
cd lua53 && $(MAKE) $(PLAT) && \
mv src/lua ../example/luabin && \
mv src/luac ../example/luacbin && \
cd ../
$(LUA_CLIB_PATH)/lpeg.so : lpeg/lpcap.c lpeg/lpcode.c lpeg/lpprint.c lpeg/lptree.c lpeg/lpvm.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Ilpeg $^ -o $@
$(LUA_CLIB_PATH)/sproto.so : sproto/sproto.c sproto/lsproto.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Isproto $^ -o $@
$(LUA_CLIB_PATH)/lfs.so : luafilesystem/src/lfs.c | $(LUA_CLIB_PATH)
$(CC) $(CFLAGS) $(SHARED) -Isproto $^ -o $@
clean:
rm -f $(LUA_CLIB_PATH)/*.so