2023-02-21 15:28:45 -05:00
|
|
|
#######################################################################
|
|
|
|
|
##
|
|
|
|
|
## Auto detect Operating System
|
|
|
|
|
##
|
|
|
|
|
#######################################################################
|
2023-02-20 16:02:18 -05:00
|
|
|
|
2023-02-20 17:47:22 -05:00
|
|
|
ifneq "" "$(findstring -linux-,$(MAKE_HOST))"
|
2023-05-08 21:58:26 -04:00
|
|
|
OS=linux
|
2023-05-09 22:12:17 -04:00
|
|
|
else ifneq "" "$(VSINSTALLDIR)"
|
|
|
|
|
OS=visual
|
2023-02-20 17:47:22 -05:00
|
|
|
else ifneq "" "$(findstring cmd.exe,$(COMSPEC))"
|
2023-05-08 21:58:26 -04:00
|
|
|
OS=mingw
|
2023-05-09 23:27:22 -04:00
|
|
|
else
|
|
|
|
|
OS=""
|
2023-05-08 21:58:26 -04:00
|
|
|
endif
|
2023-02-21 15:28:45 -05:00
|
|
|
|
2023-05-08 21:58:26 -04:00
|
|
|
ifeq "$(OS)" ""
|
|
|
|
|
$(error Cannot figure out which OS to build for."
|
2023-02-20 16:59:10 -05:00
|
|
|
endif
|
2023-02-21 15:28:45 -05:00
|
|
|
$(info Building for $(OS)...)
|
2023-02-20 16:59:10 -05:00
|
|
|
|
2023-02-14 14:05:45 -05:00
|
|
|
|
2023-02-21 15:28:45 -05:00
|
|
|
#######################################################################
|
|
|
|
|
##
|
|
|
|
|
## List of all OBJ files
|
|
|
|
|
##
|
|
|
|
|
#######################################################################
|
2023-02-20 17:53:18 -05:00
|
|
|
|
2023-02-14 14:05:45 -05:00
|
|
|
OBJ_ERIS=\
|
2023-06-08 16:31:38 -04:00
|
|
|
build/$(OS)/eris/lapi.obj \
|
|
|
|
|
build/$(OS)/eris/lcode.obj \
|
|
|
|
|
build/$(OS)/eris/lctype.obj \
|
|
|
|
|
build/$(OS)/eris/ldebug.obj \
|
|
|
|
|
build/$(OS)/eris/ldo.obj \
|
|
|
|
|
build/$(OS)/eris/ldump.obj \
|
|
|
|
|
build/$(OS)/eris/lfunc.obj \
|
|
|
|
|
build/$(OS)/eris/lgc.obj \
|
|
|
|
|
build/$(OS)/eris/llex.obj \
|
|
|
|
|
build/$(OS)/eris/lmem.obj \
|
|
|
|
|
build/$(OS)/eris/lobject.obj \
|
|
|
|
|
build/$(OS)/eris/lopcodes.obj \
|
|
|
|
|
build/$(OS)/eris/lparser.obj \
|
|
|
|
|
build/$(OS)/eris/lstate.obj \
|
|
|
|
|
build/$(OS)/eris/lstring.obj \
|
|
|
|
|
build/$(OS)/eris/ltable.obj \
|
|
|
|
|
build/$(OS)/eris/ltm.obj \
|
|
|
|
|
build/$(OS)/eris/lundump.obj \
|
|
|
|
|
build/$(OS)/eris/lvm.obj \
|
|
|
|
|
build/$(OS)/eris/lzio.obj \
|
|
|
|
|
build/$(OS)/eris/lauxlib.obj \
|
|
|
|
|
build/$(OS)/eris/lbaselib.obj \
|
|
|
|
|
build/$(OS)/eris/lbitlib.obj \
|
|
|
|
|
build/$(OS)/eris/lcorolib.obj \
|
|
|
|
|
build/$(OS)/eris/ldblib.obj \
|
|
|
|
|
build/$(OS)/eris/liolib.obj \
|
|
|
|
|
build/$(OS)/eris/lmathlib.obj \
|
|
|
|
|
build/$(OS)/eris/loslib.obj \
|
|
|
|
|
build/$(OS)/eris/lstrlib.obj \
|
|
|
|
|
build/$(OS)/eris/ltablib.obj \
|
|
|
|
|
build/$(OS)/eris/loadlib.obj \
|
|
|
|
|
build/$(OS)/eris/linit.obj \
|
|
|
|
|
build/$(OS)/eris/eris.obj \
|
2023-02-14 14:05:45 -05:00
|
|
|
|
|
|
|
|
OBJ_CORE=\
|
2023-06-08 16:31:38 -04:00
|
|
|
build/$(OS)/core/invocation.obj\
|
|
|
|
|
build/$(OS)/core/spookyv2.obj\
|
|
|
|
|
build/$(OS)/core/eng-malloc.obj\
|
|
|
|
|
build/$(OS)/core/debugcollector.obj\
|
|
|
|
|
build/$(OS)/core/drivenengine.obj\
|
|
|
|
|
build/$(OS)/core/util.obj\
|
|
|
|
|
build/$(OS)/core/luastack.obj\
|
|
|
|
|
build/$(OS)/core/traceback.obj\
|
|
|
|
|
build/$(OS)/core/planemap.obj\
|
|
|
|
|
build/$(OS)/core/pprint.obj\
|
|
|
|
|
build/$(OS)/core/luaconsole.obj\
|
|
|
|
|
build/$(OS)/core/idalloc.obj\
|
|
|
|
|
build/$(OS)/core/globaldb.obj\
|
|
|
|
|
build/$(OS)/core/sched.obj\
|
|
|
|
|
build/$(OS)/core/http.obj\
|
|
|
|
|
build/$(OS)/core/json.obj\
|
|
|
|
|
build/$(OS)/core/table.obj\
|
|
|
|
|
build/$(OS)/core/luasnap.obj\
|
|
|
|
|
build/$(OS)/core/animqueue.obj\
|
|
|
|
|
build/$(OS)/core/streambuffer.obj\
|
|
|
|
|
build/$(OS)/core/source.obj\
|
|
|
|
|
build/$(OS)/core/world-core.obj\
|
|
|
|
|
build/$(OS)/core/world-accessor.obj\
|
|
|
|
|
build/$(OS)/core/world-difftab.obj\
|
|
|
|
|
build/$(OS)/core/world-diffxmit.obj\
|
|
|
|
|
build/$(OS)/core/world-pairtab.obj\
|
|
|
|
|
build/$(OS)/core/world-testing.obj\
|
|
|
|
|
build/$(OS)/core/lpxserver.obj\
|
|
|
|
|
build/$(OS)/core/lpxclient.obj\
|
|
|
|
|
build/$(OS)/core/eng-tests.obj\
|
|
|
|
|
build/$(OS)/core/printbuffer.obj\
|
|
|
|
|
build/$(OS)/core/serializelua.obj\
|
2023-02-14 14:05:45 -05:00
|
|
|
|
2023-05-08 21:58:26 -04:00
|
|
|
|
2023-02-14 14:05:45 -05:00
|
|
|
OBJ_DRV=\
|
2023-06-08 16:31:38 -04:00
|
|
|
build/$(OS)/drv/driver.obj\
|
|
|
|
|
build/$(OS)/drv/drvutil.obj\
|
|
|
|
|
build/$(OS)/drv/osdrvutil.obj\
|
|
|
|
|
build/$(OS)/drv/sslutil.obj\
|
|
|
|
|
build/$(OS)/drv/readline.obj\
|
2023-02-14 14:05:45 -05:00
|
|
|
|
|
|
|
|
|
2023-02-21 15:28:45 -05:00
|
|
|
#######################################################################
|
|
|
|
|
##
|
2023-05-08 21:58:26 -04:00
|
|
|
## Make rules for linux
|
2023-02-21 15:28:45 -05:00
|
|
|
##
|
|
|
|
|
#######################################################################
|
|
|
|
|
|
2023-05-08 21:58:26 -04:00
|
|
|
ifeq "$(OS)" "linux"
|
2023-05-09 23:24:25 -04:00
|
|
|
OPT=-g -O0
|
|
|
|
|
LUPREX_EXE=luprex
|
|
|
|
|
LUPREXLIB_DLL=luprexlib.so
|
|
|
|
|
LUPREXSTATIC_EXE=luprexstatic
|
|
|
|
|
COMPILE=g++ -Wall $(OPT) -std=c++17 -fvisibility=hidden -c -MMD -fPIC -o
|
|
|
|
|
LINKDLL=g++ -Wall $(OPT) -std=c++17 -export-dynamic -Wl,--no-allow-shlib-undefined -Wl,-z,defs -shared -o
|
|
|
|
|
LINKEXE=g++ -Wall $(OPT) -std=c++17 -o
|
2023-05-10 14:09:08 -04:00
|
|
|
MAKEDEPS=true
|
2023-05-09 23:24:25 -04:00
|
|
|
OPENSSL_INCLUDE=-I./ext/openssl-3.0.1/inc
|
|
|
|
|
LUA_FLAGS=-DLUA_USE_APICHECK -DLUA_USE_POSIX
|
|
|
|
|
LIBS=-L./ext/openssl-3.0.1/lib/linux -lssl -lcrypto -ldl
|
2023-05-08 21:58:26 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
|
##
|
|
|
|
|
## Make rules for mingw
|
|
|
|
|
##
|
|
|
|
|
#######################################################################
|
|
|
|
|
|
|
|
|
|
ifeq "$(OS)" "mingw"
|
2023-05-09 23:24:25 -04:00
|
|
|
OPT=-g -O0
|
|
|
|
|
LUPREX_EXE=luprex.exe
|
|
|
|
|
LUPREXLIB_DLL=luprexlib.dll
|
|
|
|
|
LUPREXSTATIC_EXE=luprexstatic.exe
|
|
|
|
|
COMPILE=g++ -Wall $(OPT) -std=c++17 -fvisibility=hidden -c -MMD -fPIC -o
|
|
|
|
|
LINKDLL=g++ -Wall $(OPT) -std=c++17 -Wl,--no-allow-shlib-undefined -shared -o
|
|
|
|
|
LINKEXE=g++ -Wall $(OPT) -std=c++17 -o
|
2023-05-10 14:09:08 -04:00
|
|
|
MAKEDEPS=true
|
2023-05-09 23:24:25 -04:00
|
|
|
OPENSSL_INCLUDE=-I./ext/openssl-3.0.1/inc
|
|
|
|
|
LUA_FLAGS=-DLUA_USE_APICHECK -DLUA_COMPAT_ALL
|
|
|
|
|
LIBS=-L./ext/openssl-3.0.1/lib/mingw -lssl -lcrypto -lws2_32 -lcrypt32 -lcryptui
|
2023-05-08 21:58:26 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
2023-05-09 22:12:17 -04:00
|
|
|
#######################################################################
|
|
|
|
|
##
|
|
|
|
|
## Make rules for visual
|
|
|
|
|
##
|
|
|
|
|
#######################################################################
|
|
|
|
|
|
|
|
|
|
ifeq "$(OS)" "visual"
|
2023-05-09 23:24:25 -04:00
|
|
|
ifeq "" "$(VSINSTALLDIR)"
|
|
|
|
|
$(error You must use vcvars64.bat to set up the visual studio environment variables)
|
|
|
|
|
endif
|
|
|
|
|
OPT=/Od /Zi
|
|
|
|
|
LUPREX_EXE=luprex.exe
|
|
|
|
|
LUPREXLIB_DLL=luprexlib.dll
|
|
|
|
|
LUPREXSTATIC_EXE=luprexstatic.exe
|
|
|
|
|
COMPILE=CL $(OPT) /std:c++17 /EHsc /nologo /MD /TP /c /Fo:
|
|
|
|
|
LINKDLL=CL $(OPT) /std:c++17 /EHsc /nologo /LDd /Fe:
|
|
|
|
|
LINKEXE=CL $(OPT) /std:c++17 /EHsc /nologo /Fe:
|
2023-05-10 14:09:08 -04:00
|
|
|
MAKEDEPS=g++ -Wall -std=c++17 -MMD -E -o
|
2023-05-09 23:24:25 -04:00
|
|
|
OPENSSL_INCLUDE=-I./ext/openssl-3.1.0/inc
|
|
|
|
|
LUA_FLAGS=-DLUA_USE_APICHECK -DLUA_COMPAT_ALL
|
|
|
|
|
LIBS=ext/openssl-3.1.0/lib/visual/libcrypto.lib ext/openssl-3.1.0/lib/visual/libssl.lib ws2_32.lib crypt32.lib cryptui.lib user32.lib advapi32.lib
|
2023-05-09 22:14:29 -04:00
|
|
|
endif
|
|
|
|
|
|
2023-05-09 23:24:25 -04:00
|
|
|
#######################################################################
|
|
|
|
|
##
|
|
|
|
|
## Make Rules
|
|
|
|
|
##
|
|
|
|
|
#######################################################################
|
2023-05-09 22:12:17 -04:00
|
|
|
|
2023-05-10 14:09:08 -04:00
|
|
|
all: build/$(OS)/$(LUPREX_EXE) build/$(OS)/$(LUPREXSTATIC_EXE) build/$(OS)/$(LUPREXLIB_DLL)
|
2023-05-09 22:12:17 -04:00
|
|
|
|
2023-07-03 15:25:45 -04:00
|
|
|
build/$(OS)/DIRECTORY:
|
2023-06-08 16:31:38 -04:00
|
|
|
mkdir -p build/$(OS)/core build/$(OS)/eris build/$(OS)/drv
|
2023-07-03 15:25:45 -04:00
|
|
|
touch build/$(OS)/DIRECTORY
|
2023-06-08 16:31:38 -04:00
|
|
|
|
2023-05-10 14:09:08 -04:00
|
|
|
build/$(OS)/$(LUPREX_EXE): build/$(OS)/$(LUPREXLIB_DLL) $(OBJ_DRV)
|
|
|
|
|
$(LINKEXE) $@ $(OBJ_DRV) $(LIBS)
|
2023-05-09 22:12:17 -04:00
|
|
|
|
2023-05-10 14:09:08 -04:00
|
|
|
build/$(OS)/$(LUPREXSTATIC_EXE): $(OBJ_DRV) $(OBJ_ERIS) $(OBJ_CORE)
|
2023-05-09 23:24:25 -04:00
|
|
|
$(LINKEXE) $@ $^ $(LIBS)
|
2023-05-09 18:43:40 -04:00
|
|
|
|
2023-05-10 14:09:08 -04:00
|
|
|
build/$(OS)/$(LUPREXLIB_DLL): $(OBJ_ERIS) $(OBJ_CORE)
|
2023-05-09 23:24:25 -04:00
|
|
|
$(LINKDLL) $@ $^
|
2023-05-09 22:12:17 -04:00
|
|
|
|
2023-07-03 15:25:45 -04:00
|
|
|
build/$(OS)/eris/%.obj: ext/eris-master/src/%.c build/$(OS)/DIRECTORY
|
2023-05-09 23:24:25 -04:00
|
|
|
$(MAKEDEPS) $@d $(LUA_FLAGS) $<
|
|
|
|
|
$(COMPILE) $@ $(LUA_FLAGS) $<
|
2023-05-09 22:12:17 -04:00
|
|
|
|
2023-07-03 15:25:45 -04:00
|
|
|
build/$(OS)/core/%.obj: cpp/core/%.cpp build/$(OS)/DIRECTORY
|
2023-07-25 16:22:51 -04:00
|
|
|
$(MAKEDEPS) $@d -I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -I./ext $<
|
|
|
|
|
$(COMPILE) $@ -I./ext/eris-master/src -I./cpp/wrap -I./cpp/core -I./ext $<
|
2023-05-09 22:12:17 -04:00
|
|
|
|
2023-07-03 15:25:45 -04:00
|
|
|
build/$(OS)/drv/%.obj: cpp/drv/%.cpp build/$(OS)/DIRECTORY
|
2023-07-25 16:22:51 -04:00
|
|
|
$(MAKEDEPS) $@d $(OPENSSL_INCLUDE) -I./src/drv -I./ext $<
|
|
|
|
|
$(COMPILE) $@ $(OPENSSL_INCLUDE) -I./src/drv -I./ext $<
|
2023-02-21 15:28:45 -05:00
|
|
|
|
2023-05-08 21:58:26 -04:00
|
|
|
clean:
|
2023-06-08 16:31:38 -04:00
|
|
|
rm -f luprex* luprex*.* *.pdb
|
|
|
|
|
rm -rf build
|
2023-05-10 14:09:08 -04:00
|
|
|
|
|
|
|
|
clean-os:
|
2023-06-08 16:31:38 -04:00
|
|
|
rm -f luprex* luprex*.* *.pdb build/$(OS)/* build/$(OS)/*/*
|
2023-02-21 15:28:45 -05:00
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
|
##
|
|
|
|
|
## Automatically generated Make Dependencies
|
|
|
|
|
##
|
|
|
|
|
#######################################################################
|
2023-02-14 14:05:45 -05:00
|
|
|
|
2023-05-09 22:12:17 -04:00
|
|
|
-include $(OBJ_ERIS:%.obj=%.d)
|
|
|
|
|
-include $(OBJ_CORE:%.obj=%.d)
|
|
|
|
|
-include $(OBJ_DRV:%.obj=%.d)
|
2023-02-14 14:05:45 -05:00
|
|
|
|