Convert to a true DLL engine
This commit is contained in:
@@ -1,23 +1,42 @@
|
||||
#######################################################################
|
||||
##
|
||||
## Auto detect Operating System
|
||||
##
|
||||
#######################################################################
|
||||
|
||||
ifneq "" "$(findstring -linux-,$(MAKE_HOST))"
|
||||
|
||||
OS=linux
|
||||
EXE=main
|
||||
LIBS=-L./ext/openssl-linux -lssl -lcrypto -ldl
|
||||
EXE=luprex
|
||||
DLL=luprex.so
|
||||
LIBS=-L./ext/openssl-mingw -lssl -lcrypto -ldl
|
||||
LUAFLAGS=-DLUA_USE_APICHECK -DLUA_USE_POSIX
|
||||
OPT=-g -O0
|
||||
|
||||
else ifneq "" "$(findstring cmd.exe,$(COMSPEC))"
|
||||
|
||||
OS=mingw
|
||||
EXE=main.exe
|
||||
EXE=luprex.exe
|
||||
DLL=luprex.dll
|
||||
LIBS=-L./ext/openssl-mingw -lssl -lcrypto -lws2_32 -lcrypt32 -lcryptui
|
||||
LUAFLAGS=-DLUA_USE_APICHECK -DLUA_COMPAT_ALL
|
||||
OPT=-g -O0
|
||||
|
||||
else
|
||||
|
||||
$(error Cannot figure out whether to build the linux or mingw version)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
$(info Building for $(OS)...)
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
##
|
||||
## List of all OBJ files
|
||||
##
|
||||
#######################################################################
|
||||
|
||||
OBJ_ERIS=\
|
||||
obj/eris/lapi.o \
|
||||
obj/eris/lcode.o \
|
||||
@@ -91,25 +110,47 @@ OBJ_CORE=\
|
||||
OBJ_DRV=\
|
||||
obj/drv/drvutil.o\
|
||||
obj/drv/sslutil.o\
|
||||
obj/drv/driver-$(OS).o
|
||||
obj/drv/driver-$(OS).o\
|
||||
|
||||
|
||||
|
||||
$(EXE): $(OBJ_ERIS) $(OBJ_CORE) $(OBJ_DRV)
|
||||
g++ $(OPT) -std=c++17 -export-dynamic -Wall -o $@ $(OBJ_ERIS) $(OBJ_CORE) $(OBJ_DRV) $(LIBS)
|
||||
#######################################################################
|
||||
##
|
||||
## Make rules
|
||||
##
|
||||
#######################################################################
|
||||
|
||||
GPP=g++ -Wall -fvisibility=hidden $(OPT) -std=c++17 -MMD
|
||||
|
||||
all: $(EXE) $(DLL)
|
||||
|
||||
$(EXE): $(OBJ_DRV)
|
||||
$(GPP) -o $@ $(OBJ_DRV) -L./ext/openssl-linux -lssl -lcrypto -ldl
|
||||
|
||||
$(DLL): $(OBJ_ERIS) $(OBJ_CORE)
|
||||
$(GPP) -export-dynamic -Wl,--no-allow-shlib-undefined -Wl,-z,defs -shared -o $@ $^
|
||||
|
||||
obj/eris/%.o: ext/eris-master/src/%.c
|
||||
gcc $(OPT) -Wall -fvisibility=hidden $(LUAFLAGS) -c -MMD $< -o $@
|
||||
$(GPP) -fPIC $(LUAFLAGS) -o $@ -c $<
|
||||
|
||||
obj/core/%.o: cpp/core/%.cpp
|
||||
g++ $(OPT) -Wall -fvisibility=hidden -std=c++17 -I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -c -MMD $< -o $@
|
||||
$(GPP) -fPIC -I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -o $@ -c $<
|
||||
|
||||
obj/drv/%.o: cpp/drv/%.cpp
|
||||
g++ $(OPT) -Wall -fvisibility=hidden -std=c++17 -I./ext -I./src/drv -c -MMD $< -o $@
|
||||
$(GPP) -I./ext -I./src/drv -o $@ -c $<
|
||||
|
||||
clean:
|
||||
rm -f main.exe main obj/core/*.* obj/drv/*.* obj/eris/*.*
|
||||
rm -f luprex luprex.exe luprex.so luprex.dll obj/core/*.* obj/drv/*.* obj/eris/*.*
|
||||
|
||||
|
||||
|
||||
#######################################################################
|
||||
##
|
||||
## Automatically generated Make Dependencies
|
||||
##
|
||||
#######################################################################
|
||||
|
||||
-include $(OBJ_ERIS:%.o=%.d)
|
||||
-include $(OBJ_ERIS:%.o=%.d)
|
||||
-include $(OBJ_CORE:%.o=%.d)
|
||||
-include $(OBJ_DRV:%.o=%.d)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user