-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
49 lines (41 loc) · 1.28 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
VERSION=$(shell go run cmd/goclockify/main.go --version)
ARCHIVE_PREFIX="goclockify-$(VERSION)"
.PHONY: default
default: build-all
.PHONY: build-linux-binary
build-linux-binary:
@echo "+ $@"
@GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=vendor -a -installsuffix cgo -o ./build/output/$(ARCHIVE_PREFIX)-linux-amd64 ./cmd/goclockify
.PHONY: build-mac-binary
build-mac-binary:
@echo "+ $@"
@GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -mod=vendor -a -installsuffix cgo -o ./build/output/$(ARCHIVE_PREFIX)-darwin-amd64 ./cmd/goclockify
.PHONY: build-rpm
build-rpm: build-linux-binary
@echo "+ $@"
@docker run --rm \
-v "$(PWD):/tmp" \
-e "VERSION=$(VERSION)" \
goreleaser/nfpm pkg \
--config /tmp/build/package/nfpm.yaml \
--target /tmp/build/output/$(ARCHIVE_PREFIX)-linux-amd64.rpm
.PHONY: build-deb
build-deb: build-linux-binary
@echo "+ $@"
@docker run --rm \
-v "$(PWD):/tmp" \
-e "VERSION=$(VERSION)" \
goreleaser/nfpm pkg \
--config /tmp/build/package/nfpm.yaml \
--target /tmp/build/output/$(ARCHIVE_PREFIX)-linux-amd64.deb
.PHONY: clean
clean:
@echo "+ $@"
@sudo rm -rf "build/output/"
.PHONY: modules
modules:
@echo "+ $@"
@go mod tidy
@go mod vendor
.PHONY: build-all
build-all: build-rpm build-deb build-mac-binary