Makefile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. LDFLAGS += -X "gogs.io/gogs/internal/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
  2. LDFLAGS += -X "gogs.io/gogs/internal/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 := internal/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 build $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)' -o gogs
  25. build-dev: $(GENERATED) govet
  26. go build $(BUILD_FLAGS) -tags '$(TAGS)' -o gogs
  27. cp '$(GOPATH)/bin/gogs' .
  28. build-dev-race: $(GENERATED) govet
  29. go build $(BUILD_FLAGS) -race -tags '$(TAGS)' -o gogs
  30. pack:
  31. rm -rf $(RELEASE_GOGS)
  32. mkdir -p $(RELEASE_GOGS)
  33. cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
  34. rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
  35. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  36. release: build pack
  37. bindata: internal/bindata/bindata.go
  38. internal/bindata/bindata.go: $(DATA_FILES)
  39. go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS|auth.d" -pkg=bindata conf/...
  40. less: public/css/gogs.css
  41. public/css/gogs.css: $(LESS_FILES)
  42. @type lessc >/dev/null 2>&1 && lessc $< >$@ || echo "lessc command not found, skipped."
  43. clean:
  44. go clean -i ./...
  45. clean-mac: clean
  46. find . -name ".DS_Store" -print0 | xargs -0 rm
  47. test:
  48. go test -cover -race ./...
  49. fixme:
  50. grep -rnw "FIXME" cmd routers models pkg
  51. todo:
  52. grep -rnw "TODO" cmd routers models pkg
  53. # Legacy code should be remove by the time of release
  54. legacy:
  55. grep -rnw "LEGACY" cmd routes models pkg