I use automake and autoconf.
In the subdirectory src/ the Makefile.am contains
bin_PROGRAMS = hello
hello_SOURCES = hello.c
After building hello I want to run a tool (some analyzer/optimizer installed on the system) on the binary to modify it (e.g. strip) or generate statistics (e.g. dwarves, pahole ...). For this purpose the Makefile.am in the top-level-directory contains
tool:
tool src/hello
When building hello with make and executing make tool everything is fine. The problem occurs when the user runs make tool without building the binary. How can I enforce building the bin_PROGRAMS (which may be a list) or just the hello binary as dependency of the target tool?
Neither
tool: bin_PROGRAMS
tool src/hello
nor
tool: src/hello
tool src/hello
work.