diff --git a/Makefile b/Makefile index b2ee153..9c7a167 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,27 @@ .PHONY: all build_ffi build_godot run_server run_server_build test clean -# Configuration -TARGET = x86_64-unknown-linux-musl -FFI_LIB = ffi-wrapper\target\$(TARGET)\release\libffi_wrapper.a -FFI_HEADER = ffi-wrapper\target\ffi-wrapper.h -GODOT_LIB = godot-extension\target\release\godot_extension.dll -SERVER_LIB_DIR = server\lib +ifeq ($(OS),Windows_NT) + DETECTED_OS = Windows + TARGET = x86_64-unknown-linux-musl + PATH_SEP = \\ + COPY = copy + MKDIR = if not exist "$(SERVER_LIB_DIR)" mkdir "$(SERVER_LIB_DIR)" + RMDIR = if exist "$(SERVER_LIB_DIR)" rmdir /s /q "$(SERVER_LIB_DIR)" +else + DETECTED_OS = POSIX + TARGET = aarch64-unknown-linux-musl + PATH_SEP = / + COPY = cp + MKDIR = mkdir -p "$(SERVER_LIB_DIR)" + RMDIR = rm -rf "$(SERVER_LIB_DIR)" +endif -# Default: Build everything and deploy with build +SERVER_LIB_DIR = server$(PATH_SEP)lib +FFI_LIB = ffi-wrapper$(PATH_SEP)target$(PATH_SEP)$(TARGET)$(PATH_SEP)release$(PATH_SEP)libffi_wrapper.a +FFI_HEADER = ffi-wrapper$(PATH_SEP)target$(PATH_SEP)ffi-wrapper.h +GODOT_LIB = godot-extension$(PATH_SEP)target$(PATH_SEP)release$(PATH_SEP)godot_extension.dll + +# Default: Build everything and deploy server all: build_ffi build_godot run_server_build ## Build Targets ## @@ -26,9 +40,9 @@ run_server: cd server && docker compose up run_server_build: - if not exist $(SERVER_LIB_DIR) mkdir $(SERVER_LIB_DIR) - copy $(FFI_LIB) $(SERVER_LIB_DIR) - copy $(FFI_HEADER) $(SERVER_LIB_DIR) + $(MKDIR) + $(COPY) $(FFI_LIB) $(SERVER_LIB_DIR) + $(COPY) $(FFI_HEADER) $(SERVER_LIB_DIR) cd server && docker compose up --build ## Test Target ## @@ -44,4 +58,4 @@ clean: cd shared && cargo clean cd ffi-wrapper && cargo clean cd godot-extension && cargo clean - if exist $(SERVER_LIB_DIR) rmdir /s /q $(SERVER_LIB_DIR) \ No newline at end of file + $(RMDIR)