diff --git a/Makefile b/Makefile index 45ac07c3f..430fd06a0 100644 --- a/Makefile +++ b/Makefile @@ -59,9 +59,6 @@ endif ifeq ($(NOWINE),1) WINE := - WINPATH := wslpath -else - WINPATH := winepath endif ################ Target Executable and Sources ############### diff --git a/arm7/Makefile b/arm7/Makefile index 832c38add..b6147a5f4 100644 --- a/arm7/Makefile +++ b/arm7/Makefile @@ -23,9 +23,17 @@ default: all # If you are using WSL, it is recommended you build with NOWINE=1. WSLENV ?= no ifeq ($(WSLENV),no) -NOWINE = 0 + NOWINE = 0 else -NOWINE = 1 + # As of build 17063, WSLENV is defined in both WSL1 and WSL2 + # so we need to use the kernel release to detect between + # the two. + UNAME_R := $(shell uname -r) + ifeq ($(findstring WSL2,$(UNAME_R)),) + NOWINE = 1 + else + NOWINE = 0 + endif endif ifeq ($(OS),Windows_NT) diff --git a/arm9/Makefile b/arm9/Makefile index 92210a212..d706c1a7f 100644 --- a/arm9/Makefile +++ b/arm9/Makefile @@ -25,9 +25,17 @@ default: all # If you are using WSL, it is recommended you build with NOWINE=1. WSLENV ?= no ifeq ($(WSLENV),no) -NOWINE = 0 + NOWINE = 0 else -NOWINE = 1 + # As of build 17063, WSLENV is defined in both WSL1 and WSL2 + # so we need to use the kernel release to detect between + # the two. + UNAME_R := $(shell uname -r) + ifeq ($(findstring WSL2,$(UNAME_R)),) + NOWINE = 1 + else + NOWINE = 0 + endif endif ifeq ($(OS),Windows_NT) diff --git a/arm9/lib/MSL_C/Makefile b/arm9/lib/MSL_C/Makefile index 67f8b3f63..7d90574a9 100644 --- a/arm9/lib/MSL_C/Makefile +++ b/arm9/lib/MSL_C/Makefile @@ -8,9 +8,17 @@ endif # If you are using WSL, it is recommended you build with NOWINE=1. WSLENV ?= no ifeq ($(WSLENV),no) -NOWINE = 0 + NOWINE = 0 else -NOWINE = 1 + # As of build 17063, WSLENV is defined in both WSL1 and WSL2 + # so we need to use the kernel release to detect between + # the two. + UNAME_R := $(shell uname -r) + ifeq ($(findstring WSL2,$(UNAME_R)),) + NOWINE = 1 + else + NOWINE = 0 + endif endif ifeq ($(OS),Windows_NT) diff --git a/arm9/lib/Makefile b/arm9/lib/Makefile index 05b70a779..591456bfd 100644 --- a/arm9/lib/Makefile +++ b/arm9/lib/Makefile @@ -8,9 +8,17 @@ endif # If you are using WSL, it is recommended you build with NOWINE=1. WSLENV ?= no ifeq ($(WSLENV),no) -NOWINE = 0 + NOWINE = 0 else -NOWINE = 1 + # As of build 17063, WSLENV is defined in both WSL1 and WSL2 + # so we need to use the kernel release to detect between + # the two. + UNAME_R := $(shell uname -r) + ifeq ($(findstring WSL2,$(UNAME_R)),) + NOWINE = 1 + else + NOWINE = 0 + endif endif ifeq ($(OS),Windows_NT) diff --git a/arm9/lib/NitroSDK/Makefile b/arm9/lib/NitroSDK/Makefile index 8aa31d932..84964d6b5 100644 --- a/arm9/lib/NitroSDK/Makefile +++ b/arm9/lib/NitroSDK/Makefile @@ -8,9 +8,17 @@ endif # If you are using WSL, it is recommended you build with NOWINE=1. WSLENV ?= no ifeq ($(WSLENV),no) -NOWINE = 0 + NOWINE = 0 else -NOWINE = 1 + # As of build 17063, WSLENV is defined in both WSL1 and WSL2 + # so we need to use the kernel release to detect between + # the two. + UNAME_R := $(shell uname -r) + ifeq ($(findstring WSL2,$(UNAME_R)),) + NOWINE = 1 + else + NOWINE = 0 + endif endif ifeq ($(OS),Windows_NT) diff --git a/arm9/lib/libnns/Makefile b/arm9/lib/libnns/Makefile index dceb3cc3f..c1c7e92c8 100644 --- a/arm9/lib/libnns/Makefile +++ b/arm9/lib/libnns/Makefile @@ -8,9 +8,17 @@ endif # If you are using WSL, it is recommended you build with NOWINE=1. WSLENV ?= no ifeq ($(WSLENV),no) -NOWINE = 0 + NOWINE = 0 else -NOWINE = 1 + # As of build 17063, WSLENV is defined in both WSL1 and WSL2 + # so we need to use the kernel release to detect between + # the two. + UNAME_R := $(shell uname -r) + ifeq ($(findstring WSL2,$(UNAME_R)),) + NOWINE = 1 + else + NOWINE = 0 + endif endif ifeq ($(OS),Windows_NT)