aboutsummaryrefslogtreecommitdiffstats
path: root/wireguard-go-bridge/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'wireguard-go-bridge/Makefile')
-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 349977f..00c8e35 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