From 9bab3c87825b4284b3e6f2be3fa9e89da7723116 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Fri, 22 Mar 2024 11:52:28 +0100 Subject: All: Refactor makefile & building --- Makefile | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.3