mirror of
https://github.com/lxsang/antd-lua-plugin
synced 2024-12-28 18:38:20 +01:00
76 lines
1.6 KiB
Makefile
76 lines
1.6 KiB
Makefile
|
include ../../var.mk
|
||
|
ifeq ($(UNAME_S),Linux)
|
||
|
FL_LUA=linux
|
||
|
LUA_LIB=lua-api.dylib libantd.dylib -lm -lcrypt
|
||
|
endif
|
||
|
ifeq ($(UNAME_S),Darwin)
|
||
|
FL_LUA=macosx
|
||
|
LUA_LIB= lua-api.dylib libantd.dylib -lm
|
||
|
endif
|
||
|
LUA_H= -I../../3rd/lua-5.3.4/
|
||
|
|
||
|
PL_NAME=lua-api
|
||
|
PLUGINS=$(PL_NAME).$(EXT)
|
||
|
LLIBS=wurl.llib ulib.llib ann.llib stmr.llib #pibot.llib
|
||
|
|
||
|
OBJS = $(PLUGINS_BASE)/plugin.o
|
||
|
|
||
|
PLUGINSDEP = $(OBJS) \
|
||
|
$(WRAPI) \
|
||
|
plugin-wrapper.o\
|
||
|
3rd/jsmn/jsmn.o \
|
||
|
array-wrapper.o \
|
||
|
json-wrapper.o \
|
||
|
db-wrapper.o
|
||
|
|
||
|
PLUGINLIBS = -lm -lpthread -lsqlite3 libantd.$(EXT)
|
||
|
|
||
|
PCFLAGS=-W -Wall -g -std=c99 -D DEBUG $(PPF_FLAG) -D USE_DB
|
||
|
main: lua $(PLUGINSDEP) $(PLUGINS) api lib
|
||
|
lua:
|
||
|
cd 3rd/lua-5.3.4 && make $(FL_LUA)
|
||
|
%.o: %.c
|
||
|
$(CC) $(PCFLAGS) -fPIC $(INCFLAG) -c $< -o $@
|
||
|
|
||
|
%.$(EXT): %.o
|
||
|
-ln -s $(PBUILDIRD)/libantd.$(EXT) .
|
||
|
$(CC) $(PCFLAGS) $(PLUGINLIBS) -shared -o $(PBUILDIRD)/$(basename $@).$(EXT) \
|
||
|
$(PLUGINSDEP) $(basename $@).o 3rd/lua-5.3.4/liblua.a
|
||
|
|
||
|
deepclean: luaclean clean
|
||
|
|
||
|
clean: libclean
|
||
|
-rm -f *.o 3rd/jsmn/*.o *.$(EXT) $(PBUILDIRD)/$(PLUGINS)
|
||
|
-rm $(PLUGINS_BASE)/plugin.o
|
||
|
-rm $(PBUILDIRD)/$(PL_NAME)/*.$(LIB_EXT)
|
||
|
|
||
|
libclean:
|
||
|
for file in lib/* ;do \
|
||
|
if [ -d "$$file" ]; then \
|
||
|
echo "Cleaning $$file" ;\
|
||
|
make -C "$$file" clean; \
|
||
|
fi \
|
||
|
done
|
||
|
|
||
|
luaclean:
|
||
|
- cd 3rd/lua-5.3.4 && make clean
|
||
|
|
||
|
lib:$(LLIBS)
|
||
|
|
||
|
%.llib:
|
||
|
-ln -s $(PBUILDIRD)/libantd.$(EXT) lib/$(basename $@)
|
||
|
-ln -s $(PBUILDIRD)/$(PLUGINS) lib/$(basename $@)
|
||
|
-cd lib/$(basename $@) && make
|
||
|
|
||
|
api:
|
||
|
-mkdir $(PBUILDIRD)/$(PL_NAME)
|
||
|
cp APIs/*.lua $(PBUILDIRD)/$(PL_NAME)
|
||
|
app:
|
||
|
cp -rf example-app/* $(APP_DIR)
|
||
|
.PRECIOUS: %.o
|
||
|
.PHONY: lib clean
|
||
|
full: clean main
|
||
|
|
||
|
|
||
|
|