diff --git a/cmd/api/Makefile b/cmd/api/Makefile index 31ad8d958..480c9c298 100644 --- a/cmd/api/Makefile +++ b/cmd/api/Makefile @@ -1,13 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_api +NAME=open_im_api BIN_DIR=../../bin/ - +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -16,10 +27,8 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi - diff --git a/cmd/cmdutils/Makefile b/cmd/cmdutils/Makefile index 0693a4a93..1ed0829fd 100644 --- a/cmd/cmdutils/Makefile +++ b/cmd/cmdutils/Makefile @@ -1,13 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_cmd_utils +NAME=open_im_cmd_utils BIN_DIR=../../bin/ - +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -16,10 +27,8 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi - diff --git a/cmd/crontask/Makefile b/cmd/crontask/Makefile index aca29a89d..4103d7cd5 100644 --- a/cmd/crontask/Makefile +++ b/cmd/crontask/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_cron_task +NAME=open_im_cron_task BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,8 +27,7 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: diff --git a/cmd/msggateway/Makefile b/cmd/msggateway/Makefile index c4e807d5d..0bb3b41f5 100644 --- a/cmd/msggateway/Makefile +++ b/cmd/msggateway/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_msg_gateway +NAME=open_im_msg_gateway BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,8 +27,7 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: diff --git a/cmd/msgtransfer/Makefile b/cmd/msgtransfer/Makefile index 783ad93c7..ca6355aa4 100644 --- a/cmd/msgtransfer/Makefile +++ b/cmd/msgtransfer/Makefile @@ -1,13 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_msg_transfer +NAME=open_im_msg_transfer BIN_DIR=../../bin/ - +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -16,10 +27,8 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi - diff --git a/cmd/push/Makefile b/cmd/push/Makefile index 6f0e394a3..064dd2df1 100644 --- a/cmd/push/Makefile +++ b/cmd/push/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_push +NAME=open_im_push BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,11 +27,8 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi - - diff --git a/cmd/rpc/auth/Makefile b/cmd/rpc/auth/Makefile index 4f5e00dad..d269b2e5e 100644 --- a/cmd/rpc/auth/Makefile +++ b/cmd/rpc/auth/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_auth -BIN_DIR=../../../bin/ +NAME=open_im_auth +BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,10 +27,8 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi - diff --git a/cmd/rpc/conversation/Makefile b/cmd/rpc/conversation/Makefile index 384e66d7e..2be46f72e 100644 --- a/cmd/rpc/conversation/Makefile +++ b/cmd/rpc/conversation/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_conversation -BIN_DIR=../../../bin/ +NAME=open_im_conversation +BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,10 +27,8 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi - diff --git a/cmd/rpc/friend/Makefile b/cmd/rpc/friend/Makefile index 082f52724..b74d12b4d 100644 --- a/cmd/rpc/friend/Makefile +++ b/cmd/rpc/friend/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_friend -BIN_DIR=../../../bin/ +NAME=open_im_friend +BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,8 +27,7 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: diff --git a/cmd/rpc/group/Makefile b/cmd/rpc/group/Makefile index bc9f319cc..93f32e1e5 100644 --- a/cmd/rpc/group/Makefile +++ b/cmd/rpc/group/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_group -BIN_DIR=../../../bin/ +NAME=open_im_group +BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,11 +27,13 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi + + + diff --git a/cmd/rpc/msg/Makefile b/cmd/rpc/msg/Makefile index c4d82d1f4..5d7593f6f 100644 --- a/cmd/rpc/msg/Makefile +++ b/cmd/rpc/msg/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_msg -BIN_DIR=../../../bin/ +NAME=open_im_msg +BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,9 +27,10 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi + + diff --git a/cmd/rpc/third/Makefile b/cmd/rpc/third/Makefile index 8f3b85cb9..b3ada64e5 100644 --- a/cmd/rpc/third/Makefile +++ b/cmd/rpc/third/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_third -BIN_DIR=../../../bin/ +NAME=open_im_third +BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,11 +27,13 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi + + + diff --git a/cmd/rpc/user/Makefile b/cmd/rpc/user/Makefile index df561075c..ecde5e761 100644 --- a/cmd/rpc/user/Makefile +++ b/cmd/rpc/user/Makefile @@ -1,12 +1,24 @@ .PHONY: all build run gotool install clean help -BINARY_NAME=open_im_user -BIN_DIR=../../../bin/ +NAME=open_im_user +BIN_DIR=../../bin/ +OS:= $(or $(os),linux) +ARCH:=$(or $(arch),amd64) all: gotool build +ifeq ($(OS),windows) + +BINARY_NAME=${NAME}.exe + +else + +BINARY_NAME=${NAME} + +endif + build: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o ${BINARY_NAME} + CGO_ENABLED=0 GOOS=${OS} GOARCH=${ARCH}; go build -ldflags="-w -s" -o ${BINARY_NAME} run: @go run ./ @@ -15,11 +27,13 @@ gotool: go fmt ./ go vet ./ -install: - make build +install:build mv ${BINARY_NAME} ${BIN_DIR} clean: @if [ -f ${BINARY_NAME} ] ; then rm ${BINARY_NAME} ; fi + + + diff --git a/script/win_build_all_service.cmd b/script/win_build_all_service.cmd deleted file mode 100644 index 5bbda660e..000000000 --- a/script/win_build_all_service.cmd +++ /dev/null @@ -1,14 +0,0 @@ -SET ROOT=%cd% -mkdir %ROOT%\..\bin\ -cd ..\cmd\open_im_api\ && go build -ldflags="-w -s" && move open_im_api.exe %ROOT%\..\bin\ -cd ..\..\cmd\open_im_msg_gateway\ && go build -ldflags="-w -s" && move open_im_msg_gateway.exe %ROOT%\..\bin\ -cd ..\..\cmd\open_im_msg_transfer\ && go build -ldflags="-w -s" && move open_im_msg_transfer.exe %ROOT%\..\bin\ -cd ..\..\cmd\open_im_push\ && go build -ldflags="-w -s" && move open_im_push.exe %ROOT%\..\bin\ -cd ..\..\..\cmd\rpc\open_im_auth\&& go build -ldflags="-w -s" && move open_im_auth.exe %ROOT%\..\bin\ -cd ..\..\..\cmd\rpc\open_im_conversation\&& go build -ldflags="-w -s" && move open_im_conversation.exe %ROOT%\..\bin\ -cd ..\..\..\cmd\rpc\open_im_friend\&& go build -ldflags="-w -s" && move open_im_friend.exe %ROOT%\..\bin\ -cd ..\..\..\cmd\rpc\open_im_group\&& go build -ldflags="-w -s" && move open_im_group.exe %ROOT%\..\bin\ -cd ..\..\..\cmd\rpc\open_im_msg\&& go build -ldflags="-w -s" && move open_im_msg.exe %ROOT%\..\bin\ -cd ..\..\..\cmd\rpc\open_im_user\&& go build -ldflags="-w -s" && move open_im_user.exe %ROOT%\..\bin\ -cd ..\..\..\cmd\Open-IM-SDK-Core\ws_wrapper\cmd\&& go build -ldflags="-w -s" sdkws_server.go && move sdkws_server.exe %ROOT%\..\bin\ -cd %ROOT% \ No newline at end of file diff --git a/script/win_start_all_service.cmd b/script/win_start_all_service.cmd deleted file mode 100644 index f6ea5ed78..000000000 --- a/script/win_start_all_service.cmd +++ /dev/null @@ -1,15 +0,0 @@ -SET ROOT=%cd% -cd %ROOT%\..\bin\ -start cmd /C .\open_im_api.exe -port 10002 -start cmd /C .\open_im_user.exe -port 10110 -start cmd /C .\open_im_friend.exe -port 10120 -start cmd /C .\open_im_group.exe -port 10150 -start cmd /C .\open_im_auth.exe -port 10160 -start cmd /C .\open_im_message_cms.exe -port 10190 -start cmd /C .\open_im_msg.exe -port 10130 -start cmd /C .\open_im_conversation.exe -port 10230 -start cmd /C .\open_im_push.exe -port 10170 -start cmd /C .\open_im_msg_transfer.exe -start cmd /C .\sdkws_server.exe -openIM_api_port 10002 -openIM_ws_port 10001 -sdkws_port 10003 -openIM_log_level 6 -start cmd /C .\open_im_msg_gateway.exe -rpc_port 10140 -ws_port 10001 -cd %ROOT% \ No newline at end of file