
On 20/06/2023 00.41, Tobias Deiminger wrote:
quiet_cmd_wrap = WRAP $@ -cmd_wrap = echo "#include <../$(patsubst $(obj)/%,%,$@)>" >$@ +cmd_wrap = echo "#include <../$(patsubst $(obj)/generated/%,%,$@)>" >$@
-$(obj)/boot/%.c $(obj)/common/%.c $(obj)/env/%.c $(obj)/lib/%.c: +$(obj)/generated/%.c: $(call cmd,wrap)
FWIW, this change incidentally also fixes a warning (and future error!) from GNU Make. Building v2023.04 with GNU Make 4.4 produces
WRAP tools/env/embedded.c tools/Makefile:264: warning: pattern recipe did not update peer target 'tools/common/crc32.c'. tools/Makefile:264: warning: pattern recipe did not update peer target 'tools/boot/crc32.c'. tools/Makefile:264: warning: pattern recipe did not update peer target 'tools/lib/embedded.c'. tools/Makefile:264: warning: pattern recipe did not update peer target 'tools/common/embedded.c'. tools/Makefile:264: warning: pattern recipe did not update peer target 'tools/boot/embedded.c'. WRAP tools/lib/sha1.c HOSTCC tools/img2srec tools/Makefile:264: warning: pattern recipe did not update peer target 'tools/env/sha1.c'. tools/Makefile:264: warning: pattern recipe did not update peer target 'tools/common/sha1.c'. tools/Makefile:264: warning: pattern recipe did not update peer target 'tools/boot/sha1.c'.
etc. See the first "WARNING: Future backward-incompatibility!" bullet in https://lists.gnu.org/archive/html/help-make/2022-10/msg00020.html .
Rasmus