1 Star 0 Fork 0

Kevin Wang/goon

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 2.48 KB
一键复制 编辑 原始数据 按行查看 历史
Kevin Wang 提交于 2022-05-01 15:25 . dev
include .env
PROJECTNAME=$(shell basename "$(PWD)")
# Go related variables.
# GOBASE=$(shell pwd)
# GOPATH="$(GOBASE)/vendor:$(GOBASE)
# GOBIN=$(GOBASE)/bin
# GOFILES=$(wildcard *.go)
#
# # Redirect error output to a file, so we can show it in development mode.
# STDERR=/tmp/.$(PROJECTNAME)-stderr.txt
#
# # PID file will keep the process id of the server
# PID=/tmp/.$(PROJECTNAME).pid
#
# # Make is verbose in Linux. Make it silent.
# MAKEFLAGS += --silent
#
# ## install: Install missing dependencies. Runs `go get` internally. e.g; make install get=github.com/foo/bar
# install: go-get
#
# ## start: Start in development mode. Auto-starts when code changes.
# start:
# bash -c "trap 'make stop' EXIT; $(MAKE) compile start-server watch run='make compile start-server'"
#
# ## stop: Stop development mode.
## all: Build all the binaries.
all: $(GOBIN)/simple
stop: stop-server
start-server: stop-server
@echo " > $(PROJECTNAME) is available at $(ADDR)"
@-$(GOBIN)/$(PROJECTNAME) 2>&1 & echo $$! > $(PID)
@cat $(PID) | sed "/^/s/^/ \> PID: /"
stop-server:
@-touch $(PID)
@-kill `cat $(PID)` 2> /dev/null || true
@-rm $(PID)
## watch: Run given command when code changes. e.g; make watch run="echo 'hey'"
watch:
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) yolo -i . -e vendor -e bin -c "$(run)"
restart-server: stop-server start-server
## compile: Compile the binary.
compile:
@-touch $(STDERR)
@-rm $(STDERR)
@-$(MAKE) -s go-compile 2> $(STDERR)
@cat $(STDERR) | sed -e '1s/.*/\nError:\n/' | sed 's/make\[.*/ /' | sed "/^/s/^/ /" 1>&2
## exec: Run given command, wrapped with custom GOPATH. e.g; make exec run="go test ./..."
exec:
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) $(run)
## clean: Clean build files. Runs `go clean` internally.
clean: go-clean
go-compile: go-clean go-get go-build
go-build: $(GOBIN)/simple
$(GOBIN)/simple: $(GOBASE)/daemon/simple.go
@echo " > Building $(GOBIN)/simple..."
@go build -o $(GOBIN) $(GOBASE)/daemon/simple.go
go-generate:
@echo " > Generating dependency files..."
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go generate $(generate)
go-get:
@echo " > Checking if there is any missing dependencies..."
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go get $(get)
go-install:
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go install $(GOFILES)
go-clean:
@echo " > Cleaning build cache"
@GOPATH=$(GOPATH) GOBIN=$(GOBIN) go clean
.PHONY: help
help: Makefile
@echo
@echo " Choose a command run in "$(PROJECTNAME)":"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/shandongsite/goon.git
git@gitee.com:shandongsite/goon.git
shandongsite
goon
goon
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385