gomu/Makefile

44 lines
858 B
Makefile
Raw Normal View History

2020-07-10 22:03:42 +08:00
.PHONY: test build format install release
2020-07-03 14:46:53 +08:00
GIT_PATH=github.com/issadarkthing
BIN_NAME=gomu
REPO_NAME=gomu
BIN_DIR := $(CURDIR)/bin
INSTALL_DIR := $${HOME}/.local/bin
VERSION := $(shell git describe --abbrev=0 --tags)
GIT_COMMIT= $(shell git rev-parse HEAD)
BUILD_DATE= $(shell date '+%Y-%m-%d-%H:%M:%S')
GO = go
2020-07-10 22:03:42 +08:00
default: format test build release
run: format build
$(BIN_DIR)/$(BIN_NAME)
2020-07-03 14:46:53 +08:00
test:
2020-07-10 22:03:42 +08:00
@echo === TESTING ===
2020-07-03 14:46:53 +08:00
go test
2020-07-10 22:03:42 +08:00
format:
@echo === FORMATTING ===
go fmt *.go
2020-07-03 14:46:53 +08:00
$(BIN_DIR):
@mkdir -p $@
$(INSTALL_DIR):
@mkdir -p $@
2020-07-04 09:47:54 +08:00
build: test $(BIN_DIR)
2020-07-10 22:03:42 +08:00
@echo === BUILDING ===
2020-07-03 14:46:53 +08:00
${GO} build -v -o $(BIN_DIR)/$(BIN_NAME)
install: build $(INSTALL_DIR)
2020-07-10 22:03:42 +08:00
@echo === INSTALLING ===
2020-07-03 14:46:53 +08:00
cp ${BIN_DIR}/${BIN_NAME} ${INSTALL_DIR}/${BIN_NAME}
release: build
2020-07-10 22:03:42 +08:00
@echo === RELEASING ===
2020-07-03 14:46:53 +08:00
mkdir -p dist
tar czf dist/gomu-${VERSION}-amd64.tar.gz bin/${BIN_NAME}