Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. LDFLAGS += -X "github.com/gogits/gogs/pkg/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
  2. LDFLAGS += -X "github.com/gogits/gogs/pkg/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 := pkg/bindata/bindata.go public/css/gogs.css
  6. OS := $(shell uname)
  7. TAGS = ""
  8. BUILD_FLAGS = "-v"
  9. RELEASE_ROOT = "release"
  10. RELEASE_GOGS = "release/gogs"
  11. NOW = $(shell date -u '+%Y%m%d%I%M%S')
  12. GOVET = go tool vet -composites=false -methods=false -structtags=false
  13. .PHONY: build pack release bindata clean
  14. .IGNORE: public/css/gogs.css
  15. all: build
  16. check: test
  17. dist: release
  18. web: build
  19. ./gogs web
  20. govet:
  21. $(GOVET) gogs.go
  22. $(GOVET) models pkg routes
  23. build: $(GENERATED)
  24. go install $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
  25. cp '$(GOPATH)/bin/gogs' .
  26. build-dev: $(GENERATED) govet
  27. go install $(BUILD_FLAGS) -tags '$(TAGS)'
  28. cp '$(GOPATH)/bin/gogs' .
  29. build-dev-race: $(GENERATED) govet
  30. go install $(BUILD_FLAGS) -race -tags '$(TAGS)'
  31. cp '$(GOPATH)/bin/gogs' .
  32. pack:
  33. rm -rf $(RELEASE_GOGS)
  34. mkdir -p $(RELEASE_GOGS)
  35. cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
  36. rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
  37. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  38. release: build pack
  39. bindata: pkg/bindata/bindata.go
  40. pkg/bindata/bindata.go: $(DATA_FILES)
  41. go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS" -pkg=bindata conf/...
  42. less: public/css/gogs.css
  43. public/css/gogs.css: $(LESS_FILES)
  44. lessc $< $@
  45. clean:
  46. go clean -i ./...
  47. clean-mac: clean
  48. find . -name ".DS_Store" -print0 | xargs -0 rm
  49. test:
  50. go test -cover -race ./...
  51. fixme:
  52. grep -rnw "FIXME" cmd routers models pkg
  53. todo:
  54. grep -rnw "TODO" cmd routers models pkg
  55. # Legacy code should be remove by the time of release
  56. legacy:
  57. grep -rnw "LEGACY" cmd routes models pkg