1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00
1Panel/Makefile

70 lines
2.3 KiB
Makefile
Raw Normal View History

GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
2023-02-28 14:51:42 +08:00
GOARCH=$(shell go env GOARCH)
GOOS=$(shell go env GOOS )
2024-12-19 22:21:00 +08:00
BASE_PATH := $(shell pwd)
BUILD_PATH = $(BASE_PATH)/build
WEB_PATH=$(BASE_PATH)/frontend
ASSERT_PATH= $(BASE_PATH)/core/cmd/server/web/assets
2024-07-26 15:35:35 +08:00
2024-12-19 22:21:00 +08:00
CORE_PATH=$(BASE_PATH)/core
CORE_MAIN=$(CORE_PATH)/cmd/server/main.go
CORE_NAME=1panel-core
2024-07-26 15:35:35 +08:00
2024-12-19 22:21:00 +08:00
AGENT_PATH=$(BASE_PATH)/agent
AGENT_MAIN=$(AGENT_PATH)/cmd/server/main.go
AGENT_NAME=1panel-agent
2024-07-26 15:35:35 +08:00
2023-06-02 14:31:19 +08:00
2023-06-08 11:14:10 +08:00
clean_assets:
2023-06-02 14:31:19 +08:00
rm -rf $(ASSERT_PATH)
upx_bin:
upx $(BUILD_PATH)/$(CORE_NAME)
upx $(BUILD_PATH)/$(AGENT_NAME)
2023-04-10 10:35:53 +08:00
build_frontend:
2023-06-08 11:14:10 +08:00
cd $(WEB_PATH) && npm install && npm run build:pro
2024-07-26 15:35:35 +08:00
build_core_on_linux:
2024-12-19 22:21:00 +08:00
cd $(CORE_PATH) \
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
2024-07-26 15:35:35 +08:00
build_agent_on_linux:
cd $(AGENT_PATH) \
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
build_core_on_darwin:
2024-12-19 22:21:00 +08:00
cd $(CORE_PATH) \
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
2023-02-28 14:51:42 +08:00
2024-07-26 15:35:35 +08:00
build_agent_on_darwin:
cd $(AGENT_PATH) \
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
2024-07-29 14:13:47 +08:00
build_agent_xpack_on_darwin:
cd $(AGENT_PATH) \
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -tags=xpack -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
build_agent_xpack_on_linux:
cd $(AGENT_PATH) \
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -tags=xpack -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(AGENT_NAME) $(AGENT_MAIN)
build_core_xpack_on_darwin:
2024-12-19 22:21:00 +08:00
cd $(CORE_PATH) \
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -tags=xpack -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
build_core_xpack_on_linux:
2024-12-19 22:21:00 +08:00
cd $(CORE_PATH) \
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -tags=xpack -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(CORE_NAME) $(CORE_MAIN)
2024-07-26 15:35:35 +08:00
build_all: build_frontend build_core_on_linux build_agent_on_linux
build_xpack_all: build_frontend build_core_xpack_on_linux build_agent_xpack_on_linux
2024-07-26 15:35:35 +08:00
build_on_local: clean_assets build_frontend build_core_on_darwin build_agent_on_darwin upx_bin
build_xpack_on_local: clean_assets build_frontend build_core_xpack_on_darwin build_agent_xpack_on_darwin upx_bin