summaryrefslogtreecommitdiff
path: root/exports/Makefile
diff options
context:
space:
mode:
authorStevenWdV <stevenwdv@gmail.com>2021-11-24 17:47:17 +0100
committerStevenWdV <stevenwdv@gmail.com>2021-11-24 17:47:17 +0100
commitbc940a145ca8150bc1e8fbb18d0a4685e9b09ce0 (patch)
tree20c661ab9fa8f79943e2e019f274abe7c6ad902a /exports/Makefile
parent8878d8705f0b0fcddb3979194340ca39df897580 (diff)
Support more platforms, add make clean targets, support embedding lib in nupkg
Diffstat (limited to 'exports/Makefile')
-rw-r--r--exports/Makefile24
1 files changed, 15 insertions, 9 deletions
diff --git a/exports/Makefile b/exports/Makefile
index 94781be..912e930 100644
--- a/exports/Makefile
+++ b/exports/Makefile
@@ -1,12 +1,18 @@
-.PHONY: build
+.PHONY: build clean
-ifeq ($(OS),Windows_NT)
- lib_suffix := .dll
-else
- lib_suffix := .so
-endif
+lib_suffix_linux = .so
+lib_suffix_windows = .dll
+lib_suffix_darwin = .dylib
-build: eduvpn_verify$(lib_suffix)
+OS = $(shell go env GOHOSTOS)
+ARCH = $(shell go env GOHOSTARCH)
+LIB_SUFFIX = $(lib_suffix_$(OS))
-eduvpn_verify.dll eduvpn_verify.so: exports.go ../verify.go
- go build -o $@ -buildmode=c-shared $<
+# Creates targets like 'linux/amd64/eduvpn_verify.so'
+build: $(OS)/$(ARCH)/eduvpn_verify$(LIB_SUFFIX)
+
+$(OS)/$(ARCH)/eduvpn_verify$(LIB_SUFFIX): exports.go ../verify.go
+ CGO_ENABLED=1 GOOS=$(OS) GOARCH=$(ARCH) go build -o $@ -buildmode=c-shared $<
+
+clean:
+ rm -rf ../exports/*/