Rainbond/Makefile

67 lines
1.5 KiB
Makefile
Raw Normal View History

2017-11-22 14:02:29 +08:00
GO_LDFLAGS=-ldflags " -w"
2019-01-30 16:52:12 +08:00
VERSION=master
2017-11-07 11:40:44 +08:00
WORK_DIR=/go/src/github.com/goodrain/rainbond
BASE_NAME=rainbond
2017-11-22 14:02:29 +08:00
BASE_DOCKER=./hack/contrib/docker
2017-11-22 14:02:29 +08:00
default: help
2018-11-07 15:03:36 +08:00
all: image ## build linux binaries, build images for docker
2017-11-07 11:40:44 +08:00
2017-11-22 14:02:29 +08:00
clean:
@rm -rf ${BIN_PATH}/*
2017-11-07 11:40:44 +08:00
2018-07-24 23:20:27 +08:00
ifeq ($(origin WHAT), undefined)
WHAT = all
endif
2018-12-01 16:56:03 +08:00
ifeq ($(origin STATIC), undefined)
STATIC = false
else
STATIC = true
endif
2018-12-05 18:18:38 +08:00
ifeq ($(origin GOOS), undefined)
GOOS = $(shell go env GOOS)
endif
BIN_PATH=./_output/${GOOS}/${VERSION}
2018-11-21 17:35:07 +08:00
ifeq ($(origin PUSH), undefined)
PUSH = false
2019-02-15 18:46:11 +08:00
else
PUSH = push
2018-11-21 17:35:07 +08:00
endif
2018-07-24 23:20:27 +08:00
.PHONY: build
build:
@echo "🐳build ${WHAT} ${GOOS}"
@GOOS=$(GOOS) ./localbuild.sh $(WHAT)
2018-07-24 23:20:27 +08:00
image:
@echo "🐳build image ${WHAT}"
2018-11-21 17:35:07 +08:00
@bash ./release.sh ${WHAT} ${PUSH}
2018-12-01 18:11:32 +08:00
binary:
@echo "🐳build binary ${WHAT} os ${GOOS}"
@ GOOS=${GOOS} bash ./release.sh binary ${WHAT}
2018-12-03 18:10:40 +08:00
run-c:image
test/run/run_${WHAT}.sh
run:build
ifeq ($(WHAT),mq)
2017-11-22 14:02:29 +08:00
${BIN_PATH}/${BASE_NAME}-mq --log-level=debug
2018-07-24 23:20:27 +08:00
else ifeq ($(WHAT),worker)
test/run/run_worker.sh ${BIN_PATH}/${BASE_NAME}-worker
2018-07-24 23:20:27 +08:00
else ifeq ($(WHAT),builder)
${BIN_PATH}/${BASE_NAME}-chaos \
2018-07-10 14:36:36 +08:00
--log-level=debug \
2018-07-24 23:20:27 +08:00
--mysql="root:@tcp(127.0.0.1:3306)/region"
else
2018-12-05 18:18:38 +08:00
test/run/run_${WHAT}.sh ${BIN_PATH}/${BASE_NAME}-$(WHAT)
2018-07-24 23:20:27 +08:00
endif
2017-11-07 11:40:44 +08:00
2018-06-08 18:02:06 +08:00
doc:
2017-11-22 14:02:29 +08:00
@cd cmd/api && swagger generate spec -o ../../hack/contrib/docker/api/html/swagger.json
check:
./check.sh
mock:
@cd db && ./mock.sh && cd dao && ./mock.sh
2017-11-22 14:02:29 +08:00
help: ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
2018-11-07 15:03:36 +08:00