Merge pull request #304 from techtonik/windate

Windows-compatible Makefile
This commit is contained in:
Zachary Yedidia 2016-09-04 15:17:27 -04:00 committed by GitHub
commit cd1117c08c
2 changed files with 13 additions and 2 deletions

View file

@ -2,17 +2,18 @@
VERSION = $(shell git describe --tags --abbrev=0)
HASH = $(shell git rev-parse --short HEAD)
DATE = $(shell go run tools/build-date.go)
# Builds micro after checking dependencies but without updating the runtime
build: deps tcell
go build -ldflags "-X main.Version=$(VERSION) -X main.CommitHash=$(HASH) -X 'main.CompileDate=$(shell date -u '+%B %d, %Y')'" -o micro ./cmd/micro
go build -ldflags "-X main.Version=$(VERSION) -X main.CommitHash=$(HASH) -X 'main.CompileDate=$(DATE)'" ./cmd/micro
# Builds micro after building the runtime and checking dependencies
build-all: runtime build
# Builds micro without checking for dependencies
build-quick:
go build -ldflags "-X main.Version=$(VERSION) -X main.CommitHash=$(HASH) -X 'main.CompileDate=$(shell date -u '+%B %d, %Y')'" -o micro ./cmd/micro
go build -ldflags "-X main.Version=$(VERSION) -X main.CommitHash=$(HASH) -X 'main.CompileDate=$(DATE)'" ./cmd/micro
# Same as 'build' but installs to $GOPATH/bin afterward
install: build

10
tools/build-date.go Normal file
View file

@ -0,0 +1,10 @@
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(time.Now().Local().Format("January 02, 2006"))
}