On 25.05.2023 15:34, Anthony PERARD wrote: > On Wed, May 24, 2023 at 09:11:10AM +0200, Jan Beulich wrote: >> On 23.05.2023 18:38, Anthony PERARD wrote: >>> --- a/xen/xsm/flask/Makefile >>> +++ b/xen/xsm/flask/Makefile >>> @@ -48,10 +48,15 @@ targets += flask-policy.S >>> FLASK_BUILD_DIR := $(abs_objtree)/$(obj) >>> POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION) >>> >>> +policy_chk = \ >>> + $(Q)if ! cmp -s $(POLICY_SRC) $@; then \ >>> + $(kecho) ' UPD $@'; \ >>> + cp $(POLICY_SRC) $@; \ >> >> Wouldn't this better use move-if-changed? Which, if "UPD ..." output is >> desired, would then need overriding from what Config.mk supplies? > > I don't like move-if-changed, because it remove the original target. On > incremental build, make will keep building the original target even > when not needed. So we keep seeing the `checkpolicy` command line when > there's otherwise nothing to do. > > I could introduce a new generic macro instead, copy-if-changed, which > will do compare and copy (like policy_chk is doing here).
Ah, yes, I think I see what you mean. I'd be fine with copy-if-changed, ideally accompanied by some rule of thumb when to prefer it over move-if-changed. Jan