Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. GOVET = go tool vet -composites=false -methods=false -structtags=false
  12. .PHONY: build pack release bindata clean
  13. .IGNORE: public/css/gogs.css
  14. govet:
  15. $(GOVET) gogs.go
  16. $(GOVET) models modules routers
  17. build: $(GENERATED)
  18. go install $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
  19. cp '$(GOPATH)/bin/gogs' .
  20. build-dev: $(GENERATED) govet
  21. go install $(BUILD_FLAGS) -tags '$(TAGS)'
  22. cp '$(GOPATH)/bin/gogs' .
  23. build-dev-race: $(GENERATED) govet
  24. go install $(BUILD_FLAGS) -race -tags '$(TAGS)'
  25. cp '$(GOPATH)/bin/gogs' .
  26. pack:
  27. rm -rf $(RELEASE_GOGS)
  28. mkdir -p $(RELEASE_GOGS)
  29. cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
  30. rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
  31. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  32. release: build pack
  33. bindata: modules/bindata/bindata.go
  34. modules/bindata/bindata.go: $(DATA_FILES)
  35. go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS" -pkg=bindata conf/...
  36. less: public/css/gogs.css
  37. public/css/gogs.css: $(LESS_FILES)
  38. lessc $< $@
  39. clean:
  40. go clean -i ./...
  41. clean-mac: clean
  42. find . -name ".DS_Store" -print0 | xargs -0 rm
  43. test:
  44. go test -cover -race ./...
  45. fixme:
  46. grep -rnw "FIXME" routers models modules
  47. todo:
  48. grep -rnw "TODO" routers models modules