Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. 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. govet:
  19. $(GOVET) gogs.go
  20. $(GOVET) models modules routers
  21. build: $(GENERATED)
  22. go install $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
  23. cp '$(GOPATH)/bin/gogs' .
  24. build-dev: $(GENERATED) govet
  25. go install $(BUILD_FLAGS) -tags '$(TAGS)'
  26. cp '$(GOPATH)/bin/gogs' .
  27. build-dev-race: $(GENERATED) govet
  28. go install $(BUILD_FLAGS) -race -tags '$(TAGS)'
  29. cp '$(GOPATH)/bin/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: modules/bindata/bindata.go
  38. modules/bindata/bindata.go: $(DATA_FILES)
  39. go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS" -pkg=bindata conf/...
  40. less: public/css/gogs.css
  41. public/css/gogs.css: $(LESS_FILES)
  42. lessc $< $@
  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 modules
  51. todo:
  52. grep -rnw "TODO" cmd routers models modules
  53. # Legacy code should be remove by the time of release
  54. legacy:
  55. grep -rnw "LEGACY" cmd routers models modules