zephyr/cmake/usage/usage.cmake
Martí Bolívar 0d5e6c13e9 boards/shields: re-work handling in cmake and west
Remove the boards and shields lists from the 'usage' target output.
That might have been readable at some point long ago in Zephyr's
history, when only a few boards were available, but right now it's
obscuring the high level targets we really want 'usage' to print.

Instead, add 'boards' and 'shields' targets which the user can run to
get those lists, and reference them from the 'usage' output. This
makes 'usage' squintable again. We use the new list_boards.py script
from the 'boards' target.

Reference the 'help' target from 'usage' as well, and drop the
recommendation that people run '--target help' from the 'west build
--help' output for the 'west build --target' option. The canonical
place to look is 'usage' now.

Use the new list_boards.py code from 'west boards' as well, which
allows us to add the board's directory as a format string key, in
addition to its name and architecture.

Keep west-completion.bash up to date. While doing that, I noticed that
a bunch of references to this file refer to a stale location, so fix
those too.

Finally, the 'usage' output is what we print for a failed board or
shield lookup, so that needs to be updated also. Handle that by
invoking boards.cmake and a new shields.cmake in CMake script mode to
print the relevant output.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-01-15 15:07:49 -05:00

43 lines
1.8 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
if(NOT DEFINED ZEPHYR_BASE)
message(FATAL_ERROR "ZEPHYR_BASE not set")
endif()
get_filename_component(generator ${CMAKE_MAKE_PROGRAM} NAME)
if(${generator} STREQUAL ninja)
set(verbose "-v")
else()
set(verbose "VERBOSE=1")
endif()
message("Cleaning targets:")
message(" clean - Remove most generated files but keep configuration and backup files")
message(" pristine - Remove all files in the build directory")
message("")
message("Kconfig targets:")
message(" menuconfig - Update .config using a console-based interface")
message(" guiconfig - Update .config using a graphical interface")
message("")
message("Other generic targets:")
message(" all - Build a zephyr application")
message(" run - Build a zephyr application and run it if the board supports emulation")
message(" flash - Run \"west flash\"")
message(" debug - Run \"west debug\"")
message(" debugserver - Run \"west debugserver\" (or start GDB server on port 1234 for QEMU targets)")
message(" attach - Run \"west attach\"")
message(" ram_report - Build and create RAM usage report")
message(" rom_report - Build and create ROM usage report")
message(" boards - Display supported boards")
message(" shields - Display supported shields")
message(" usage - Display this text")
message(" help - Display all build system targets")
message("")
message("Build flags:")
message("")
message(" ${generator} ${verbose} [targets] verbose build")
message(" cmake -DW=n Enable extra gcc checks, n=1,2,3 where")
message(" 1: warnings which may be relevant and do not occur too often")
message(" 2: warnings which occur quite often but may still be relevant")
message(" 3: more obscure warnings, can most likely be ignored")
message(" Multiple levels can be combined with W=12 or W=123")