2017-09-09 00:06:29 +02:00
.PHONY : info -objsize info -buildsizes info -build info -boards -supported \
2017-10-24 08:57:58 +02:00
info-features-missing info-modules info-cpu \
2018-05-08 18:10:04 +02:00
info-features-provided info-features-required \
2022-07-06 08:56:28 +02:00
info-features-used info-kconfig-variables \
2018-08-07 16:25:26 +02:00
info-debug-variable-% info-toolchains-supported \
2021-02-11 15:22:02 +01:00
check-toolchain-supported \
info-programmers-supported \
2022-09-23 02:03:50 +02:00
info-rust \
2023-02-04 11:52:15 +01:00
generate-Makefile.ci \
2021-02-11 15:22:02 +01:00
#
2017-09-09 00:06:29 +02:00
info-objsize :
2018-03-22 16:20:19 +01:00
@case " $( SORTROW) " in \
2017-09-09 00:06:29 +02:00
text) SORTROW = 1 ; ; \
data) SORTROW = 2 ; ; \
bss) SORTROW = 3 ; ; \
dec) SORTROW = 4 ; ; \
"" ) SORTROW = 4 ; ; \
*) echo " Usage: $( MAKE) info-objsize SORTROW=[text|data|bss|dec] " ; return ; ; \
esac ; \
2020-10-07 11:30:00 +02:00
printf ' text\t data\t bss\t dec\t hex\tmodule\n' ; \
for i in $( sort $( BASELIBS:%.module= %) ) ; \
do \
$( SIZE) -t -d -B $( BINDIR) /$$ i/*.o 2> /dev/null | \
tail -n1 | \
sed -e " s#(TOTALS)# $$ i# " | \
sed -e 's#$(BINDIR)##' ; \
done | sort -n -r -k $$ { SORTROW}
2017-09-09 00:06:29 +02:00
info-buildsize :
2018-03-26 17:14:40 +02:00
@$( SIZE) -d -B $( ELFFILE) || echo ''
2017-09-09 00:06:29 +02:00
info-build :
@echo 'APPLICATION: $(APPLICATION)'
2018-08-09 14:40:35 +02:00
@echo 'APPDIR: $(APPDIR)'
2017-09-09 00:06:29 +02:00
@echo ''
@echo 'supported boards:'
@echo $$ ( $( MAKE) info-boards-supported)
@echo ''
@echo 'BOARD: $(BOARD)'
@echo 'CPU: $(CPU)'
@echo ''
2020-04-14 15:23:23 +02:00
@echo 'RIOTBASE: $(RIOTBASE)'
@echo 'BOARDDIR: $(BOARDDIR)'
@echo 'EXTERNAL_BOARD_DIRS:$(EXTERNAL_BOARD_DIRS)'
@echo 'RIOTCPU: $(RIOTCPU)'
@echo 'RIOTPKG: $(RIOTPKG)'
2017-09-09 00:06:29 +02:00
@echo ''
@echo 'DEFAULT_MODULE: $(sort $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE)))'
@echo 'DISABLE_MODULE: $(sort $(DISABLE_MODULE))'
@echo 'USEMODULE: $(sort $(filter-out $(DEFAULT_MODULE), $(USEMODULE)))'
@echo ''
@echo 'ELFFILE: $(ELFFILE)'
@echo 'HEXFILE: $(HEXFILE)'
2019-07-15 19:32:26 +02:00
@echo 'BINFILE: $(BINFILE)'
2018-12-19 18:10:57 +01:00
@echo 'FLASHFILE: $(FLASHFILE)'
2017-09-09 00:06:29 +02:00
@echo ''
2019-05-03 16:19:20 +02:00
@echo 'FEATURES_USED:'
@echo ' $(or $(FEATURES_USED), -none-)'
2019-05-03 16:14:49 +02:00
@echo 'FEATURES_REQUIRED:'
@echo ' $(or $(sort $(FEATURES_REQUIRED)), -none-)'
2020-02-11 20:53:51 +01:00
@echo 'FEATURES_REQUIRED_ANY:'
@echo ' $(or $(sort $(FEATURES_REQUIRED_ANY)), -none-)'
2019-05-03 16:19:20 +02:00
@echo 'FEATURES_OPTIONAL_ONLY (optional that are not required, strictly "nice to have"):'
@echo ' $(or $(FEATURES_OPTIONAL_ONLY), -none-)'
@echo 'FEATURES_OPTIONAL_MISSING (missing optional features):'
@echo ' $(or $(FEATURES_OPTIONAL_MISSING), -none-)'
2017-09-09 00:06:29 +02:00
@echo 'FEATURES_PROVIDED (by the board or USEMODULE' "'" 'd drivers):'
@echo ' $(or $(sort $(FEATURES_PROVIDED)), -none-)'
2019-05-03 16:14:49 +02:00
@echo 'FEATURES_MISSING (only non optional features):'
2019-05-03 16:19:20 +02:00
@echo ' $(or $(FEATURES_MISSING), -none-)'
2018-05-04 15:43:41 +02:00
@echo 'FEATURES_BLACKLIST (blacklisted features):'
@echo ' $(or $(sort $(FEATURES_BLACKLIST)), -none-)'
2019-10-15 11:38:57 +02:00
@echo 'FEATURES_USED_BLACKLISTED (used but blacklisted features):'
@echo ' $(or $(sort $(FEATURES_USED_BLACKLISTED)), -none-)'
2017-09-09 00:06:29 +02:00
@echo ''
@echo 'FEATURES_CONFLICT: $(FEATURES_CONFLICT)'
@echo 'FEATURES_CONFLICT_MSG: $(FEATURES_CONFLICT_MSG)'
2019-05-03 17:47:42 +02:00
@echo 'FEATURES_CONFLICTING:'
@echo ' $(or $(FEATURES_CONFLICTING), -none-)'
2017-09-09 00:06:29 +02:00
@echo ''
2018-03-01 15:21:16 +01:00
@echo -e 'INCLUDES:$(patsubst %, \n\t%, $(INCLUDES))'
@echo ''
2017-09-09 00:06:29 +02:00
@echo 'CC: $(CC)'
2022-09-23 01:53:01 +02:00
@echo 'CFLAGS:$(patsubst %, \n\t%, $(subst ' ,'"' " ', $( CFLAGS) ))'
2017-09-09 00:06:29 +02:00
@echo ''
@echo 'CXX: $(CXX)'
@echo -e 'CXXUWFLAGS:$(patsubst %, \n\t%, $(CXXUWFLAGS))'
@echo -e 'CXXEXFLAGS:$(patsubst %, \n\t%, $(CXXEXFLAGS))'
@echo ''
2021-12-19 10:02:38 +01:00
@echo 'RUST_TARGET: $(RUST_TARGET)'
2022-09-23 01:55:12 +02:00
@echo 'CARGO_PROFILE: $(CARGO_PROFILE)'
@echo 'CARGO_OPTIONS: $(CARGO_OPTIONS)'
2021-12-19 10:02:38 +01:00
@echo ''
2017-09-09 00:06:29 +02:00
@echo 'LINK: $(LINK)'
@echo -e 'LINKFLAGS:$(patsubst %, \n\t%, $(LINKFLAGS))'
@echo ''
@echo 'OBJCOPY: $(OBJCOPY)'
@echo 'OFLAGS: $(OFLAGS)'
@echo ''
@echo 'FLASHER: $(FLASHER)'
@echo 'FFLAGS: $(FFLAGS)'
@echo ''
@echo 'TERMPROG: $(TERMPROG)'
@echo 'TERMFLAGS: $(TERMFLAGS)'
2022-08-29 16:58:16 +02:00
@echo 'TERMENV: $(TERMENV)'
2017-09-09 00:06:29 +02:00
@echo 'PORT: $(PORT)'
2019-10-15 14:12:56 +02:00
@echo 'PROG_DEV: $(PROG_DEV)'
2017-09-09 00:06:29 +02:00
@echo ''
@echo 'DEBUGGER: $(DEBUGGER)'
@echo 'DEBUGGER_FLAGS: $(DEBUGGER_FLAGS)'
@echo
@echo 'DOWNLOAD_TO_FILE: $(DOWNLOAD_TO_FILE)'
@echo 'DOWNLOAD_TO_STDOUT: $(DOWNLOAD_TO_STDOUT)'
@echo 'UNZIP_HERE: $(UNZIP_HERE)'
@echo ''
@echo 'DEBUGSERVER: $(DEBUGSERVER)'
@echo 'DEBUGSERVER_FLAGS: $(DEBUGSERVER_FLAGS)'
@echo ''
2023-06-10 00:04:56 +02:00
@echo 'DEBUGCLIENT: $(DEBUGCLIENT)'
@echo 'DEBUGCLIENT_FLAGS: $(DEBUGCLIENT_FLAGS)'
@echo ''
2017-09-09 00:06:29 +02:00
@echo 'RESET: $(RESET)'
@echo 'RESET_FLAGS: $(RESET_FLAGS)'
@echo ''
@echo -e 'MAKEFILE_LIST:$(patsubst %, \n\t%, $(abspath $(MAKEFILE_LIST)))'
2020-10-08 15:18:29 +02:00
d e f i n e j s o n _ s t r i n g _ o r _ n u l l
$(or $(1 : %="%"), null )
e n d e f
# Convert a space separated list to a JSON array
d e f i n e _ t o _ j s o n _ s t r i n g _ l i s t
[ $( filter -out "","$ ( subst $ ( space ) ,"$ ( comma ) $ ( space ) ",$ ( 1) ) ") ]
e n d e f
# Strips out any existing quotes so that the generated JSON is valid, not necessary sensible
d e f i n e t o _ j s o n _ s t r i n g _ l i s t
$( call _to_json_string_list ,$ ( strip $ ( subst ",,$ ( subst \",,$ ( 1) ) ) ) )
e n d e f
# Crude json encoded build info.
# The output generated here is a best-effort JSON encoding, it is not perfect,
# converting the space separated lists in Make to a JSON array is flawed, it
# doesn't consider quoted parts as a single list item. This mainly shows up in
# cflags such as: -DNIMBLE_HOST_PRIO="(NIMBLE_CONTROLLER_PRIO + 1)", this is
# splitted into 3 array elements. To ensure that the generated JSON is valid,
# double quotes are currently stripped before generating the array.
info-build-json :
@echo '{ '
@echo '"APPLICATION": "$(APPLICATION)",'
@echo '"APPDIR": "$(APPDIR)",'
@echo '"BOARD": "$(BOARD)",'
@echo '"CPU": "$(CPU)",'
@echo '"RIOTBASE": "$(RIOTBASE)",'
@echo '"BOARDDIR": "$(BOARDDIR)",'
@echo '"RIOTCPU": "$(RIOTCPU)",'
@echo '"RIOTPKG": "$(RIOTPKG)",'
2021-01-22 20:33:38 +01:00
@echo '"EXTERNAL_BOARD_DIRS": $(call json_string_or_null,$(EXTERNAL_BOARD_DIRS)),'
2020-10-08 15:18:29 +02:00
@echo '"BINDIR": "$(BINDIR)",'
@echo '"ELFFILE": "$(ELFFILE)",'
@echo '"HEXFILE": "$(HEXFILE)",'
@echo '"BINFILE": "$(BINFILE)",'
@echo '"FLASHFILE": "$(FLASHFILE)",'
@echo '"DEFAULT_MODULE": $(call to_json_string_list,$(sort $(filter-out $(DISABLE_MODULE), $(DEFAULT_MODULE)))),'
@echo '"DISABLE_MODULE": $(call to_json_string_list,$(sort $(DISABLE_MODULE))),'
@echo '"USEMODULE": $(call to_json_string_list,$(sort $(filter-out $(DEFAULT_MODULE), $(USEMODULE)))),'
@echo '"FEATURES_USED": $(call to_json_string_list,$(FEATURES_USED)),'
@echo '"FEATURES_REQUIRED": $(call to_json_string_list,$(sort $(FEATURES_REQUIRED))),'
@echo '"FEATURES_REQUIRED_ANY": $(call to_json_string_list,$(sort $(FEATURES_REQUIRED_ANY))),'
@echo '"FEATURES_OPTIONAL_ONLY": $(call to_json_string_list,$(FEATURES_OPTIONAL_ONLY)),'
@echo '"FEATURES_OPTIONAL_MISSING": $(call to_json_string_list,$(FEATURES_OPTIONAL_MISSING)),'
@echo '"FEATURES_PROVIDED": $(call to_json_string_list,$(sort $(FEATURES_PROVIDED))),'
@echo '"FEATURES_MISSING": $(call to_json_string_list,$(FEATURES_MISSING)),'
@echo '"FEATURES_BLACKLIST": $(call to_json_string_list,$(sort $(FEATURES_BLACKLIST))),'
@echo '"FEATURES_USED_BLACKLISTED": $(call to_json_string_list,$(sort $(FEATURES_USED_BLACKLISTED))),'
@echo '"FEATURES_CONFLICT": $(call to_json_string_list,$(FEATURES_CONFLICT)),'
@echo '"FEATURES_CONFLICTING": $(call to_json_string_list,$(FEATURES_CONFLICTING)),'
@echo '"PREFIX": $(call json_string_or_null,$(PREFIX)),'
@echo '"CC": "$(CC)",'
@echo '"CXX": "$(CXX)",'
@echo '"LINK": "$(LINK)",'
@echo '"OBJCOPY": "$(OBJCOPY)",'
@echo '"INCLUDES": $(call to_json_string_list,$(strip $(INCLUDES))),'
@echo '"OFLAGS": $(call to_json_string_list,$(OFLAGS)),'
@echo '"CFLAGS": $(call to_json_string_list,$(CFLAGS)),'
@echo '"CXXUWFLAGS": $(call to_json_string_list,$(CXXUWFLAGS)),'
@echo '"CXXEXFLAGS": $(call to_json_string_list,$(CXXEXFLAGS)),'
@echo '"LINKFLAGS": $(call to_json_string_list,$(LINKFLAGS))'
@echo '}'
2017-09-09 00:06:29 +02:00
info-files : QUIET := 0
info-files :
@( \
echo " $( abspath $( shell echo " $( MAKEFILE_LIST) " ) ) " | tr ' ' '\n' ; \
CSRC = " $$ ( $( MAKE) USEPKG= " " -Bn | grep -o -e " [ ^ ] \+ \. [ csS] $$ " -e " [ ^ ] \+ \. [ csS] [ \' ] " | grep -v -e " ^\s *-D")" ; \
echo " $$ CSRC " ; \
echo " $( RIOTBASE) /Makefile.base " ; \
echo " $$ CSRC " | xargs dirname -- | sort | uniq | xargs -I{ } find { } -name "Makefile*" ; \
echo " $$ CSRC " | xargs $( CC) $( CFLAGS) $( INCLUDES) -MM 2> /dev/null | grep -o "[^ ]\+\.h" ; \
if [ -n " $$ SRCXX " ] ; then \
CPPSRC = " $$ ( $( MAKE) -Bn USEPKG= " " | grep -o -e " [ ^ ] \+ \. cpp" | grep -v -e " ^\s *-D")" ; \
echo " $$ CPPSRC " ; \
echo " $$ CPPSRC " | xargs dirname -- | sort | uniq | xargs -I{ } find { } -name "Makefile*" ; \
echo " $$ CPPSRC " | xargs $( CXX) $( CXXFLAGS) $( INCLUDES) -MM 2> /dev/null | grep -o "[^ ]\+\.h" ; \
fi ; \
$( foreach pkg,$( USEPKG) ,find $( RIOTPKG) /$( pkg) -type f; ) \
) | sort | uniq | sed 's#$(RIOTBASE)/##'
info-modules :
@for i in $( sort $( USEMODULE) ) ; do echo $$ i; done
2021-04-01 12:28:59 +02:00
info-packages :
@for i in $( sort $( USEPKG) ) ; do echo $$ i; done
2017-09-09 00:06:29 +02:00
info-cpu :
@echo $( CPU)
2017-10-24 08:57:58 +02:00
info-features-provided :
@for i in $( sort $( FEATURES_PROVIDED) ) ; do echo $$ i; done
info-features-required :
@for i in $( sort $( FEATURES_REQUIRED) ) ; do echo $$ i; done
2017-09-09 00:06:29 +02:00
info-features-missing :
2019-05-03 16:19:20 +02:00
@for i in $( FEATURES_MISSING) ; do echo $$ i; done
2018-05-08 18:10:04 +02:00
2019-05-03 16:19:20 +02:00
info-features-used :
@for i in $( FEATURES_USED) ; do echo $$ i; done
2022-07-06 08:56:28 +02:00
# This target prints all variables set via KConfig sorted alphabetically for
# debugging.
info-kconfig-variables :
@for i in $( sort $( filter CONFIG_%,$( .VARIABLES) ) ) ; do echo $$ i; done
2018-05-08 18:10:04 +02:00
info-debug-variable-% :
@echo $( $* )
2018-08-07 16:25:26 +02:00
info-toolchains-supported :
@echo $( filter-out $( TOOLCHAINS_BLACKLIST) ,$( TOOLCHAINS_SUPPORTED) )
check-toolchain-supported :
@exit $( if $( filter $( TOOLCHAIN) ,$( filter-out $( TOOLCHAINS_BLACKLIST) ,$( TOOLCHAINS_SUPPORTED) ) ) ,0,1)
2021-02-11 15:22:02 +01:00
info-programmers-supported :
@echo $( sort $( PROGRAMMERS_SUPPORTED) )
2022-09-23 02:03:50 +02:00
info-rust :
2024-01-31 12:06:23 +01:00
cargo version
2022-09-23 02:03:50 +02:00
c2rust --version
2024-01-31 17:15:08 +01:00
@echo "To use this setup of Rust in an IDE, add these command line arguments to the \`cargo check\` or \`rust-analyzer\`:"
2024-08-21 21:53:10 +02:00
@echo " --profile $( CARGO_PROFILE) $( CARGO_OPTIONS) "
2024-01-31 17:15:08 +01:00
@echo "and export these environment variables:"
2024-08-21 21:53:10 +02:00
@echo " CARGO_BUILD_TARGET=\" $( RUST_TARGET) \" "
2024-01-31 17:15:08 +01:00
@echo " RIOT_COMPILE_COMMANDS_JSON=\" $( CARGO_COMPILE_COMMANDS) \" "
2024-02-01 13:54:46 +01:00
@echo " RIOTBUILD_CONFIG_HEADER_C=\" $( RIOTBUILD_CONFIG_HEADER_C) \" "
2024-08-21 21:51:02 +02:00
@echo "You can also call cargo related commands with \`make cargo-command CARGO_COMMAND=\"cargo check\"\`."
2024-08-21 21:53:10 +02:00
@echo " Beware that the way command line arguments are passed in is not consistent across cargo commands, so adding \`--profile $( CARGO_PROFILE) \` or other flags from above as part of CARGO_COMMAND may be necessary. "