]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Fix LAYOUT define generation (#4148)
authorDrashna Jaelre <drashna@live.com>
Tue, 16 Oct 2018 18:14:52 +0000 (11:14 -0700)
committerJack Humbert <jack.humb@gmail.com>
Tue, 16 Oct 2018 18:14:52 +0000 (14:14 -0400)
* Fix LAYOUT define generation

Prior to this, only the full keyboard path was defined.  Eg `KEYBOARD_planck_rev6`.
But the docs mention `KEYBOAD_planck`, which never actually gets defined.

This addresses this, and creates a define for each level of the keyboard folder, so that stuff like `KEYBOARD_planck` actually exists.

* Clean up changes to make it more readable

build_keyboard.mk

index a73741bb3eaac4b78be8777376250af4397d65af..d225fe82160a70dc35da00d46c5f9aedc3d8fe24 100644 (file)
@@ -110,8 +110,28 @@ ifneq ("$(wildcard $(KEYBOARD_C_1))","")
     KEYBOARD_SRC += $(KEYBOARD_C_1)
 endif
 
-OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE)
+# Generate KEYBOARD_name_subname for all levels of the keyboard folder
+KEYBOARD_FILESAFE_1 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_1)))
+KEYBOARD_FILESAFE_2 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_2)))
+KEYBOARD_FILESAFE_3 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_3)))
+KEYBOARD_FILESAFE_4 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_4)))
+KEYBOARD_FILESAFE_5 := $(subst .,,$(subst /,_,$(KEYBOARD_FOLDER_PATH_5)))
 
+ifneq ("$(wildcard $(KEYBOARD_PATH_5)/)","")
+    OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_5)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_4)/)","")
+    OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_4)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_3)/)","")
+    OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_3)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_2)/)","")
+    OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_2)
+endif
+ifneq ("$(wildcard $(KEYBOARD_PATH_1)/)","")
+    OPT_DEFS += -DKEYBOARD_$(KEYBOARD_FILESAFE_1)
+endif
 
 # Setup the define for QMK_KEYBOARD_H. This is used inside of keymaps so
 # that the same keymap may be used on multiple keyboards.