mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-21 04:42:46 +00:00
The test binary is complied on ubuntu 22.04, linked with higher version of glibc than debian bullseye integrates after upgrading to golang 1.22 Solve this problem by disabling cgo.
29 lines
757 B
Makefile
29 lines
757 B
Makefile
LDFLAGS="-X main.buildstamp=`date -u '+%s'` -X main.githash=`git rev-parse HEAD`"
|
|
ARCH ?= linux-amd64
|
|
ARCH_LIST = $(subst -, ,$(ARCH))
|
|
GOOS = $(word 1, $(ARCH_LIST))
|
|
GOARCH = $(word 2, $(ARCH_LIST))
|
|
BUILDBIN = tunasync tunasynctl
|
|
|
|
all: $(BUILDBIN)
|
|
|
|
build-$(ARCH):
|
|
mkdir -p $@
|
|
|
|
$(BUILDBIN): % : build-$(ARCH) build-$(ARCH)/%
|
|
|
|
$(BUILDBIN:%=build-$(ARCH)/%) : build-$(ARCH)/% : cmd/%
|
|
GOOS=$(GOOS) GOARCH=$(GOARCH) go get ./$<
|
|
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -o $@ -ldflags ${LDFLAGS} github.com/tuna/tunasync/$<
|
|
|
|
test:
|
|
go test -v -covermode=count -coverprofile=profile.cov ./...
|
|
|
|
build-test-worker:
|
|
CGO_ENABLED=0 go test -c -covermode=count ./worker
|
|
|
|
clean:
|
|
rm -rf build-$(ARCH)
|
|
|
|
.PHONY: all test $(BUILDBIN) build-test-worker clean
|