Makefile 2.0 KB

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