forked from mxpv/podsync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (39 loc) · 813 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
BINPATH := $(abspath ./bin)
.PHONY: all
all: build test
#
# Build Podsync CLI binary
# Example:
# $ GOOS=amd64 make build
#
GOARCH ?= $(shell go env GOARCH)
GOOS ?= $(shell go env GOOS)
TAG ?= $(shell git tag --points-at HEAD)
COMMIT ?= $(shell git rev-parse --short HEAD)
DATE := $(shell date)
LDFLAGS := "-X 'main.version=${TAG}' -X 'main.commit=${COMMIT}' -X 'main.date=${DATE}' -X 'main.arch=${GOARCH}'"
.PHONY: build
build:
go build -ldflags ${LDFLAGS} -o bin/podsync ./cmd/podsync
#
# Build a local Docker image
# Example:
# $ make docker
# $ docker run -it --rm localhost/podsync:latest
#
IMAGE_TAG ?= localhost/podsync
.PHONY: docker
docker:
docker buildx build -t $(IMAGE_TAG) .
#
# Run unit tests
#
.PHONY: test
test:
go test -v ./...
#
# Clean
#
.PHONY: clean
clean:
- rm -rf $(BINPATH)