44 lines
1.1 KiB
Makefile
44 lines
1.1 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 ./...
|
|
|
|
# `make build` to build the binary.
|
|
.PHONY: build
|
|
build:
|
|
go build $(LDFLAGS) -o bin/gophertype cmd/gophertype/main.go
|
|
|
|
# `make buildall` to run all build steps including doodads and bindata.
|
|
.PHONY: buildall
|
|
buildall: build
|
|
|
|
# `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 -sqlite database.sqlite -root ./public_html
|
|
|
|
# `make test` to run unit tests.
|
|
.PHONY: test
|
|
test:
|
|
go test ./...
|
|
|
|
# `make clean` cleans everything up.
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf bin
|