Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
  2. LDFLAGS += -X "github.com/gogits/gogs/modules/setting.BuildGitHash=$(shell git rev-parse HEAD)"
  3. DATA_FILES := $(shell find conf | sed 's/ /\\ /g')
  4. LESS_FILES := $(wildcard public/less/gogs.less public/less/_*.less)
  5. GENERATED := modules/bindata/bindata.go public/css/gogs.css
  6. TAGS = ""
  7. BUILD_FLAGS = "-v"
  8. RELEASE_ROOT = "release"
  9. RELEASE_GOGS = "release/gogs"
  10. NOW = $(shell date -u '+%Y%m%d%I%M%S')
  11. .PHONY: build pack release bindata clean
  12. .IGNORE: public/css/gogs.css
  13. build: $(GENERATED)
  14. go install $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
  15. cp '$(GOPATH)/bin/gogs' .
  16. govet:
  17. go tool vet -composites=false -methods=false -structtags=false .
  18. build-dev: $(GENERATED) govet
  19. go install $(BUILD_FLAGS) -tags '$(TAGS)'
  20. cp '$(GOPATH)/bin/gogs' .
  21. build-dev-race: $(GENERATED) govet
  22. go install $(BUILD_FLAGS) -race -tags '$(TAGS)'
  23. cp '$(GOPATH)/bin/gogs' .
  24. pack:
  25. rm -rf $(RELEASE_GOGS)
  26. mkdir -p $(RELEASE_GOGS)
  27. cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
  28. rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
  29. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  30. release: build pack
  31. bindata: modules/bindata/bindata.go
  32. modules/bindata/bindata.go: $(DATA_FILES)
  33. go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS" -pkg=bindata conf/...
  34. less: public/css/gogs.css
  35. public/css/gogs.css: $(LESS_FILES)
  36. lessc $< $@
  37. clean:
  38. go clean -i ./...
  39. clean-mac: clean
  40. find . -name ".DS_Store" -print0 | xargs -0 rm
  41. test:
  42. go test -cover -race ./...
  43. fixme:
  44. grep -rnw "FIXME" routers models modules
  45. todo:
  46. grep -rnw "TODO" routers models modules