Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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