tunasync/Makefile
Miao Wang e903c644f2 Fix CI test for cgroupv1
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.
2025-01-12 04:07:00 +08:00

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