Browse Source

Fix userspace detection in Makefile (#26117)

Joel Challis 4 months ago
parent
commit
9d24bc8a33
1 changed files with 7 additions and 5 deletions
  1. 7 5
      Makefile

+ 7 - 5
Makefile

@@ -38,14 +38,16 @@ $(info QMK Firmware $(QMK_VERSION))
 endif
 endif
 
-# Try to determine userspace from qmk config, if set.
-ifeq ($(QMK_USERSPACE),)
-    QMK_USERSPACE = $(shell qmk config -ro user.overlay_dir | cut -d= -f2 | sed -e 's@^None$$@@g')
-endif
-
 # Determine which qmk cli to use
 QMK_BIN := qmk
 
+# Try to determine userspace from qmk config, if set. Handle direct query on qmk_cli>=1.1.7
+# falling back to legacy method of only supporting user.overlay_dir config
+export override QMK_USERSPACE := $(shell \
+    $(QMK_BIN) env | grep -q QMK_USERSPACE \
+        && $(QMK_BIN) env QMK_USERSPACE \
+        || $(QMK_BIN) config -ro user.overlay_dir | cut -d= -f2 | sed -e 's@^None$$@@g')
+
 # avoid 'Entering|Leaving directory' messages
 MAKEFLAGS += --no-print-directory