55 lines
1.4 KiB
Makefile
55 lines
1.4 KiB
Makefile
SHELL := /bin/bash
|
|
|
|
VERSION=$(shell grep -e 'Version =' pkg/version.go | head -n 1 | cut -d '"' -f 2)
|
|
BUILD=$(shell git describe --always)
|
|
BUILD_DATE=$(shell date +"%Y-%m-%dT%H:%M:%S%z")
|
|
CURDIR=$(shell curdir)
|
|
|
|
# Inject the build version (commit hash) into the executable.
|
|
LDFLAGS := -ldflags "-X main.Build=$(BUILD) -X main.BuildDate=$(BUILD_DATE)"
|
|
|
|
# `make setup` to set up a new environment, pull dependencies, etc.
|
|
.PHONY: setup
|
|
setup: clean
|
|
go get -u github.com/go-bindata/go-bindata/...
|
|
go get ./...
|
|
|
|
# `make build` to build the binary.
|
|
.PHONY: build
|
|
build:
|
|
go build $(LDFLAGS) -i -o bin/gophertype cmd/gophertype/main.go
|
|
|
|
# `make buildall` to run all build steps including doodads and bindata.
|
|
.PHONY: buildall
|
|
buildall: bindata build
|
|
|
|
# `make bindata` generates the embedded binary assets package.
|
|
.PHONY: bindata
|
|
bindata:
|
|
go-bindata -pkg bundled -o pkg/bundled/bindata.go -prefix pvt-www pvt-www/...
|
|
|
|
# `make bindata-dev` generates the debug version of bindata package.
|
|
.PHONY: bindata-dev
|
|
bindata-dev:
|
|
go-bindata -debug -pkg bundled -o pkg/bundled/bindata.go -prefix pvt-www pvt-www/...
|
|
|
|
# `make install` to install the Go binaries to your GOPATH.
|
|
.PHONY: install
|
|
install:
|
|
go install git.kirsle.net/apps/gophertype/cmd/gophertype
|
|
|
|
# `make run` to run it in debug mode.
|
|
.PHONY: run
|
|
run:
|
|
go run cmd/gophertype/main.go -debug
|
|
|
|
# `make test` to run unit tests.
|
|
.PHONY: test
|
|
test:
|
|
go test ./...
|
|
|
|
# `make clean` cleans everything up.
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf bin
|