-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
56 lines (37 loc) · 1.69 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
CURRENT_DIR := $(shell pwd)
CONFIG_FILE := $(CURRENT_DIR)/config.yaml
# 设定需要编译的go文件目录
BUILD_EXE_PATH := $(CURRENT_DIR)/app/main.go
PATH_BUILD := $(CURRENT_DIR)/.build
PATH_BUILD_LINUX := $(PATH_BUILD)/linux
PATH_BUILD_WINDOWS := $(PATH_BUILD)/windows
PATH_BUILD_MAC_OS := $(PATH_BUILD)/macos
# 将编译好的执行文件,放入根目录下
ROBOT_CHAT_EXE_PATH:=$(CURRENT_DIR)/robotChat
ROBOT_CHAT_EXE_BUILD_PATH_LINUX := $(PATH_BUILD_LINUX)/robotChat
ROBOT_CHAT_EXE_BUILD_PATH_WINDOWS := $(PATH_BUILD_WINDOWS)/robotChat.exe
ROBOT_CHAT_EXE_BUILD_PATH_MAC_OS := $(PATH_BUILD_MAC_OS)/robotChat
DEPLOY_ROBOT_CHAT_EXE_PATH:=$(CURRENT_DIR)/deploy/robotChat
DEPLOY_ROBOT_CHAT_EXE_BUILD_PATH_WINDOWS:=$(CURRENT_DIR)/deploy/robotChat.exe
# 本地windows运行路径
ROBOT_CHAT_EXE_PATH_WINDOWS := $(CURRENT_DIR)/robotChat.exe
app-init: app-run
#app-init: app-migrate app-seed app-run
#app-init-db: app-migrate app-seed
#app-migrate:
# go build -o $(ROBOT_CHAT_CTL_EXE_PATH) $(BUILD_CTL_PATH)
# $(ROBOT_CHAT_CTL_EXE_PATH) database migrate -f $(CONFIG_FILE)
#
#app-seed:
# go build -o $(ROBOT_CHAT_CTL_EXE_PATH) $(BUILD_CTL_PATH)
# $(ROBOT_CHAT_CTL_EXE_PATH) database seed -f $(CONFIG_FILE)
app-run:
go build -o $(ROBOT_CHAT_EXE_PATH) $(BUILD_EXE_PATH)
$(ROBOT_CHAT_EXE_PATH) -f $(CONFIG_FILE)
# ------
app-build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(ROBOT_CHAT_EXE_BUILD_PATH_LINUX) $(BUILD_EXE_PATH)
#cp $(ROBOT_CHAT_EXE_BUILD_PATH_LINUX) $(DEPLOY_ROBOT_CHAT_EXE_PATH)
app-build-macos:
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o $(ROBOT_CHAT_EXE_BUILD_PATH_MAC_OS) $(BUILD_EXE_PATH)
#cp $(ROBOT_CHAT_EXE_BUILD_PATH_MAC_OS) $(DEPLOY_ROBOT_CHAT_EXE_PATH)