aboutsummaryrefslogtreecommitdiff
path: root/message.mk
diff options
context:
space:
mode:
Diffstat (limited to 'message.mk')
-rw-r--r--message.mk71
1 files changed, 71 insertions, 0 deletions
diff --git a/message.mk b/message.mk
new file mode 100644
index 000000000..fb1a7a1f9
--- /dev/null
+++ b/message.mk
@@ -0,0 +1,71 @@
1COLOR ?= true
2
3ifeq ($(COLOR),true)
4 NO_COLOR=\033[0m
5 OK_COLOR=\033[32;01m
6 ERROR_COLOR=\033[31;01m
7 WARN_COLOR=\033[33;01m
8 BLUE=\033[0;34m
9 BOLD=\033[1m
10endif
11
12ifneq ($(shell awk --version 2>/dev/null),)
13 AWK=awk
14else
15 AWK=cat && test
16endif
17
18ON_ERROR ?= exit 1
19
20OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n
21ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n
22WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n
23
24TAB_LOG = printf "\n$$LOG\n\n" | $(AWK) '{ sub(/^/," | "); print }'
25TAB_LOG_PLAIN = printf "$$LOG\n"
26AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }'
27AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }'
28PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && $(ON_ERROR)
29PRINT_WARNING = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG)
30PRINT_ERROR_PLAIN = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN) && $(ON_ERROR)
31PRINT_WARNING_PLAIN = ($(SILENT) || printf " $(WARN_STRING)" | $(AWK_STATUS)) && $(TAB_LOG_PLAIN)
32PRINT_OK = $(SILENT) || printf " $(OK_STRING)" | $(AWK_STATUS)
33BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [ "$$LOG" != "" ] ; then $(PRINT_WARNING); else $(PRINT_OK); fi;
34MAKE_MSG_FORMAT = $(AWK) '{ printf "%-118s", $$0;}'
35
36# Define Messages
37# English
38MSG_ERRORS_NONE = Errors: none
39MSG_ERRORS = $(ERROR_COLOR)Make finished with errors\n$(NO_COLOR)
40MSG_BEGIN = -------- begin --------
41MSG_END = -------- end --------
42MSG_SIZE_BEFORE = Size before:
43MSG_SIZE_AFTER = Size after:
44MSG_COFF = Converting to AVR COFF:
45MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
46MSG_FLASH = Creating load file for Flash:
47MSG_EEPROM = Creating load file for EEPROM:
48MSG_BIN = Creating binary load file for Flash:
49MSG_EXTENDED_LISTING = Creating Extended Listing:
50MSG_SYMBOL_TABLE = Creating Symbol Table:
51MSG_LINKING = Linking:
52MSG_COMPILING = Compiling:
53MSG_COMPILING_CPP = Compiling:
54MSG_ASSEMBLING = Assembling:
55MSG_CLEANING = Cleaning project:
56MSG_CREATING_LIBRARY = Creating library:
57MSG_SUBMODULE_DIRTY = $(WARN_COLOR)WARNING:$(NO_COLOR)\n \
58 Some git sub-modules are out of date or modified, please consider runnning:$(BOLD)\n\
59 git submodule sync --recursive\n\
60 git submodule update --init --recursive$(NO_COLOR)\n\n\
61 You can ignore this warning if you are not compiling any ChibiOS keyboards,\n\
62 or if you have modified the ChibiOS libraries yourself. \n\n
63MSG_NO_CMP = $(ERROR_COLOR)Error:$(NO_COLOR)$(BOLD) cmp command not found, please install diffutils\n$(NO_COLOR)
64
65define GENERATE_MSG_MAKE_KB
66 MSG_MAKE_KB_ACTUAL := Making $$(KB_SP) with keymap $(BOLD)$$(CURRENT_KM)$(NO_COLOR)
67 ifneq ($$(MAKE_TARGET),)
68 MSG_MAKE_KB_ACTUAL += and target $(BOLD)$$(MAKE_TARGET)$(NO_COLOR)
69 endif
70endef
71MSG_MAKE_KB = $(eval $(call GENERATE_MSG_MAKE_KB))$(MSG_MAKE_KB_ACTUAL)