From 6acce16ee3a03df1cc06c46398f594009a0e31b9 Mon Sep 17 00:00:00 2001 From: Sergey Zolotarev Date: Fri, 6 Oct 2023 20:39:21 +0000 Subject: [PATCH] Remove .exe suffix when cross-compiling on Windows (#27448) When compiling GItea for Linux on Windows, you get a `gitea.exe` file as output, but because it's a Linux executable, the `.exe` extension is unnecessary. This PR adds a check for `GOOS` environment variable in addition to `OS`. --- Makefile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index cbf3aff8eb1..0662da5536f 100644 --- a/Makefile +++ b/Makefile @@ -49,10 +49,14 @@ ifeq ($(HAS_GO), yes) CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS) endif -ifeq ($(OS), Windows_NT) - GOFLAGS := -v -buildmode=exe - EXECUTABLE ?= gitea.exe -else ifeq ($(OS), Windows) +ifeq ($(GOOS),windows) + IS_WINDOWS := yes +else ifeq ($(patsubst Windows%,Windows,$(OS)),Windows) + ifeq ($(GOOS),) + IS_WINDOWS := yes + endif +endif +ifeq ($(IS_WINDOWS),yes) GOFLAGS := -v -buildmode=exe EXECUTABLE ?= gitea.exe else