summaryrefslogtreecommitdiff
path: root/wrappers/swift/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'wrappers/swift/Makefile')
-rw-r--r--wrappers/swift/Makefile33
1 files changed, 21 insertions, 12 deletions
diff --git a/wrappers/swift/Makefile b/wrappers/swift/Makefile
index 84b3cc1..b46a177 100644
--- a/wrappers/swift/Makefile
+++ b/wrappers/swift/Makefile
@@ -1,24 +1,33 @@
-.PHONY: build test clean
+.PHONY: build test install-header clean
-ifneq (clean,$(MAKECMDGOALS))
-include ../../exports/platform.mk
+EXPORTS_PATH ?= ../../exports
+EXPORTS_LIB_PATH ?= $(EXPORTS_PATH)/lib
-ifeq (Windows_NT,$(OS))
+ifneq ($(MAKECMDGOALS),clean)
+include $(EXPORTS_PATH)/platform.mk
+
+LIB_DIR = $(EXPORTS_LIB_PATH)/$(GOOS)/$(GOARCH)
+
+ifeq ($(OS),Windows_NT)
SWIFT = ./swift.cmd
else
SWIFT = swift
endif
endif
-build: .build_lib
- $(SWIFT) build --configuration release -Xlinker -L"../../exports/$(GOOS)/$(GOARCH)"
+build: install-header
+ $(SWIFT) build --configuration release -Xlinker -L"$(LIB_DIR)"
+
+test: install-header
+ $(SWIFT) test --parallel -Xlinker -L"$(LIB_DIR)"
-test: .build_lib
- $(SWIFT) test --parallel -Xlinker -L"../../exports/$(GOOS)/$(GOARCH)"
+install-header:
+ifneq ($(EXPORTS_PATH),)
+ifneq ($(wildcard $(EXPORTS_PATH)/Makefile),)
+ $(MAKE) -C "$(EXPORTS_PATH)"
+endif
+endif
+ install "$(LIB_DIR)/$(LIB_NAME).h" -Dt CEduVpnCommon/Sources/CEduVpnCommon/Headers # Copy header for modulemap
clean:
rm -rf .build/ CEduVpnCommon/Sources/CEduVpnCommon/Headers/*.h
-
-.build_lib:
- $(MAKE) -C ../../exports
- install "../../exports/$(GOOS)/$(GOARCH)/eduvpn_verify.h" -Dt CEduVpnCommon/Sources/CEduVpnCommon/Headers