2016-08-08 06:16:06 +08:00
|
|
|
COLOR ?= true
|
|
|
|
|
|
|
|
ifeq ($(COLOR),true)
|
|
|
|
NO_COLOR=\033[0m
|
|
|
|
OK_COLOR=\033[32;01m
|
|
|
|
ERROR_COLOR=\033[31;01m
|
|
|
|
WARN_COLOR=\033[33;01m
|
|
|
|
BLUE=\033[0;34m
|
|
|
|
BOLD=\033[1m
|
|
|
|
endif
|
|
|
|
|
2017-12-01 10:18:32 +08:00
|
|
|
ifneq ($(shell echo "1 2 3" | awk '{ printf "%2s", $$3; }' 2>/dev/null)," 3")
|
2016-08-08 06:16:06 +08:00
|
|
|
AWK=awk
|
|
|
|
else
|
|
|
|
AWK=cat && test
|
|
|
|
endif
|
|
|
|
|
2016-08-16 13:42:08 +08:00
|
|
|
ON_ERROR ?= exit 1
|
|
|
|
|
2016-08-08 06:16:06 +08:00
|
|
|
OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
|
|
|
|
ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
|
|
|
|
WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
|
|
|
|
|
2017-07-12 18:04:50 +08:00
|
|
|
TAB_LOG = printf "\n%s\n\n" "$$LOG" | $(AWK) '{ sub(/^/," | "); print }'
|
|
|
|
TAB_LOG_PLAIN = printf "%s\n" "$$LOG"
|
2016-08-08 06:16:06 +08:00
|
|
|
AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
|
|
|
|
AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }'
|
2016-08-16 13:42:08 +08:00
|
|
|
PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && $(ON_ERROR)
|
2016-08-08 06:16:06 +08:00
|
|
|
PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
|
2016-08-16 13:42:08 +08:00
|
|
|
PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR)
|
2016-08-08 06:16:06 +08:00
|
|
|
PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
|
|
|
|
PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
|
2016-08-08 15:26:23 +08:00
|
|
|
BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
|
2016-08-20 19:53:29 +08:00
|
|
|
MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}'
|
2016-08-15 13:20:16 +08:00
|
|
|
|
|
|
|
# Define Messages
|
|
|
|
# English
|
|
|
|
MSG_ERRORS_NONE = Errors: none
|
2016-08-16 13:42:08 +08:00
|
|
|
MSG_ERRORS = $(ERROR_COLOR)Make finished with errors\n$(NO_COLOR)
|
2016-08-15 13:20:16 +08:00
|
|
|
MSG_BEGIN = -------- begin --------
|
|
|
|
MSG_END = -------- end --------
|
|
|
|
MSG_SIZE_BEFORE = Size before:
|
|
|
|
MSG_SIZE_AFTER = Size after:
|
|
|
|
MSG_COFF = Converting to AVR COFF:
|
|
|
|
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
|
2017-11-28 12:08:21 +08:00
|
|
|
MSG_FLASH = Creating load file for flashing:
|
2016-08-15 13:20:16 +08:00
|
|
|
MSG_EEPROM = Creating load file for EEPROM:
|
2017-11-28 12:08:21 +08:00
|
|
|
MSG_BIN = Creating binary load file for flashing:
|
2016-08-15 13:20:16 +08:00
|
|
|
MSG_EXTENDED_LISTING = Creating Extended Listing:
|
|
|
|
MSG_SYMBOL_TABLE = Creating Symbol Table:
|
|
|
|
MSG_LINKING = Linking:
|
|
|
|
MSG_COMPILING = Compiling:
|
|
|
|
MSG_COMPILING_CPP = Compiling:
|
|
|
|
MSG_ASSEMBLING = Assembling:
|
|
|
|
MSG_CLEANING = Cleaning project:
|
|
|
|
MSG_CREATING_LIBRARY = Creating library:
|
|
|
|
MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \
|
2018-08-10 08:41:07 +08:00
|
|
|
Some git sub-modules are out of date or modified, please consider running:$(BOLD)\n\
|
2017-09-07 06:21:31 +08:00
|
|
|
make git-submodule\n\
|
2016-08-15 13:20:16 +08:00
|
|
|
You can ignore this warning if you are not compiling any ChibiOS keyboards,\n\
|
2018-01-09 07:11:26 +08:00
|
|
|
or if you have modified the ChibiOS libraries yourself. \n\n$(NO_COLOR)
|
2016-08-20 19:53:29 +08:00
|
|
|
MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)
|
|
|
|
|
|
|
|
define GENERATE_MSG_MAKE_KB
|
|
|
|
MSG_MAKE_KB_ACTUAL := Making $$(KB_SP) with keymap $(BOLD)$$(CURRENT_KM)$(NO_COLOR)
|
|
|
|
ifneq ($$(MAKE_TARGET),)
|
|
|
|
MSG_MAKE_KB_ACTUAL += and target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
MSG_MAKE_KB = $(eval $(call GENERATE_MSG_MAKE_KB))$(MSG_MAKE_KB_ACTUAL)
|
2016-08-21 22:14:38 +08:00
|
|
|
define GENERATE_MSG_MAKE_TEST
|
|
|
|
MSG_MAKE_TEST_ACTUAL := Making test $(BOLD)$(TEST_NAME)$(NO_COLOR)
|
|
|
|
ifneq ($$(MAKE_TARGET),)
|
|
|
|
MSG_MAKE_TEST_ACTUAL += with target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
MSG_MAKE_TEST = $(eval $(call GENERATE_MSG_MAKE_TEST))$(MSG_MAKE_TEST_ACTUAL)
|
2016-08-27 19:53:57 +08:00
|
|
|
MSG_TEST = Testing $(BOLD)$(TEST_NAME)$(NO_COLOR)
|
2017-11-28 12:08:21 +08:00
|
|
|
MSG_CHECK_FILESIZE = Checking file size of $(TARGET).hex
|
2018-08-16 20:35:24 +08:00
|
|
|
MSG_FILE_TOO_BIG = $(ERROR_COLOR)Your file is too big!$(NO_COLOR) $(CURRENT_SIZE)/$(MAX_SIZE) ($(OVER_SIZE) over)\n
|
2017-11-28 12:08:21 +08:00
|
|
|
MSG_FILE_TOO_SMALL = Your file is too small! $(CURRENT_SIZE)/$(MAX_SIZE)\n
|
2018-08-16 20:35:24 +08:00
|
|
|
MSG_FILE_JUST_RIGHT = File size is fine - $(CURRENT_SIZE)/$(MAX_SIZE) ($(FREE_SIZE) free)\n
|