Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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) -race -tags '$(TAGS)'
  20. cp '$(GOPATH)/bin/gogs' .
  21. pack:
  22. rm -rf $(RELEASE_GOGS)
  23. mkdir -p $(RELEASE_GOGS)
  24. cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
  25. rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
  26. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  27. release: build pack
  28. bindata: modules/bindata/bindata.go
  29. modules/bindata/bindata.go: $(DATA_FILES)
  30. go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS" -pkg=bindata conf/...
  31. less: public/css/gogs.css
  32. public/css/gogs.css: $(LESS_FILES)
  33. lessc $< $@
  34. clean:
  35. go clean -i ./...
  36. clean-mac: clean
  37. find . -name ".DS_Store" -print0 | xargs -0 rm
  38. test:
  39. go test -cover -race ./...
  40. fixme:
  41. grep -rnw "FIXME" routers models modules
  42. todo:
  43. grep -rnw "TODO" routers models modules