2022-10-17 08:32:31 +00:00
|
|
|
GOCMD=go
|
|
|
|
GOBUILD=$(GOCMD) build
|
|
|
|
GOCLEAN=$(GOCMD) clean
|
2023-02-28 06:51:42 +00:00
|
|
|
GOARCH=$(shell go env GOARCH)
|
2024-11-29 07:11:13 +00:00
|
|
|
GOOS=$(shell go env GOOS)
|
2022-10-17 08:32:31 +00:00
|
|
|
|
|
|
|
BASE_PAH := $(shell pwd)
|
|
|
|
BUILD_PATH = $(BASE_PAH)/build
|
|
|
|
WEB_PATH=$(BASE_PAH)/frontend
|
|
|
|
SERVER_PATH=$(BASE_PAH)/backend
|
|
|
|
MAIN= $(BASE_PAH)/cmd/server/main.go
|
|
|
|
APP_NAME=1panel
|
2023-06-08 03:14:10 +00:00
|
|
|
ASSERT_PATH= $(BASE_PAH)/cmd/server/web/assets
|
2023-06-02 06:31:19 +00:00
|
|
|
|
2023-06-08 03:14:10 +00:00
|
|
|
clean_assets:
|
2023-06-02 06:31:19 +00:00
|
|
|
rm -rf $(ASSERT_PATH)
|
|
|
|
|
|
|
|
upx_bin:
|
|
|
|
upx $(BUILD_PATH)/$(APP_NAME)
|
2022-10-17 08:32:31 +00:00
|
|
|
|
2023-04-10 02:35:53 +00:00
|
|
|
build_frontend:
|
2023-06-08 03:14:10 +00:00
|
|
|
cd $(WEB_PATH) && npm install && npm run build:pro
|
2022-10-17 08:32:31 +00:00
|
|
|
|
2023-04-10 02:35:53 +00:00
|
|
|
build_backend_on_linux:
|
2022-10-17 08:32:31 +00:00
|
|
|
cd $(SERVER_PATH) \
|
2023-06-15 15:33:11 +00:00
|
|
|
&& GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
|
2023-02-28 06:51:42 +00:00
|
|
|
|
2023-04-10 02:35:53 +00:00
|
|
|
build_backend_on_darwin:
|
2023-02-28 06:51:42 +00:00
|
|
|
cd $(SERVER_PATH) \
|
2023-06-15 15:33:11 +00:00
|
|
|
&& GOOS=linux GOARCH=amd64 $(GOBUILD) -trimpath -ldflags '-s -w' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
|
2022-10-17 08:32:31 +00:00
|
|
|
|
2023-06-15 15:33:11 +00:00
|
|
|
build_all: build_frontend build_backend_on_linux
|
2023-06-05 05:45:26 +00:00
|
|
|
|
2023-06-15 15:33:11 +00:00
|
|
|
build_on_local: clean_assets build_frontend build_backend_on_darwin upx_bin
|