Makefile 1.8 KB

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