A web blog and personal homepage engine written in Go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.4 KiB

  1. SHELL := /bin/bash
  2. VERSION=$(shell grep -e 'Version =' pkg/version.go | head -n 1 | cut -d '"' -f 2)
  3. BUILD=$(shell git describe --always)
  4. BUILD_DATE=$(shell date +"%Y-%m-%dT%H:%M:%S%z")
  5. CURDIR=$(shell curdir)
  6. # Inject the build version (commit hash) into the executable.
  7. LDFLAGS := -ldflags "-X main.Build=$(BUILD) -X main.BuildDate=$(BUILD_DATE)"
  8. # `make setup` to set up a new environment, pull dependencies, etc.
  9. .PHONY: setup
  10. setup: clean
  11. go get -u github.com/go-bindata/go-bindata/...
  12. go get ./...
  13. # `make build` to build the binary.
  14. .PHONY: build
  15. build:
  16. go build $(LDFLAGS) -i -o bin/gophertype cmd/gophertype/main.go
  17. # `make buildall` to run all build steps including doodads and bindata.
  18. .PHONY: buildall
  19. buildall: bindata build
  20. # `make bindata` generates the embedded binary assets package.
  21. .PHONY: bindata
  22. bindata:
  23. go-bindata -pkg bundled -o pkg/bundled/bindata.go -prefix pvt-www pvt-www/...
  24. # `make bindata-dev` generates the debug version of bindata package.
  25. .PHONY: bindata-dev
  26. bindata-dev:
  27. go-bindata -debug -pkg bundled -o pkg/bundled/bindata.go -prefix pvt-www pvt-www/...
  28. # `make install` to install the Go binaries to your GOPATH.
  29. .PHONY: install
  30. install:
  31. go install git.kirsle.net/apps/gophertype/cmd/gophertype
  32. # `make run` to run it in debug mode.
  33. .PHONY: run
  34. run:
  35. go run cmd/gophertype/main.go -debug
  36. # `make test` to run unit tests.
  37. .PHONY: test
  38. test:
  39. go test ./...
  40. # `make clean` cleans everything up.
  41. .PHONY: clean
  42. clean:
  43. rm -rf bin