Basic/Base App with Go-Macaron. With user registration/login/logout, one simple admin page and user profile edit. Taken from my git.txt to simplify laters dev app.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. GOPKGNAMEPATH = dev.sigpipe.me/dashie/myapp
  2. LDFLAGS += -X "$(GOPKGNAMEPATH)/setting.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
  3. LDFLAGS += -X "$(GOPKGNAMEPATH)/setting.BuildGitHash=$(shell git rev-parse HEAD)"
  4. OS := $(shell uname)
  5. ifeq ($(OS), Windows_NT)
  6. EXECUTABLE := myapp.exe
  7. else
  8. EXECUTABLE := myapp
  9. endif
  10. DATA_FILES := $(shell find conf | sed 's/ /\\ /g')
  11. DIST := dist
  12. BUILD_FLAGS:=-o $(EXECUTABLE) -v
  13. TAGS=sqlite
  14. NOW=$(shell date -u '+%Y%m%d%I%M%S')
  15. GOVET=go vet
  16. GOLINT=golint -set_exit_status
  17. GO ?= go
  18. GOFILES := $(shell find . -name "*.go" -type f ! -path "./vendor/*" ! -path "*/bindata.go")
  19. PACKAGES ?= $(filter-out ${GOPKGNAMEPATH}/integrations,$(shell go list ./... | grep -v /vendor/))
  20. PACKAGES_ALL ?= $(shell go list ./... | grep -v /vendor/)
  21. SOURCES ?= $(shell find . -name "*.go" -type f)
  22. XGO_DEPS = ""
  23. ifneq ($(DRONE_TAG),)
  24. VERSION ?= $(subst v,,$(DRONE_TAG))
  25. else
  26. ifneq ($(DRONE_BRANCH),)
  27. VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
  28. else
  29. VERSION ?= master
  30. endif
  31. endif
  32. ### Targets build and checks
  33. .PHONY: build clean
  34. all: build
  35. web: build
  36. ./$(EXECUTABLE) web
  37. vet:
  38. $(GOVET) $(EXECUTABLE).go
  39. lint:
  40. @hash golint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  41. $(GO) get -u github.com/golang/lint/golint; \
  42. fi
  43. for PKG in $(PACKAGES_ALL); do golint -set_exit_status $$PKG || exit 1; done;
  44. build:
  45. $(GO) build $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
  46. build-dev: govet
  47. $(GO) build $(BUILD_FLAGS) -tags '$(TAGS)'
  48. build-dev-race: govet
  49. $(GO) build $(BUILD_FLAGS) -race -tags '$(TAGS)'
  50. clean:
  51. $(GO) clean -i ./...
  52. clean-mac: clean
  53. find . -name ".DS_Store" -delete
  54. .PHONY: misspell-check
  55. misspell-check:
  56. @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  57. $(GO) get -u github.com/client9/misspell/cmd/misspell; \
  58. fi
  59. misspell -error -i unknwon $(GOFILES)
  60. .PHONY: misspell
  61. misspell:
  62. @hash misspell > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  63. $(GO) get -u github.com/client9/misspell/cmd/misspell; \
  64. fi
  65. misspell -w -i unknwon $(GOFILES)
  66. ### Targets for tests
  67. check: test
  68. test:
  69. $(GO) test -cover -v $(PACKAGES)
  70. integrations.sqlite.test: $(SOURCES)
  71. $(GO) test -c $(GOPKGNAMEPATH)/integrations -o integrations.sqlite.test -tags 'sqlite'
  72. .PHONY: integrations-sqlite
  73. integrations-sqlite: integrations.sqlite.test
  74. APP_ROOT=${CURDIR} APP_CONF=integrations/sqlite.ini ./integrations.sqlite.test
  75. ### Targets for releases
  76. .PHONY: release
  77. release: release-dirs release-windows release-linux release-copy release-check
  78. .PHONY: release-dirs
  79. release-dirs:
  80. mkdir -p $(DIST)/binaries $(DIST)/release
  81. .PHONY: release-windows
  82. release-windows:
  83. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  84. $(GO) get -u github.com/karalabe/xgo; \
  85. fi
  86. xgo $(XGO_DEPS) --image=xgo-git2go-windows -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out $(EXECUTABLE)-$(VERSION) .
  87. ifeq ($(CI),drone)
  88. mv /build/* $(DIST)/binaries
  89. endif
  90. .PHONY: release-linux
  91. release-linux:
  92. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  93. $(GO) get -u github.com/karalabe/xgo; \
  94. fi
  95. xgo $(XGO_DEPS) --image=xgo-git2go-linux -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'linux/*' -out $(EXECUTABLE)-$(VERSION) .
  96. ifeq ($(CI),drone)
  97. mv /build/* $(DIST)/binaries
  98. endif
  99. # No git2go image available for the moment
  100. .PHONY: release-darwin
  101. release-darwin:
  102. @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
  103. $(GO) get -u github.com/karalabe/xgo; \
  104. fi
  105. xgo $(XGO_DEPS) -dest $(DIST)/binaries -tags 'netgo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin/*' -out $(EXECUTABLE)-$(VERSION) .
  106. ifeq ($(CI),drone)
  107. mv /build/* $(DIST)/binaries
  108. endif
  109. .PHONY: release-copy
  110. release-copy:
  111. $(foreach file,$(wildcard $(DIST)/binaries/$(EXECUTABLE)-*),cp $(file) $(DIST)/release/$(notdir $(file));)
  112. .PHONY: release-check
  113. release-check:
  114. cd $(DIST)/release; $(foreach file,$(wildcard $(DIST)/release/$(EXECUTABLE)-*),sha256sum $(notdir $(file)) > $(notdir $(file)).sha256;)
  115. # This is an ugly hack, we will not need that when xgo will support cmake and sources-order
  116. release-lx64: release-dirs release-build-lx64 release-copy release-check release-pack-lx64
  117. release-build-lx64:
  118. cp $(EXECUTABLE) $(DIST)/binaries/$(EXECUTABLE)-linux-x86_64
  119. cp -r conf $(DIST)/release/
  120. cp README.md LICENSE* $(DIST)/release/
  121. release-pack-lx64:
  122. cd $(DIST)/release; tar czvf $(EXECUTABLE)_$(VERSION).tgz $(EXECUTABLE)-linux-x86_64 conf README.md LICENSE*