@ -5,8 +5,9 @@ endif
.DEFAULT_GOAL := all
.DEFAULT_GOAL := all
space := $( subst ,, )
space := $( subst ,, )
starting_makefile := $( subst $( space) ,_SPACE_,$( abspath $( firstword $( MAKEFILE_LIST) ) ) )
ESCAPED_ABS_PATH = $( subst $( space) ,_SPACE_,$( abspath $1 ) )
mkfile_path := $( subst $( space) ,_SPACE_,$( abspath $( lastword $( MAKEFILE_LIST) ) ) )
starting_makefile := $( call ESCAPED_ABS_PATH,$( firstword $( MAKEFILE_LIST) ) )
mkfile_path := $( call ESCAPED_ABS_PATH,$( lastword $( MAKEFILE_LIST) ) ) )
abs_tmk_root := $( patsubst %/,%,$( dir $( mkfile_path) ) )
abs_tmk_root := $( patsubst %/,%,$( dir $( mkfile_path) ) )
i f n e q ( , $( findstring /keyboards /,$ ( starting_makefile ) ) )
i f n e q ( , $( findstring /keyboards /,$ ( starting_makefile ) ) )
@ -83,10 +84,8 @@ endif
i f n e q ( "$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)" , "" )
i f n e q ( "$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)" , "" )
KEYBOARD_FILE = keyboards/$( KEYBOARD) /$( KEYBOARD) .c
KEYBOARD_FILE = keyboards/$( KEYBOARD) /$( KEYBOARD) .c
ifndef ARCH
ifneq ( $( call ESCAPED_ABS_PATH,$( KEYBOARD_PATH) /Makefile) ,$( starting_makefile) )
ifneq ( " $( wildcard $( KEYBOARD_PATH) /Makefile) " ,"" )
-include $( KEYBOARD_PATH) /Makefile
include $( KEYBOARD_PATH) /Makefile
endif
endif
endif
e l s e
e l s e
$( error "$ ( KEYBOARD_PATH ) /$ ( KEYBOARD ) .c " does not exist )
$( error "$ ( KEYBOARD_PATH ) /$ ( KEYBOARD ) .c " does not exist )
@ -101,7 +100,9 @@ ifdef SUBPROJECT
ifneq ( " $( wildcard $( SUBPROJECT_PATH) /$( SUBPROJECT) .c) " ,"" )
ifneq ( " $( wildcard $( SUBPROJECT_PATH) /$( SUBPROJECT) .c) " ,"" )
OPT_DEFS += -DSUBPROJECT_$( SUBPROJECT)
OPT_DEFS += -DSUBPROJECT_$( SUBPROJECT)
SUBPROJECT_FILE = keyboards/$( KEYBOARD) /$( SUBPROJECT) /$( SUBPROJECT) .c
SUBPROJECT_FILE = keyboards/$( KEYBOARD) /$( SUBPROJECT) /$( SUBPROJECT) .c
ifneq ( $( call ESCAPED_ABS_PATH,$( SUBPROJECT_PATH) /Makefile) ,$( starting_makefile) )
-include $( SUBPROJECT_PATH) /Makefile
-include $( SUBPROJECT_PATH) /Makefile
endif
else
else
$( error "$ ( SUBPROJECT_PATH ) /$ ( SUBPROJECT ) .c " does not exist )
$( error "$ ( SUBPROJECT_PATH ) /$ ( SUBPROJECT ) .c " does not exist )
endif
endif
@ -119,16 +120,20 @@ endif
KEYMAP_PATH = $( KEYBOARD_PATH) /keymaps/$( KEYMAP)
KEYMAP_PATH = $( KEYBOARD_PATH) /keymaps/$( KEYMAP)
i f n e q ( "$(wildcard $(KEYMAP_PATH)/keymap.c)" , "" )
i f n e q ( "$(wildcard $(KEYMAP_PATH)/keymap.c)" , "" )
KEYMAP_FILE = keyboards/$( KEYBOARD) /keymaps/$( KEYMAP) /keymap.c
KEYMAP_FILE = keyboards/$( KEYBOARD) /keymaps/$( KEYMAP) /keymap.c
ifneq ( $( call ESCAPED_ABS_PATH,$( KEYMAP_PATH) /Makefile) ,$( starting_makefile) )
-include $( KEYMAP_PATH) /Makefile
-include $( KEYMAP_PATH) /Makefile
endif
e l s e
e l s e
ifeq ( " $( wildcard $( SUBPROJECT_PATH) /keymaps/$( KEYMAP) /keymap.c) " ,"" )
ifeq ( " $( wildcard $( SUBPROJECT_PATH) /keymaps/$( KEYMAP) /keymap.c) " ,"" )
$( error "$ ( KEYMAP_PATH ) /keymap .c " does not exist )
$( error "$ ( KEYMAP_PATH ) /keymap .c " does not exist )
else
else
KEYMAP_PATH = $( SUBPROJECT_PATH) /keymaps/$( KEYMAP)
KEYMAP_PATH = $( SUBPROJECT_PATH) /keymaps/$( KEYMAP)
KEYMAP_FILE = keyboards/$( KEYBOARD) /$( SUBPROJECT) /keymaps/$( KEYMAP) /keymap.c
KEYMAP_FILE = keyboards/$( KEYBOARD) /$( SUBPROJECT) /keymaps/$( KEYMAP) /keymap.c
ifneq ( $( call ESCAPED_ABS_PATH,$( KEYMAP_PATH) /Makefile) ,$( starting_makefile) )
-include $( KEYMAP_PATH) /Makefile
-include $( KEYMAP_PATH) /Makefile
endif
endif
endif
endif
e n d i f
i f d e f S U B P R O J E C T
i f d e f S U B P R O J E C T
TARGET ?= $( KEYBOARD) _$( SUBPROJECT) _$( KEYMAP)
TARGET ?= $( KEYBOARD) _$( SUBPROJECT) _$( KEYMAP)