Skip to content

Commit

Permalink
Convert build script to a Makefile. (#24)
Browse files Browse the repository at this point in the history
* Convert build script to a Makefile.

* Oops I forgot to delete build.sh
  • Loading branch information
grundleborg authored Oct 22, 2021
1 parent 5495346 commit 733e179
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.PHONY: build build-linux build-mac build-windows release clean

ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

build: ## Build Slack Advanced Exporter for the current platform and architecture
go build .

build-linux: ## Build Slack Advanced Exporter for Linux
@mkdir -p ${ROOT}build
cd ${ROOT}build && GOOS=linux GOARCH=amd64 go build ..

build-mac: ## Build Slack Advanced Exporter for Mac
@mkdir -p ${ROOT}build
cd ${ROOT}build && GOOS=darwin GOARCH=amd64 go build ..

build-windows: ## Build Slack Advanced Exporter for Windows
@mkdir -p ${ROOT}build
cd ${ROOT}build && GOOS=windows GOARCH=amd64 go build ..

release: clean ## Build and package the release artefacts
@mkdir -p ${ROOT}build
@mkdir -p ${ROOT}release
cd ${ROOT}build && GOOS=linux GOARCH=amd64 go build ..
cd ${ROOT}build && tar -czf ../release/slack-advanced-exporter.linux-amd64.tar.gz slack-advanced-exporter
cd ${ROOT}build && GOOS=darwin GOARCH=amd64 go build ..
cd ${ROOT}build && tar -czf ../release/slack-advanced-exporter.darwin-amd64.tar.gz slack-advanced-exporter
cd ${ROOT}build && GOOS=windows GOARCH=amd64 go build ..
cd ${ROOT}build && zip -q ../release/slack-advanced-exporter.windows-amd64.zip slack-advanced-exporter.exe
cd ${ROOT}release && sha256sum ./slack-advanced-exporter.*

clean: ## Remove all build and release artefacts
rm -rf build
rm -rf release
rm -rf slack-advanced-exporter
rm -rf slack-advanced-exporter.exe
20 changes: 0 additions & 20 deletions build.sh

This file was deleted.

0 comments on commit 733e179

Please sign in to comment.