Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. pack:
  18. rm -rf $(RELEASE_GOGS)
  19. mkdir -p $(RELEASE_GOGS)
  20. cp -r gogs LICENSE README.md README_ZH.md templates public scripts $(RELEASE_GOGS)
  21. rm -rf $(RELEASE_GOGS)/public/config.codekit $(RELEASE_GOGS)/public/less
  22. cd $(RELEASE_ROOT) && zip -r gogs.$(NOW).zip "gogs"
  23. release: build pack
  24. bindata: modules/bindata/bindata.go
  25. modules/bindata/bindata.go: $(DATA_FILES)
  26. go-bindata -o=$@ -ignore="\\.DS_Store|README.md|TRANSLATORS" -pkg=bindata conf/...
  27. less: public/css/gogs.css
  28. public/css/gogs.css: $(LESS_FILES)
  29. lessc $< $@
  30. clean:
  31. go clean -i ./...
  32. clean-mac: clean
  33. find . -name ".DS_Store" -print0 | xargs -0 rm