summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2024-03-22 11:52:28 +0100
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-03-22 13:30:41 +0100
commit9bab3c87825b4284b3e6f2be3fa9e89da7723116 (patch)
tree6049f03402f23168c5000e9843a979935cd0996d /Makefile
parentf94e6471268c12b7b5c7fd1c8b8800dac3848d6c (diff)
All: Refactor makefile & building
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 17 insertions, 22 deletions
diff --git a/Makefile b/Makefile
index 5e8375f..d6cae4e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,30 +1,25 @@
-.PHONY: build test test-go test-wrappers clean
+.DEFAULT_GOAL := build
+.PHONY: build fmt cli clean
-build:
- $(MAKE) -C exports
-test: test-go test-wrappers
+VERSION := $(shell grep -o 'const Version = "[^"]*' internal/version/version.go | cut -d '"' -f 2)
+
-test-go:
- go test ./... -v
+build:
+ CGO_ENABLED="1" go build -o lib/libeduvpn_common-${VERSION}.so -buildmode=c-shared ./exports
-#WRAPPERS ?= $(notdir $(patsubst %/,%,$(wildcard wrappers/*/)))
-WRAPPERS=python
+fmt:
+ gofumpt -w .
-# Enable parallelism if -j is specified, but first execute build
-test-wrappers: build
- $(MAKE) $(foreach wrapper,$(WRAPPERS),.test-$(wrapper))
+lint:
+ golangci-lint run -E stylecheck,revive,gocritic ./...
-clean: .clean-libs $(foreach wrapper,$(WRAPPERS),.clean-$(wrapper))
+cli:
+ go build -o eduvpn-common-cli ./cmd/cli
-.clean-libs:
- $(MAKE) -C exports clean
+test:
+ go test ./...
-# Define test & clean for each wrapper
-define wrapper_targets
-.test-$(1):
- $(MAKE) -C wrappers/$(1) test
-.clean-$(1):
- $(MAKE) -C wrappers/$(1) clean
-endef
-$(foreach wrapper,$(WRAPPERS),$(eval $(call wrapper_targets,$(wrapper))))
+clean:
+ rm -rf lib
+ go clean