]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Continue on error
authorFred Sundvik <fsundvik@gmail.com>
Tue, 16 Aug 2016 05:42:08 +0000 (08:42 +0300)
committerFred Sundvik <fsundvik@gmail.com>
Sat, 20 Aug 2016 00:56:43 +0000 (03:56 +0300)
Makefile
message.mk

index ed89b07337a31a37837e5a25aa48728e2d649218..f80d4e99c805ac20821d57eed8f9b98296344d98 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,8 @@ endif
 
 override SILENT = false
 
+ON_ERROR := error_occured=1
+
 STARTING_MAKEFILE := $(firstword $(MAKEFILE_LIST))
 ROOT_MAKEFILE := $(lastword $(MAKEFILE_LIST))
 ROOT_DIR := $(dir $(ROOT_MAKEFILE))
@@ -302,7 +304,9 @@ $(SUBPROJECTS): %: %-allkm
        done
        $(eval $(call PARSE_RULE,$@))
        $(eval $(call SET_SILENT_MODE))
-       +$(foreach COMMAND,$(COMMANDS),$(RUN_COMMAND))
+       +error_occured=0; \
+       $(foreach COMMAND,$(COMMANDS),$(RUN_COMMAND)) \
+       if [ $$error_occured -gt 0 ]; then printf "$(MSG_ERRORS)" & exit $$error_occured; fi
        
 
 .PHONY: all
index 6abc782152b7ee7a52892db08541fa1121ec6acb..f8fd387121ff28d0d3cc1ff8d4b52efab691d49b 100644 (file)
@@ -15,6 +15,8 @@ else
        AWK=cat && test
 endif
 
+ON_ERROR ?= exit 1
+
 OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
 ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
 WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
@@ -23,9 +25,9 @@ TAB_LOG = printf "\n$$LOG\n\n" | $(AWK) '{ sub(/^/," | "); print }'
 TAB_LOG_PLAIN = printf "$$LOG\n"
 AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
 AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }'
-PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && exit 1
+PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && $(ON_ERROR)
 PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
-PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && exit 1
+PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR)
 PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
 PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
 BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
@@ -34,6 +36,7 @@ MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, pleas
 # Define Messages
 # English
 MSG_ERRORS_NONE = Errors: none
+MSG_ERRORS = $(ERROR_COLOR)Make finished with errors\n$(NO_COLOR)
 MSG_BEGIN = -------- begin --------
 MSG_END = --------  end  --------
 MSG_SIZE_BEFORE = Size before: