Makefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. RELEASE_ROOT = "release"
  8. RELEASE_GOGS = "release/gogs"
  9. NOW = $(shell date -u '+%Y%m%d%I%M%S')
  10. .PHONY: build pack release bindata clean
  11. .IGNORE: public/css/gogs.css
  12. build: $(GENERATED)
  13. go install -v -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
  14. cp '$(GOPATH)/bin/gogs' .
  15. govet:
  16. go tool vet -composites=false -methods=false -structtags=false .
  17. build-dev: $(GENERATED) govet
  18. go install -v -race -tags '$(TAGS)'
  19. cp '$(GOPATH)/bin/gogs' .
  20. pack:
  21. rm -rf $(RELEASE_GOGS)
  22. mkdir -p $(RELEASE_GOGS)
  23. cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
  24. rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
  25. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  26. release: build pack
  27. bindata: modules/bindata/bindata.go
  28. modules/bindata/bindata.go: $(DATA_FILES)
  29. go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS" -pkg=bindata conf/...
  30. less: public/css/gogs.css
  31. public/css/gogs.css: $(LESS_FILES)
  32. lessc $< $@
  33. clean:
  34. go clean -i ./...
  35. clean-mac: clean
  36. find . -name ".DS_Store" -print0 | xargs -0 rm
  37. test:
  38. go test -cover -race ./...