[PATCH] buildsys: Restore listing binaries/tools/helpers in 'make help' target

Philippe Mathieu-Daudé posted 1 patch 2 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/next-importer-push tags/patchew/20210602150809.2471467-1-philmd@redhat.com
Makefile | 7 +++++++
1 file changed, 7 insertions(+)
[PATCH] buildsys: Restore listing binaries/tools/helpers in 'make help' target
Posted by Philippe Mathieu-Daudé 2 years, 10 months ago
When switching to Meson (commit 7fd51e68c34, 2020-08-21) we lost many
targets listed in 'make help':
- target specific binaries
  commit 5e6d1573b49 ("remove Makefile.target")
- tools and helpers
  commit c3a0ee847a5 ("configure, Makefile; remove TOOLS and HELPERS-y variable")

Since 'ninja' is not officially supported, but 'make' still is,
restore a similar list of make targets (extracted from ninja).
The targets are not described as before, but it is still more
useful to users rather than nothing listed at all.

Now we get:

  $ make help
    GIT     ui/keycodemapdb tests/fp/berkeley-testfloat-3 tests/fp/berkeley-softfloat-3 dtc capstone slirp
  Architecture specific targets:
    qemu-system-aarch64
    qemu-system-alpha
    qemu-system-arm
    qemu-system-avr
    ...
    qemu-x86_64
    qemu-xtensaeb
    qemu-xtensa

  Generic targets:
    all                            - Build all
    dir/file.o                     - Build specified target only
    install                        - Install QEMU
    ctags/gtags/TAGS               - Generate tags file for editors
    cscope                         - Generate cscope index
    sparse                         - Run sparse on the QEMU source

  Tools and helper targets:
    contrib/elf2dmp/elf2dmp
    contrib/ivshmem-client/ivshmem-client
    contrib/ivshmem-server/ivshmem-server
    contrib/vhost-user-blk/vhost-user-blk
    contrib/vhost-user-gpu/vhost-user-gpu
    contrib/vhost-user-input/vhost-user-input
    contrib/vhost-user-scsi/vhost-user-scsi
    fsdev/virtfs-proxy-helper
    qemu-bridge-helper
    qemu-edid
    qemu-img
    qemu-io
    qemu-keymap
    qemu-nbd
    qemu-pr-helper
    qga/qemu-ga
    storage-daemon/qemu-storage-daemon
    tools/virtiofsd/virtiofsd

  Cleaning targets:
    clean                          - Remove most generated files but keep the config
    distclean                      - Remove all generated files
    dist                           - Build a distributable tarball
  ...

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/227
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Makefile b/Makefile
index 30f19d33bb3..f2c5ce2e5fe 100644
--- a/Makefile
+++ b/Makefile
@@ -286,6 +286,9 @@ print-help = @$(call print-help-run,$1,$2)
 
 .PHONY: help
 help:
+	@echo  'Architecture specific targets:'
+	@ninja -t targets all | sed -ne 's/\(.*\): cpp_LINKER.*/  \1/p'
+	@echo  ''
 	@echo  'Generic targets:'
 	$(call print-help,all,Build all)
 	$(call print-help,dir/file.o,Build specified target only)
@@ -294,6 +297,10 @@ help:
 	$(call print-help,cscope,Generate cscope index)
 	$(call print-help,sparse,Run sparse on the QEMU source)
 	@echo  ''
+	@echo  'Tools and helper targets:'
+	@ninja -t targets all | sed -ne 's/\(.*\): c_LINKER.*/  \1/p' \
+		| sort | egrep -v '^  (subprojects|tests|target)'
+	@echo  ''
 ifeq ($(CONFIG_PLUGIN),y)
 	@echo  'Plugin targets:'
 	$(call print-help,plugins,Build the example TCG plugins)
-- 
2.26.3


Re: [PATCH] buildsys: Restore listing binaries/tools/helpers in 'make help' target
Posted by Paolo Bonzini 2 years, 10 months ago
On 02/06/21 17:08, Philippe Mathieu-Daudé wrote:
> +	@echo  'Architecture specific targets:'
> +	@ninja -t targets all | sed -ne 's/\(.*\): cpp_LINKER.*/  \1/p'
> +	@echo  ''

This doesn't work in general, it depends on the link_language 
established by configure.  The separation between qemu-* targets and 
other targets is not particularly useful in my opinion.

> The targets are not described as before, but it is still more
> useful to users rather than nothing listed at all.

Maybe add "make targets" and add it to the help?  The information in 
"make help" already includes what's generally useful; listing a few 
dozen targets overwhelms the user with output, whereas most people only 
care about "make all" and "make check".

Paolo