2019-11-15 03:03:56 +00:00
|
|
|
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) -i -o bin/gophertype cmd/gophertype/main.go
|
|
|
|
|
|
|
|
# `make buildall` to run all build steps including doodads and bindata.
|
|
|
|
.PHONY: buildall
|
2022-12-06 05:07:52 +00:00
|
|
|
buildall: build
|
2019-11-15 03:03:56 +00:00
|
|
|
|
|
|
|
# `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:
|
2021-05-31 23:11:01 +00:00
|
|
|
go run cmd/gophertype/main.go -debug -sqlite database.sqlite -root ./public_html
|
2019-11-15 03:03:56 +00:00
|
|
|
|
|
|
|
# `make test` to run unit tests.
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
|
|
|
go test ./...
|
|
|
|
|
|
|
|
# `make clean` cleans everything up.
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf bin
|