@ -2,6 +2,16 @@ ifndef VERBOSE
.SILENT :
.SILENT :
e n d i f
e n d i f
i f d e f s i l e n t
SILENT = $( silent)
e n d i f
i f d e f S I L E N T
SUB_IS_SILENT := $( silent)
e n d i f
o v e r r i d e SILENT = false
STARTING_MAKEFILE := $( firstword $( MAKEFILE_LIST) )
STARTING_MAKEFILE := $( firstword $( MAKEFILE_LIST) )
ROOT_MAKEFILE := $( lastword $( MAKEFILE_LIST) )
ROOT_MAKEFILE := $( lastword $( MAKEFILE_LIST) )
ROOT_DIR := $( dir $( ROOT_MAKEFILE) )
ROOT_DIR := $( dir $( ROOT_MAKEFILE) )
@ -59,10 +69,10 @@ ifdef keymap
KEYMAP := $( keymap)
KEYMAP := $( keymap)
e n d i f
e n d i f
$(info Keyboard : $( KEYBOARD ) )
#$(info Keyboard: $(KEYBOARD))
$(info Keymap : $( KEYMAP ) )
#$(info Keymap: $(KEYMAP))
$(info Subproject : $( SUBPROJECT ) )
#$(info Subproject: $(SUBPROJECT))
$(info Keyboards : $( KEYBOARDS ) )
#$(info Keyboards: $(KEYBOARDS))
.DEFAULT_GOAL := all
.DEFAULT_GOAL := all
i f n e q ( $( KEYMAP ) , )
i f n e q ( $( KEYMAP ) , )
@ -229,11 +239,14 @@ define PARSE_KEYMAP
endif
endif
KB_SP := $( BOLD) $$ ( KB_SP) $( NO_COLOR)
KB_SP := $( BOLD) $$ ( KB_SP) $( NO_COLOR)
MAKE_VARS := KEYBOARD = $$ ( CURRENT_KB) SUBPROJECT = $$ ( CURRENT_SP) KEYMAP = $$ ( CURRENT_KM)
MAKE_VARS := KEYBOARD = $$ ( CURRENT_KB) SUBPROJECT = $$ ( CURRENT_SP) KEYMAP = $$ ( CURRENT_KM)
MAKE_VARS += VERBOSE = $( VERBOSE) COLOR = $( COLOR) SILENT = false
MAKE_VARS += VERBOSE = $( VERBOSE) COLOR = $( COLOR)
COMMAND_$$ ( COMMAND) := \
MAKE_COMMAND := $$ ( MAKE) -r -R -C $( ROOT_DIR) -f build_keyboard.mk
printf " Compiling $$ (KB_SP) with $( BOLD) $$ (CURRENT_KM) $( NO_COLOR) " | \
MAKE_MSG := Compiling $$ ( KB_SP) with $( BOLD) $$ ( CURRENT_KM) $( NO_COLOR)
$( AWK) '{ printf "%-118s", $$$$0;}' ; \
MAKE_MSG_FORMAT := $( AWK) '{ printf "%-118s", $$$$0;}'
LOG = $$ $$ ( $$ ( MAKE) -r -R -C $( ROOT_DIR) -f build_keyboard.mk $$ ( MAKE_VARS) 2>& 1) ; \
COMMAND_true_$$ ( COMMAND) := \
printf " $$ (MAKE_MSG) " | \
$$ ( MAKE_MSG_FORMAT) ; \
LOG = $$ $$ ( $$ ( MAKE_COMMAND) $$ ( MAKE_VARS) SILENT = true 2>& 1) ; \
if [ $$ $$ ? -gt 0 ] ; \
if [ $$ $$ ? -gt 0 ] ; \
then $$ ( PRINT_ERROR_PLAIN) ; \
then $$ ( PRINT_ERROR_PLAIN) ; \
elif [ " $$ $$ LOG " != "" ] ; \
elif [ " $$ $$ LOG " != "" ] ; \
@ -241,18 +254,30 @@ define PARSE_KEYMAP
else \
else \
$$ ( PRINT_OK) ; \
$$ ( PRINT_OK) ; \
fi ;
fi ;
COMMAND_false_$$ ( COMMAND) := \
printf " $$ (MAKE_MSG)\n " | \
$$ ( MAKE_MSG_FORMAT) ; \
$$ ( MAKE_COMMAND) $$ ( MAKE_VARS) SILENT = false;
e n d e f
e n d e f
d e f i n e P A R S E _ A L L _ K E Y M A P S
d e f i n e P A R S E _ A L L _ K E Y M A P S
$$ ( eval $$ ( call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$ ( KEYMAPS) ) )
$$ ( eval $$ ( call PARSE_ALL_IN_LIST,PARSE_KEYMAP,$$ ( KEYMAPS) ) )
e n d e f
e n d e f
d e f i n e S E T _ S I L E N T _ M O D E
ifdef SUB_IS_SILENT
SILENT_MODE := $( SUB_IS_SILENT)
else ifeq ( $$ ( words $$ ( COMMANDS) ) ,1)
SILENT_MODE := false
else
SILENT_MODE := true
endif
e n d e f
i n c l u d e $( ROOT_DIR ) / m e s s a g e . m k
i n c l u d e $( ROOT_DIR ) / m e s s a g e . m k
#RUN_COMMAND = echo "Running": $(COMMAND_$(COMMAND));
RUN_COMMAND = \
RUN_COMMAND = \
$( COMMAND_ $ ( COMMAND ) )
$( COMMAND_ $ ( SILENT_MODE ) _ $ ( COMMAND ) )
#LOG=$$(echo $(COMMAND) VERBOSE=$(VERBOSE) COLOR=$(COLOR) SILENT=true 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR_PLAIN); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING_PLAIN); else $(PRINT_OK); fi; \
# Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps
# Allow specifying just the subproject, in the keyboard directory, which will compile all keymaps
SUBPROJECTS := $( notdir $( patsubst %/Makefile,%,$( wildcard ./*/Makefile) ) )
SUBPROJECTS := $( notdir $( patsubst %/Makefile,%,$( wildcard ./*/Makefile) ) )
@ -270,6 +295,7 @@ $(SUBPROJECTS): %: %-allkm
esac \
esac \
done
done
$( eval $( call PARSE_RULE,$@ ) )
$( eval $( call PARSE_RULE,$@ ) )
$( eval $( call SET_SILENT_MODE) )
+$( foreach COMMAND,$( COMMANDS) ,$( RUN_COMMAND) )
+$( foreach COMMAND,$( COMMANDS) ,$( RUN_COMMAND) )