Skip to content

Commit

Permalink
Makefile 調整
Browse files Browse the repository at this point in the history
不要コマンドの削除や調整
  • Loading branch information
kenzo0107 committed Sep 19, 2019
1 parent 6f67dd4 commit 259fd2e
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
NAME := omssh
DATE := $(shell date +%Y-%m-%dT%H:%M:%S%z)
VERSION := $(gobump show -r)
VERSION := $(gobump show -r cmd/omssh)
REVISION := $(shell git rev-parse --short HEAD)
LDFLAGS := "-X main.revision=$(REVISION)"
LDFLAGS := "-X main.version=$(VERSION) -X main.revision=$(REVISION)"

export GO111MODULE=on

## Install dependencies

.PHONY: deps
deps:
go get -v -d

# 開発に必要な依存をインストールする ## Setup
## Setup
.PHONY: deps
devel-deps: deps
GO111MODULE=off go get \
github.com/golang/lint/golint \
github.com/motemen/gobump/cmd/gobump \
github.com/Songmu/make2help/cmd/make2help

# テストを実行する
## Run tests
.PHONY: test
test: deps
Expand All @@ -33,21 +30,30 @@ lint: devel-deps
golint -set_exit_status ./...

## build binaries ex. make bin/omssh
bin/%: *.go cmd/%/main.go deps
cd cmd/omssh && go build -ldflags "-s -w -X main.version=${GIT_VER} -X main.buildDate=${DATE}" -gcflags="-trimpath=${PWD}"

install: build
install cmd/omssh/omssh ${GOPATH}/bin
bin/%: cmd/%/main.go deps
@go build -ldflags $(LDFLAGS) -o $@ $<

## build binary
.PHONY: build
build: bin/omssh
build: bin/${NAME}

.PHONY: install
install:
@go install ./cmd/omssh

## Show help
.PHONY: help
help:
@make2help $(MAKEFILE_LIST)

## clean package
.PHONY: clean
clean:
rm -f cmd/omssh/omssh
rm -f bin/${NAME}
rm -f pkg/*

.PHONY: release
release:
@git tag v$(VERSION)
@git push --tags
goreleaser --rm-dist

0 comments on commit 259fd2e

Please sign in to comment.