-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
42 lines (34 loc) · 982 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
30
31
32
33
34
35
36
37
38
39
40
41
42
ifeq (,$(findstring Windows,$(OS)))
HOST_SYS:= $(shell uname -s)
else
HOST_SYS= Windows
endif
TARGET_SYS?= $(HOST_SYS)
ifeq (Darwin,$(TARGET_SYS))
MAKE_FLAG=MACOSX_DEPLOYMENT_TARGET=12.6
endif
all: dir build_luajit fd_poll tcp buffer signal
dir:
mkdir -p libc
build_luajit:
echo "foo"
if test -d "./luajit" ; \
then echo "luajit Dir exists"; \
else \
curl -o luajit.tar.gz https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz; \
tar -xzvf luajit.tar.gz; \
mv LuaJIT-2.1.0-beta3 luajit; \
rm -f luajit.tar.gz; \
echo "compile luajit"; \
fi
cd luajit && make $(MAKE_FLAG);
CCFlags := -Wall -Werror -std=gnu99 -g -fPIC -I luajit/src -I ./src/net -Wl,-undefined -Wl,dynamic_lookup
fd_poll tcp:
$(CC) -o libc/$@.so $(CCFlags) -shared src/luawrap/lua_$@.c -dynamiclib src/net/$@.c
buffer signal:
$(CC) -o libc/$@.so $(CCFlags) -shared src/luawrap/lua_$@.c
clean:
rm -rf libc
cd luajit && make clean
run:
./luajit/src/luajit ./example/echo_svr.lua