-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (32 loc) · 1.17 KB
/
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
49
APP = playlist-protector
BIN = bin/$(APP)
BIN_LINUX_AMD64 = $(BIN)-linux-amd64
BIN_LINUX_ARM32 = $(BIN)-linux-arm32
BIN_DARWIN_AMD64 = $(BIN)-darwin-amd64
IMAGE = localhost/$(APP)
CMD_SRC = cmd/$(APP)/main.go
SOURCES = $(shell find . -type f -iname "*.go")
.PHONY: all build vet fmt test run image clean private
all: test build
$(BIN_DARWIN_AMD64): $(SOURCES)
GOARCH=amd64 GOOS=darwin go build -o $(BIN_DARWIN_AMD64) $(CMD_SRC)
$(BIN_LINUX_ARM32): $(SOURCES)
GOARCH=arm GOOS=linux CGO_ENABLED=0 go build -o $(BIN_LINUX_ARM32) $(CMD_SRC)
$(BIN_LINUX_AMD64): $(SOURCES)
GOARCH=amd64 GOOS=linux CGO_ENABLED=0 go build -o $(BIN_LINUX_AMD64) $(CMD_SRC)
build: $(BIN_DARWIN_AMD64) $(BIN_LINUX_ARM32) $(BIN_LINUX_AMD64) fmt vet
private:
go env -w GOPRIVATE=github.com/rhysemmas/playlist-protector
vet:
go vet ./...
fmt: private
go fmt ./...
test: fmt vet
go test ./... -coverprofile cover.out
run: fmt vet
go run $(CMD_SRC) --debug
image: $(BIN_LINUX_AMD64) $(BIN_LINUX_ARM32)
docker buildx build --platform linux/amd64 -t $(IMAGE):amd64 . -f Dockerfile.amd64 --load
docker buildx build --platform linux/arm/v7 -t $(IMAGE):arm32 . -f Dockerfile.arm32 --load
clean:
rm -rf bin/