build: rework .banner generation
authorAnthony PERARD <anthony.perard@citrix.com>
Tue, 10 Aug 2021 07:27:13 +0000 (09:27 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 10 Aug 2021 07:27:13 +0000 (09:27 +0200)
Avoid depending on Makefile but still allow to rebuild the banner when
$(XEN_FULLVERSION) changes.

Also add a dependency on tools/xen.flf, even if not expected to
change.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/Makefile

index 8023680ffbf28ead46adc2fd7d08b33ab4d89bdb..94e8371826157a6cedda530416648eaf9efbad92 100644 (file)
@@ -378,13 +378,19 @@ delete-unfresh-files:
                rm -f include/xen/compile.h; \
        fi
 
-.banner: Makefile
-       @if which figlet >/dev/null 2>&1 ; then \
-               echo " Xen $(XEN_FULLVERSION)" | figlet -f tools/xen.flf > $@.tmp; \
-       else \
-               echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
-       fi
-       @mv -f $@.tmp $@
+quiet_cmd_banner = BANNER  $@
+define cmd_banner
+    if which figlet >/dev/null 2>&1 ; then \
+       echo " Xen $(XEN_FULLVERSION)" | figlet -f $< > $@.tmp; \
+    else \
+       echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
+    fi; \
+    mv -f $@.tmp $@
+endef
+
+.banner: tools/xen.flf FORCE
+       $(call if_changed,banner)
+targets += .banner
 
 # compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
 include/xen/compile.h: include/xen/compile.h.in .banner