]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Add default subproject parsing
authorFred Sundvik <fsundvik@gmail.com>
Sun, 7 Aug 2016 13:45:33 +0000 (16:45 +0300)
committerFred Sundvik <fsundvik@gmail.com>
Sat, 20 Aug 2016 00:24:40 +0000 (03:24 +0300)
Makefile

index a03421365312b5bc75a2439d894c8c7bcd2b621c..1e11dd5ff8591509a536e354743ba9ce159ab4b3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,8 @@ STARTING_DIR := $(subst $(ABS_ROOT_DIR),,$(ABS_STARTING_DIR))
 
 PATH_ELEMENTS := $(subst /, ,$(STARTING_DIR))
 
+QUANTUM_DIR:=$(ROOT_DIR)/quantum
+
 define NEXT_PATH_ELEMENT
     $$(eval CURRENT_PATH_ELEMENT := $$(firstword  $$(PATH_ELEMENTS)))
     $$(eval PATH_ELEMENTS := $$(wordlist  2,9999,$$(PATH_ELEMENTS)))
@@ -111,8 +113,14 @@ define PARSE_KEYBOARD
     SUBPROJECTS := $$(notdir $$(patsubst %/Makefile,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/*/Makefile)))
     ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,allsp),true)
         $$(eval $$(call PARSE_ALL_SUBPROJECTS))
+    else ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,defaultsp),true)
+        $$(eval $$(call PARSE_SUBPROJECT,defaultsp))
     else ifeq ($$(call TRY_TO_MATCH_RULE_FROM_LIST,$$(SUBPROJECTS)),true)
         $$(eval $$(call PARSE_SUBPROJECT,$$(MATCHED_ITEM)))
+    else 
+        # If there's no matching subproject, we assume it's the default
+        # This will allow you to leave the subproject part of the target out
+        $$(eval $$(call PARSE_SUBPROJECT,defaultsp))
     endif
 endef
 
@@ -122,7 +130,12 @@ endef
 
 # $1 Subproject
 define PARSE_SUBPROJECT
-    CURRENT_SP := $1
+    ifeq ($1,defaultsp)
+        $$(eval include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/Makefile)
+        CURRENT_SP := $$(SUBPROJECT_DEFAULT)
+    else
+        CURRENT_SP := $1
+    endif
     KEYMAPS := $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/keymaps/*/.)))
     ifeq ($$(call COMPARE_AND_REMOVE_FROM_RULE,allkm),true)
         $$(eval $$(call PARSE_ALL_KEYMAPS))
@@ -133,7 +146,7 @@ endef
 
 define PARSE_ALL_SUBPROJECTS
     ifeq ($$(SUBPROJECTS),)
-        $$(eval $$(call PARSE_SUBPROJECT,))
+        $$(eval $$(call PARSE_SUBPROJECT,defaultsp))
     else
         $$(eval $$(call PARSE_ALL_IN_LIST,PARSE_SUBPROJECT,$$(SUBPROJECTS)))
     endif