-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a `Makefile` to simplify the maintenance tasks.
- Loading branch information
Showing
3 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
# Binaries for programs and plugins | ||
*.dll | ||
*.dylib | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.out | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, build with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Project name. | ||
PROJECT_NAME = keeparelease | ||
|
||
# Makefile parameters. | ||
TAG ?= $(shell git describe) | ||
|
||
# General. | ||
SHELL = /bin/bash | ||
TOPDIR = $(shell git rev-parse --show-toplevel) | ||
|
||
# Project specifics. | ||
BUILD_DIR = dist | ||
PLATFORMS = linux darwin | ||
OS = $(word 1, $@) | ||
GOOS = $(shell uname -s | tr A-Z a-z) | ||
GOARCH = amd64 | ||
|
||
default: build | ||
|
||
.PHONY: help | ||
help: # Display help | ||
@awk -F ':|##' \ | ||
'/^[^\t].+?:.*?##/ { | ||
printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF \ | ||
}' $(MAKEFILE_LIST) | sort | ||
|
||
.PHONY: build | ||
build: ## Build the project for the current platform | ||
mkdir -p $(BUILD_DIR) | ||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(BUILD_DIR)/$(PROJECT_NAME)-$(TAG)-$(GOOS)-$(GOARCH) | ||
|
||
.PHONY: test | ||
test: ## Run the unit tests | ||
go test .../keeparelease | ||
|
||
.PHONY: clean | ||
clean: clean-code ## Clean everything (!DESTRUCTIVE!) | ||
|
||
.PHONY: clean-code | ||
clean-code: ## Remove unwanted files in this project (!DESTRUCTIVE!) | ||
@cd $(TOPDIR) && git clean -ffdx && git reset --hard | ||
|
||
dist: $(PLATFORMS) ## Package the project for all available platforms | ||
|
||
.PHONY: publish | ||
publish: dist ## Create GitHub release | ||
keeparelease -a dist/* | ||
|
||
.PHONY: setup | ||
setup: ## Setup the full environment (default) | ||
go mod tidy | ||
|
||
$(PLATFORMS): # Build the project for all available platforms | ||
mkdir -p $(BUILD_DIR) | ||
GOOS=$(OS) GOARCH=$(GOARCH) go build -o $(BUILD_DIR)/$(PROJECT_NAME)-$(TAG)-$(OS)-$(GOARCH) | ||
.PHONY: $(PLATFORMS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters