summaryrefslogtreecommitdiff
path: root/exports
diff options
context:
space:
mode:
authorStevenWdV <stevenwdv@gmail.com>2021-12-14 15:56:10 +0100
committerStevenWdV <stevenwdv@gmail.com>2021-12-14 15:56:10 +0100
commitae826fde04191d26af68b898cf4b2f537d24a8ec (patch)
treec41943907e6c880a4254106942fc2c399c462016 /exports
parentd9953dcc09ce61e249e40857bbf5cb98e0bb1fbf (diff)
Add Swift wrapper, support more platforms in Makefile
Diffstat (limited to 'exports')
-rw-r--r--exports/.gitignore1
-rw-r--r--exports/Makefile24
2 files changed, 14 insertions, 11 deletions
diff --git a/exports/.gitignore b/exports/.gitignore
index 63ea916..f916bcd 100644
--- a/exports/.gitignore
+++ b/exports/.gitignore
@@ -1 +1,2 @@
/*/
+*.h
diff --git a/exports/Makefile b/exports/Makefile
index 087d3a2..9664144 100644
--- a/exports/Makefile
+++ b/exports/Makefile
@@ -1,23 +1,25 @@
.PHONY: build copy-to clean
-lib_prefix_linux = lib
-lib_prefix_windows =
-lib_prefix_darwin = lib
+GOOS != go env GOHOSTOS
+GOARCH != go env GOHOSTARCH
-lib_suffix_linux = .so
-lib_suffix_windows = .dll
-lib_suffix_darwin = .dylib
-
-GOOS ?= $(shell go env GOHOSTOS)
-GOARCH ?= $(shell go env GOHOSTARCH)
-LIB_PREFIX = $(lib_prefix_$(GOOS))
-LIB_SUFFIX = $(lib_suffix_$(GOOS))
+ifeq (windows,$(GOOS))
+LIB_PREFIX =
+LIB_SUFFIX = .dll
+else ifeq (darwin,$(GOOS))
+LIB_PREFIX = lib
+LIB_SUFFIX = .dylib
+else
+LIB_PREFIX = lib
+LIB_SUFFIX = .so
+endif
# Creates targets like 'linux/amd64/eduvpn_verify.so'
build: $(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify$(LIB_SUFFIX)
$(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify$(LIB_SUFFIX): exports.go ../verify.go
CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ -buildmode=c-shared $<
+ cp $(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify.h ./eduvpn_verify.h
copy-to: $(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify$(LIB_SUFFIX)
install $< -Dt "$(COPY_TARGET)"