aboutsummaryrefslogtreecommitdiffstats
path: root/wireguard-go-bridge
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-31 04:02:36 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-31 04:08:13 +0100
commit9f5612f93f2661a0369c8662394b8f8a35341e27 (patch)
tree054f61245c4b18dbfc64b49d0d34bb2d9a866242 /wireguard-go-bridge
parentwireguard-go-bridge: simplify logging and remove tags (diff)
downloadwireguard-apple-9f5612f93f2661a0369c8662394b8f8a35341e27.tar.xz
wireguard-apple-9f5612f93f2661a0369c8662394b8f8a35341e27.zip
wireguard-go-bridge: extract version for consumption by network extension
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'wireguard-go-bridge')
-rw-r--r--wireguard-go-bridge/Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/wireguard-go-bridge/Makefile b/wireguard-go-bridge/Makefile
index 349977fa..00c8e353 100644
--- a/wireguard-go-bridge/Makefile
+++ b/wireguard-go-bridge/Makefile
@@ -24,6 +24,7 @@ export GOOS := darwin
export CGO_ENABLED := 1
build: $(DESTDIR)/libwg-go.a
+version-header: $(DESTDIR)/wireguard-go-version.h
define copy-src-to-build
$(subst $(1),$(BUILDDIR)/,$(2)): $(2)
@@ -55,6 +56,9 @@ $(BUILDDIR)/libwg-go-$(1).a: $(BUILDDIR)/.prepared
endef
$(foreach ARCH,$(ARCHS),$(eval $(call libwg-go-a,$(ARCH))))
+$(DESTDIR)/wireguard-go-version.h: ../wireguard-go/version.go
+ sed -n 's/.*WireGuardGoVersion = "\(.*\)"/#define WIREGUARD_GO_VERSION "\1"/p' "$^" > "$@"
+
$(DESTDIR)/libwg-go.a: $(foreach ARCH,$(ARCHS),$(BUILDDIR)/libwg-go-$(ARCH).a)
@mkdir -vp "$(DESTDIR)"
xcrun --sdk iphoneos lipo -create -output "$@" $^
@@ -62,7 +66,9 @@ $(DESTDIR)/libwg-go.a: $(foreach ARCH,$(ARCHS),$(BUILDDIR)/libwg-go-$(ARCH).a)
$(DESTDIR)/example: example.c $(DESTDIR)/libwg-go.a
xcrun --sdk iphoneos clang -framework CoreFoundation -isysroot "$(shell xcrun --sdk iphoneos --show-sdk-path)" -arch arm64 -arch armv7 -L"$(DESTDIR)" -lwg-go -o "$@" "$<"
+example: $(DESTDIR)/example
+
clean:
- rm -rf "$(BUILDDIR)" "$(DESTDIR)/libwg-go.a" "$(DESTDIR)/example"
+ rm -rf "$(BUILDDIR)" "$(DESTDIR)/libwg-go.a" "$(DESTDIR)/example" "$(DESTDIR)/wireguard-go-version.h"
-.PHONY: clean build
+.PHONY: clean build example version-header