Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. build: $(GENERATED)
  12. go install -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
  13. cp '$(GOPATH)/bin/gogs' .
  14. govet:
  15. go tool vet -composites=false -methods=false -structtags=false .
  16. pack:
  17. rm -rf $(RELEASE_GOGS)
  18. mkdir -p $(RELEASE_GOGS)
  19. cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
  20. rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
  21. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  22. release: build pack
  23. bindata: modules/bindata/bindata.go
  24. modules/bindata/bindata.go: $(DATA_FILES)
  25. go-bindata -o=$@ -ignore="\\.DS_Store|README.md" -pkg=bindata conf/...
  26. less: public/css/gogs.css
  27. public/css/gogs.css: $(LESS_FILES)
  28. lessc $< $@
  29. clean:
  30. go clean -i ./...
  31. clean-mac: clean
  32. find . -name ".DS_Store" -print0 | xargs -0 rm