mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-21 04:42:46 +00:00
23 lines
617 B
Makefile
23 lines
617 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) go build -o $@ -ldflags ${LDFLAGS} github.com/tuna/tunasync/$<
|
|
|
|
test:
|
|
go test -v -covermode=count -coverprofile=profile.cov ./...
|
|
|
|
.PHONY: all test $(BUILDBIN)
|