Makefile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. LDFLAGS += -X "gogs.io/gogs/internal/conf.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
  2. LDFLAGS += -X "gogs.io/gogs/internal/conf.BuildCommit=$(shell git rev-parse HEAD)"
  3. CONF_FILES := $(shell find conf | sed 's/ /\\ /g')
  4. TEMPLATES_FILES := $(shell find templates | sed 's/ /\\ /g')
  5. PUBLIC_FILES := $(shell find public | sed 's/ /\\ /g')
  6. LESS_FILES := $(wildcard public/less/*.less)
  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. .PHONY: check dist build build-no-gen pack release generate less clean test fixme todo legacy
  13. .IGNORE: public/css/gogs.css
  14. all: build
  15. check: test
  16. dist: release
  17. web: build
  18. ./gogs web
  19. build:
  20. go build $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)' -trimpath -o gogs
  21. pack:
  22. rm -rf $(RELEASE_GOGS)
  23. mkdir -p $(RELEASE_GOGS)
  24. cp -r gogs LICENSE README.md README_ZH.md scripts $(RELEASE_GOGS)
  25. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  26. release: build pack
  27. generate: clean
  28. go generate internal/assets/conf/conf.go
  29. go generate internal/assets/templates/templates.go
  30. go generate internal/assets/public/public.go
  31. less: clean public/css/gogs.min.css
  32. public/css/gogs.min.css: $(LESS_FILES)
  33. @type lessc >/dev/null 2>&1 && lessc --clean-css --source-map "public/less/gogs.less" $@ || echo "lessc command not found or failed"
  34. clean:
  35. find . -name "*.DS_Store" -type f -delete
  36. test:
  37. go test -cover -race ./...
  38. fixme:
  39. grep -rnw "FIXME" internal
  40. todo:
  41. grep -rnw "TODO" internal
  42. # Legacy code should be removed by the time of release
  43. legacy:
  44. grep -rnw "\(LEGACY\|Deprecated\)" internal