Skip to content

Commit 6acce16

Browse files
authored
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`.
1 parent e820d99 commit 6acce16

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ ifeq ($(HAS_GO), yes)
4949
CGO_CFLAGS ?= $(shell $(GO) env CGO_CFLAGS) $(CGO_EXTRA_CFLAGS)
5050
endif
5151

52-
ifeq ($(OS), Windows_NT)
53-
GOFLAGS := -v -buildmode=exe
54-
EXECUTABLE ?= gitea.exe
55-
else ifeq ($(OS), Windows)
52+
ifeq ($(GOOS),windows)
53+
IS_WINDOWS := yes
54+
else ifeq ($(patsubst Windows%,Windows,$(OS)),Windows)
55+
ifeq ($(GOOS),)
56+
IS_WINDOWS := yes
57+
endif
58+
endif
59+
ifeq ($(IS_WINDOWS),yes)
5660
GOFLAGS := -v -buildmode=exe
5761
EXECUTABLE ?= gitea.exe
5862
else

0 commit comments

Comments
 (0)