gophertype/Makefile
Noah Petherbridge 777fd85085 Dust off gophertype and fix some bugs
* Add a rate limiter to the login page.
* Fix the CSRF cookie expiring after 24 hours; it now will be a session
  cookie that expires on browser exit so you get a fresh one each visit.
* Remove the dependency on go-bindata and use native Go file embed
* Add documentation
2022-12-05 21:09:06 -08:00

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) -i -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