gomu/Makefile

45 lines
940 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
2020-08-23 17:04:11 +08:00
GIT_PATH = github.com/issadarkthing
BIN_NAME = gomu
REPO_NAME = gomu
BIN_DIR := $(CURDIR)/bin
2020-07-03 14:46:53 +08:00
INSTALL_DIR := $${HOME}/.local/bin
2020-08-23 17:04:11 +08:00
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-03 14:46:53 +08:00
2020-08-22 22:03:18 +08:00
default: build
2020-07-10 22:03:42 +08:00
2020-07-03 14:46:53 +08:00
test:
2020-07-10 22:03:42 +08:00
@echo === TESTING ===
2021-02-15 20:28:06 +08:00
go test ./...
2020-07-03 14:46:53 +08:00
2020-07-10 22:03:42 +08:00
format:
@echo === FORMATTING ===
2021-03-04 12:33:03 +08:00
go fmt ./...
2020-07-10 22:03:42 +08:00
2020-07-03 14:46:53 +08:00
$(BIN_DIR):
2020-07-27 20:40:51 +08:00
mkdir -p $@
2020-07-03 14:46:53 +08:00
$(INSTALL_DIR):
2020-07-27 20:40:51 +08:00
mkdir -p $@
2020-07-03 14:46:53 +08:00
2020-08-22 22:03:18 +08:00
build: $(BIN_DIR)
2020-07-10 22:03:42 +08:00
@echo === BUILDING ===
2020-09-05 17:06:23 +08:00
${GO} build -ldflags "-X main.VERSION=${VERSION}" -v -o $(BIN_DIR)/$(BIN_NAME)
2020-07-03 14:46:53 +08:00
2021-02-13 22:48:17 +08:00
run: build $(BIN_DIR)
bin/gomu -config ./test/config
2020-07-03 14:46:53 +08:00
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}
2021-02-16 16:54:27 +08:00
./aur-build.sh