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

35 lines
923 B
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)
2024-11-29 15:11:13 +08:00
GOOS=$(shell go env GOOS)
2024-12-11 16:07:26 +08:00
BASE_PATH := $(shell pwd)
BUILD_PATH = $(BASE_PATH)/build
WEB_PATH=$(BASE_PATH)/frontend
SERVER_PATH=$(BASE_PATH)/backend
MAIN= $(BASE_PATH)/cmd/server/main.go
APP_NAME=1panel
2024-12-11 16:07:26 +08:00
ASSERT_PATH= $(BASE_PATH)/cmd/server/web/assets
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)/$(APP_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
2023-04-10 10:35:53 +08:00
build_backend_on_linux:
cd $(SERVER_PATH) \
2023-06-15 23:33:11 +08:00
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
2023-02-28 14:51:42 +08:00
2023-04-10 10:35:53 +08:00
build_backend_on_darwin:
2023-02-28 14:51:42 +08:00
cd $(SERVER_PATH) \
2023-06-15 23:33:11 +08:00
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
2023-06-15 23:33:11 +08:00
build_all: build_frontend build_backend_on_linux
2023-06-15 23:33:11 +08:00
build_on_local: clean_assets build_frontend build_backend_on_darwin upx_bin