mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Makefile.include: refactor command present check
Refactor the code checking if command is present. Message is taken from the compiler check as it was more precise than the others.
This commit is contained in:
parent
21a9958323
commit
fce7a5409d
@ -337,11 +337,17 @@ endif
|
|||||||
endif
|
endif
|
||||||
endif # BUILD_IN_DOCKER
|
endif # BUILD_IN_DOCKER
|
||||||
|
|
||||||
|
# Check given command is available in the path
|
||||||
|
# check_cmd 'command' 'description'
|
||||||
|
define check_cmd
|
||||||
|
@command -v $1 >/dev/null 2>&1 || \
|
||||||
|
{ $(COLOR_ECHO) \
|
||||||
|
'$(COLOR_RED)$2 $1 is required but not found in PATH. Aborting.$(COLOR_RESET)'; \
|
||||||
|
exit 1;}
|
||||||
|
endef
|
||||||
|
|
||||||
..compiler-check:
|
..compiler-check:
|
||||||
@command -v $(CC) >/dev/null 2>&1 || \
|
$(call check_cmd,$(CC),Compiler)
|
||||||
{ $(COLOR_ECHO) \
|
|
||||||
'$(COLOR_RED)Compiler $(CC) is required but not found in PATH. Aborting.$(COLOR_RESET)'; \
|
|
||||||
exit 1; }
|
|
||||||
|
|
||||||
..build-message:
|
..build-message:
|
||||||
@$(COLOR_ECHO) '$(COLOR_GREEN)Building application "$(APPLICATION)" for "$(BOARD)" with MCU "$(MCU)".$(COLOR_RESET)'
|
@$(COLOR_ECHO) '$(COLOR_GREEN)Building application "$(APPLICATION)" for "$(BOARD)" with MCU "$(MCU)".$(COLOR_RESET)'
|
||||||
@ -400,10 +406,7 @@ ifeq (,$(filter flash-only, $(MAKECMDGOALS)))
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
flash: $(BUILD_BEFORE_FLASH) $(FLASHDEPS)
|
flash: $(BUILD_BEFORE_FLASH) $(FLASHDEPS)
|
||||||
@command -v $(FLASHER) >/dev/null 2>&1 || \
|
$(call check_cmd,$(FLASHER),Flash program)
|
||||||
{ $(COLOR_ECHO) \
|
|
||||||
'$(COLOR_RED)Flash program $(FLASHER) not found. Aborting.$(COLOR_RESET)'; \
|
|
||||||
exit 1; }
|
|
||||||
$(FLASHER) $(FFLAGS)
|
$(FLASHER) $(FFLAGS)
|
||||||
|
|
||||||
flash-only: flash
|
flash-only: flash
|
||||||
@ -412,10 +415,7 @@ preflash: $(BUILD_BEFORE_FLASH)
|
|||||||
$(PREFLASHER) $(PREFFLAGS)
|
$(PREFLASHER) $(PREFFLAGS)
|
||||||
|
|
||||||
term: $(filter flash, $(MAKECMDGOALS)) $(TERMDEPS)
|
term: $(filter flash, $(MAKECMDGOALS)) $(TERMDEPS)
|
||||||
@command -v $(TERMPROG) >/dev/null 2>&1 || \
|
$(call check_cmd,$(TERMPROG),Terminal program)
|
||||||
{ $(COLOR_ECHO) \
|
|
||||||
'$(COLOR_RED)Terminal program $(TERMPROG) not found. Aborting.$(COLOR_RESET)'; \
|
|
||||||
exit 1; }
|
|
||||||
$(TERMPROG) $(TERMFLAGS)
|
$(TERMPROG) $(TERMFLAGS)
|
||||||
|
|
||||||
list-ttys:
|
list-ttys:
|
||||||
@ -425,41 +425,26 @@ doc:
|
|||||||
make -BC $(RIOTBASE) doc
|
make -BC $(RIOTBASE) doc
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
@command -v $(DEBUGGER) >/dev/null 2>&1 || \
|
$(call check_cmd,$(DEBUGGER),Debug program)
|
||||||
{ $(COLOR_ECHO) \
|
|
||||||
'$(COLOR_RED)Debug program $(DEBUGGER) not found. Aborting.$(COLOR_RESET)'; \
|
|
||||||
exit 1; }
|
|
||||||
$(DEBUGGER) $(DEBUGGER_FLAGS)
|
$(DEBUGGER) $(DEBUGGER_FLAGS)
|
||||||
|
|
||||||
debug-server:
|
debug-server:
|
||||||
@command -v $(DEBUGSERVER) >/dev/null 2>&1 || \
|
$(call check_cmd,$(DEBUGSERVER),Debug server program)
|
||||||
{ $(COLOR_ECHO) \
|
|
||||||
'$(COLOR_RED)Debug server program $(DEBUGSERVER) not found. Aborting.$(COLOR_RESET)'; \
|
|
||||||
exit 1; }
|
|
||||||
$(DEBUGSERVER) $(DEBUGSERVER_FLAGS)
|
$(DEBUGSERVER) $(DEBUGSERVER_FLAGS)
|
||||||
|
|
||||||
emulate:
|
emulate:
|
||||||
@command -v $(EMULATOR) >/dev/null 2>&1 || \
|
$(call check_cmd,$(EMULATOR),Emulation program)
|
||||||
{ $(COLOR_ECHO) \
|
|
||||||
'$(COLOR_RED)Emulation program $(EMULATOR) not found. Aborting.$(COLOR_RESET)'; \
|
|
||||||
exit 1; }
|
|
||||||
$(EMULATOR) $(EMULATOR_FLAGS)
|
$(EMULATOR) $(EMULATOR_FLAGS)
|
||||||
|
|
||||||
reset:
|
reset:
|
||||||
@command -v $(RESET) >/dev/null 2>&1 || \
|
$(call check_cmd,$(RESET),Reset program)
|
||||||
{ $(COLOR_ECHO) \
|
|
||||||
'$(COLOR_RED)Reset program $(RESET) not found. Aborting.$(COLOR_RESET)'; \
|
|
||||||
exit 1; }
|
|
||||||
$(RESET) $(RESET_FLAGS)
|
$(RESET) $(RESET_FLAGS)
|
||||||
|
|
||||||
# Default OBJDUMPFLAGS for platforms which do not specify it:
|
# Default OBJDUMPFLAGS for platforms which do not specify it:
|
||||||
OBJDUMPFLAGS ?= -S -D -h
|
OBJDUMPFLAGS ?= -S -D -h
|
||||||
|
|
||||||
objdump:
|
objdump:
|
||||||
@command -v $(OBJDUMP) >/dev/null 2>&1 || \
|
$(call check_cmd,$(OBJDUMP),Objdump program)
|
||||||
{ $(COLOR_ECHO) \
|
|
||||||
'$(COLOR_RED)Objdump program $(OBJDUMP) not found. Aborting.$(COLOR_RESET)'; \
|
|
||||||
exit 1; }
|
|
||||||
$(OBJDUMP) $(OBJDUMPFLAGS) $(ELFFILE) | less
|
$(OBJDUMP) $(OBJDUMPFLAGS) $(ELFFILE) | less
|
||||||
|
|
||||||
# Generate an XML file containing all macro definitions and include paths for
|
# Generate an XML file containing all macro definitions and include paths for
|
||||||
|
Loading…
Reference in New Issue
Block a user