SKYNET_ROOT ?= ./skynet/
SKYNET_DEPS ?= ./lualib-src/

PLAT ?= linux
TLS_INC ?= /usr/local/openssl/include
TLS_LIB ?= /usr/local/openssl/lib

ifeq ($(PLAT), macosx)
	TLS_INC=/usr/local/opt/openssl@1.1/include
	TLS_LIB=/usr/local/opt/openssl@1.1/lib
endif

.PHONY: all 

all : runtime deps

runtime:
	git submodule update --init --recursive
	$(MAKE) cleanall
	cd $(SKYNET_ROOT) && $(MAKE) $(PLAT) TLS_MODULE=ltls TLS_INC=$(TLS_INC) TLS_LIB=$(TLS_LIB) -j8

deps:
	cd $(SKYNET_DEPS) && $(MAKE) $(PLAT)

cleanall:
	cd $(SKYNET_ROOT) && $(MAKE) cleanall
	cd $(SKYNET_DEPS) && $(MAKE) cleanall

testluaclib:
	$(SKYNET_ROOT)3rd/lua/lua $(SKYNET_DEPS)testluaclib.lua

simulation:
	$(SKYNET_ROOT)3rd/lua/lua simulation/simulation.lua

#-------------------------------------------------------------#
#-------------------------------------------------------------#
