No terminal window on windows
This commit is contained in:
5
Makefile
5
Makefile
@@ -6,6 +6,7 @@ DIST_DIR := dist
|
||||
NATIVE_GOOS := $(shell go env GOOS)
|
||||
NATIVE_GOARCH := $(shell go env GOARCH)
|
||||
NATIVE_EXT := $(if $(filter windows,$(NATIVE_GOOS)),.exe,)
|
||||
WINDOWS_GUI_LDFLAGS := $(if $(filter windows,$(NATIVE_GOOS)),-ldflags "-H=windowsgui",)
|
||||
|
||||
# Native (current platform)
|
||||
NATIVE_EXE := $(APP_NAME)$(if $(filter windows,$(OS)),.exe,)
|
||||
@@ -23,7 +24,7 @@ $(DIST_DIR):
|
||||
|
||||
build: $(DIST_DIR)
|
||||
@echo "Building $(APP_NAME) for current platform..."
|
||||
go build -trimpath -o $(DIST_DIR)/$(APP_NAME)$(NATIVE_EXT) .
|
||||
go build -trimpath $(WINDOWS_GUI_LDFLAGS) -o $(DIST_DIR)/$(APP_NAME)$(NATIVE_EXT) .
|
||||
|
||||
build-linux: $(DIST_DIR)
|
||||
@echo "Cross-compiling $(APP_NAME) for linux/amd64..."
|
||||
@@ -31,7 +32,7 @@ build-linux: $(DIST_DIR)
|
||||
|
||||
build-windows: $(DIST_DIR)
|
||||
@echo "Cross-compiling $(APP_NAME) for windows/amd64..."
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o $(DIST_DIR)/$(APP_NAME)-windows-amd64.exe .
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags "-H=windowsgui" -o $(DIST_DIR)/$(APP_NAME)-windows-amd64.exe .
|
||||
|
||||
build-all: build-linux build-windows
|
||||
|
||||
|
||||
Reference in New Issue
Block a user