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)
|
|
|
|
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
|
|
|
|
|
|
|
|
build_web:
|
|
|
|
cd $(WEB_PATH) && npm install && npm run build:dev
|
|
|
|
|
|
|
|
build_bin:
|
|
|
|
cd $(SERVER_PATH) \
|
2023-03-08 06:16:30 +00:00
|
|
|
&& CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-static -fpic"' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
|
2023-02-28 06:51:42 +00:00
|
|
|
|
|
|
|
build_linux_on_mac:
|
|
|
|
cd $(SERVER_PATH) \
|
2023-03-08 06:16:30 +00:00
|
|
|
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 CC=x86_64-linux-musl-gcc CXX=x86_64-linux-musl-g++ $(GOBUILD) -trimpath -ldflags '-s -w --extldflags "-static -fpic"' -o $(BUILD_PATH)/$(APP_NAME) $(MAIN)
|
2022-10-17 08:32:31 +00:00
|
|
|
|
2022-11-16 10:27:22 +00:00
|
|
|
build_all: build_web build_bin
|