slack-status-cli/Makefile

43 lines
863 B
Makefile
Raw Normal View History

2021-01-06 18:44:29 +00:00
OUTPUT = slack-status
GOFILES = *.go go.mod go.sum
DIST_ARCH = darwin-amd64 linux-amd64
DIST_TARGETS = $(addprefix dist/$(OUTPUT)-,$(DIST_ARCH))
2021-02-02 21:49:10 +00:00
VERSION ?= $(shell git describe --tags --dirty)
2021-01-06 18:44:29 +00:00
.PHONY: default
default: slack-status
2021-01-07 17:19:56 +00:00
.PHONY: run
run: slack-status
./slack-status
2021-01-06 18:44:29 +00:00
.PHONY: all
all: dist
.PHONY: test
test:
pre-commit run --all-files
2021-01-06 18:44:29 +00:00
go test
slack-status: $(GOFILES)
go build -o $(OUTPUT)
.PHONY: dist
dist: $(DIST_TARGETS)
$(DIST_TARGETS): $(GOFILES)
@mkdir -p ./dist
GOOS=$(word 3, $(subst -, ,$(@))) GOARCH=$(word 4, $(subst -, ,$(@))) \
go build \
2021-02-02 21:49:10 +00:00
-ldflags '-X "main.version=${VERSION}" -X "main.defaultClientID=$(CLIENT_ID)" -X "main.defaultClientSecret=$(CLIENT_SECRET)"' \
2021-01-06 18:44:29 +00:00
-o $@
.PHONY: clean
clean:
2021-02-02 21:49:10 +00:00
rm -f ./slack-status
2021-01-06 18:44:29 +00:00
rm -fr ./dist
.PHONY: install-hooks
install-hooks:
pre-commit install --overwrite --install-hooks