diff --git a/luprex/.gitattributes b/luprex/.gitattributes index c8c6a2b1..a9b00949 100644 --- a/luprex/.gitattributes +++ b/luprex/.gitattributes @@ -7,7 +7,7 @@ *.a binary *.lib binary *.o binary -*.obj binary +*.exe binary *.bat text eol=crlf *.a filter=lfs diff=lfs merge=lfs -text *.lib filter=lfs diff=lfs merge=lfs -text diff --git a/luprex/.gitignore b/luprex/.gitignore index 273f56b6..28562f3b 100644 --- a/luprex/.gitignore +++ b/luprex/.gitignore @@ -10,6 +10,7 @@ luprex *.o *.dll *.exe +*.pdb *.so *.a diff --git a/luprex/Makefile b/luprex/Makefile index ea27acf4..70e0cdf7 100644 --- a/luprex/Makefile +++ b/luprex/Makefile @@ -5,34 +5,17 @@ ####################################################################### ifneq "" "$(findstring -linux-,$(MAKE_HOST))" - - OS=linux - EXE=luprex - DLL=luprex.so - LIBS=-L./ext/openssl-linux -lssl -lcrypto -ldl - LUAFLAGS=-DLUA_USE_APICHECK -DLUA_USE_POSIX - LINKDLL=-export-dynamic -Wl,--no-allow-shlib-undefined -Wl,-z,defs -shared - OPT=-g -O0 - + OS=linux else ifneq "" "$(findstring cmd.exe,$(COMSPEC))" + OS=mingw +endif - OS=mingw - EXE=luprex.exe - DLL=luprex.dll - LIBS=-L./ext/openssl-mingw -lssl -lcrypto -lws2_32 -lcrypt32 -lcryptui - LUAFLAGS=-DLUA_USE_APICHECK -DLUA_COMPAT_ALL - LINKDLL=-Wl,--no-allow-shlib-undefined -shared - OPT=-g -O0 - -else - - $(error Cannot figure out whether to build the linux or mingw version) - +ifeq "$(OS)" "" + $(error Cannot figure out which OS to build for." endif $(info Building for $(OS)...) - ####################################################################### ## ## List of all OBJ files @@ -110,46 +93,85 @@ OBJ_CORE=\ obj/core/printbuffer.o\ obj/core/serializelua.o\ + OBJ_DRV=\ obj/drv/drvutil.o\ obj/drv/sslutil.o\ obj/drv/driver-$(OS).o\ - ####################################################################### ## -## Make rules +## Make rules for linux ## ####################################################################### + +ifeq "$(OS)" "linux" + +OPT=-g -O0 GPP=g++ -Wall -fvisibility=hidden $(OPT) -std=c++17 -MMD -all: $(EXE) $(DLL) +luprex: $(OBJ_DRV) luprexlib.so + $(GPP) -o $@ $(OBJ_DRV) -L./ext/openssl-linux -lssl -lcrypto -ldl -$(EXE): $(OBJ_DRV) - $(GPP) -o $@ $(OBJ_DRV) $(LIBS) - -$(DLL): $(OBJ_ERIS) $(OBJ_CORE) - $(GPP) $(LINKDLL) -o $@ $^ +luprexlib.so: $(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 - $(GPP) -fPIC $(LUAFLAGS) -o $@ -c $< + $(GPP) -fPIC -DLUA_USE_APICHECK -DLUA_USE_POSIX -o $@ -c $< obj/core/%.o: cpp/core/%.cpp $(GPP) -fPIC -I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -o $@ -c $< -obj/core/%.s: cpp/core/%.cpp - $(GPP) -S -fPIC -I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -o $@ -c $< +obj/drv/%.o: cpp/drv/%.cpp + $(GPP) -I./ext -I./src/drv -o $@ -c $< + +endif + + +####################################################################### +## +## Make rules for mingw +## +####################################################################### + +ifeq "$(OS)" "mingw" + +OPT=-g -O0 +GPP=g++ -Wall -fvisibility=hidden $(OPT) -std=c++17 -MMD + +luprex.exe: $(OBJ_DRV) luprexlib.dll + $(GPP) -o $@ $(OBJ_DRV) -L./ext/openssl-mingw -lssl -lcrypto -lws2_32 -lcrypt32 -lcryptui + ext/cv2pdb.exe luprex.exe + +luprexlib.dll: $(OBJ_ERIS) $(OBJ_CORE) + $(GPP) -Wl,--no-allow-shlib-undefined -shared -o $@ $^ + ext/cv2pdb.exe luprexlib.dll + +obj/eris/%.o: ext/eris-master/src/%.c + $(GPP) -fPIC -DLUA_USE_APICHECK -DLUA_COMPAT_ALL -o $@ -c $< + +obj/core/%.o: cpp/core/%.cpp + $(GPP) -fPIC -I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -o $@ -c $< obj/drv/%.o: cpp/drv/%.cpp $(GPP) -I./ext -I./src/drv -o $@ -c $< -clean: - rm -f luprex luprex.exe luprex.so luprex.dll obj/core/*.* obj/drv/*.* obj/eris/*.* +endif +####################################################################### +## +## Make Clean, deliberately OS independent +## +####################################################################### + +clean: + rm -f luprex luprex.exe luprex.so luprexlib.dll *.pdb obj/core/*.* obj/drv/*.* obj/eris/*.* + + ####################################################################### ## ## Automatically generated Make Dependencies diff --git a/luprex/ext/cv2pdb.exe b/luprex/ext/cv2pdb.exe new file mode 100644 index 00000000..12594140 --- /dev/null +++ b/luprex/ext/cv2pdb.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b1f26a96ad8b6401469ef245eb4070485c4feafe875c77ce9bc505f57388653 +size 368128