diff options
| author | StevenWdV <stevenwdv@gmail.com> | 2022-01-24 14:59:25 +0100 |
|---|---|---|
| committer | StevenWdV <stevenwdv@gmail.com> | 2022-01-24 16:24:57 +0100 |
| commit | e544c6fa9e15e7277da79e2464243e90b2706b8c (patch) | |
| tree | de6613747e0e34a799089d4677f9833a85748712 /exports/Makefile | |
| parent | aab2e4b966c82b67eb0e204060e5ea6cd4ea15cf (diff) | |
Cleanup
Added variables to Makefiles to specify custom exports/ directory;
Split exception classes in Java & C#;
Added more comments;
Renamed library and Go package;
Removed real (pure) tests;
Added generate_lib.ps1 to generate import .lib for Windows (Swift);
Moved built Go libraries to exports/lib/;
Switch to hopefully faster Swift GitHub Action.
Diffstat (limited to 'exports/Makefile')
| -rw-r--r-- | exports/Makefile | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/exports/Makefile b/exports/Makefile index 547ee92..67ddc61 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -2,15 +2,20 @@ include platform.mk -# Creates targets like 'linux/amd64/eduvpn_verify.so' -build: $(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify$(LIB_SUFFIX) +ifeq ($(LIB_SUFFIX),.so) +# Add SONAME as cgo does not currently do this. Mostly for Android, see https://stackoverflow.com/a/48291044 +export CGO_LDFLAGS := $(CGO_LDFLAGS) -Wl,-soname,$(LIB_FILE) +endif -$(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 $< - mv $(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify.h $(GOOS)/$(GOARCH)/eduvpn_verify.h || true +# Creates targets like 'lib/linux/amd64/libeduvpn_common.so' +build: lib/$(GOOS)/$(GOARCH)/$(LIB_FILE) -copy-to: $(GOOS)/$(GOARCH)/$(LIB_PREFIX)eduvpn_verify$(LIB_SUFFIX) - install $< -Dt "$(COPY_TARGET)" +# Build shared library and remove lib prefix (if any) from header name +# GOOS and GOARCH envvars are set by platform.mk +# This extra target prevents unnecessary rebuild +lib/$(GOOS)/$(GOARCH)/$(LIB_FILE): exports.go ../verify.go + CGO_ENABLED=1 go build -o $@ -buildmode=c-shared $< + mv lib/$(GOOS)/$(GOARCH)/$(LIB_PREFIX)$(LIB_NAME).h lib/$(GOOS)/$(GOARCH)/$(LIB_NAME).h || true # Normalize header name clean: - rm -rf ../exports/*/ + rm -rf ../exports/lib/* |
