slack-status-cli/Makefile
Ian Fijolek d19df7e3f9
All checks were successful
continuous-integration/drone/tag Build is passing
Add drone builds
2021-02-03 13:01:53 -08:00

43 lines
863 B
Makefile

OUTPUT = slack-status
GOFILES = *.go go.mod go.sum
DIST_ARCH = darwin-amd64 linux-amd64
DIST_TARGETS = $(addprefix dist/$(OUTPUT)-,$(DIST_ARCH))
VERSION ?= $(shell git describe --tags --dirty)
.PHONY: default
default: slack-status
.PHONY: run
run: slack-status
./slack-status
.PHONY: all
all: dist
.PHONY: test
test:
pre-commit run --all-files
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 \
-ldflags '-X "main.version=${VERSION}" -X "main.defaultClientID=$(CLIENT_ID)" -X "main.defaultClientSecret=$(CLIENT_SECRET)"' \
-o $@
.PHONY: clean
clean:
rm -f ./slack-status
rm -fr ./dist
.PHONY: install-hooks
install-hooks:
pre-commit install --overwrite --install-hooks