Re: [XEN PATCH 05/15] build: introduce a generic command for gzip

2023-05-25 Thread Anthony PERARD
On Wed, May 24, 2023 at 09:17:09AM +0200, Jan Beulich wrote:
> On 23.05.2023 18:38, Anthony PERARD wrote:
> > Make the gzip command generic and use -9 which wasn't use for
> > config.gz. (xen.gz does use -9)
> 
> You mention xen.gz here, but you don't make its rule use this new
> construct. Is that intentional (and if so, why)? (There we also go
> through $@.new, and being consistent in that regard would imo be
> desirable as well.)

It was kind of a justification to say that -9 was ok, because we already
use it.

But I can't use it for xen.gz because the generic command is added to
Rules.mk. But I can probably add cmd_gzip to Kbuild.include instead and
use it for xen.gz, (with simply $(call cmd,) instead of using
if_changed).

Thanks,

-- 
Anthony PERARD



Re: [XEN PATCH 05/15] build: introduce a generic command for gzip

2023-05-24 Thread Jan Beulich
On 23.05.2023 18:38, Anthony PERARD wrote:
> Make the gzip command generic and use -9 which wasn't use for
> config.gz. (xen.gz does use -9)

You mention xen.gz here, but you don't make its rule use this new
construct. Is that intentional (and if so, why)? (There we also go
through $@.new, and being consistent in that regard would imo be
desirable as well.)

Jan

> Signed-off-by: Anthony PERARD 
> ---
>  xen/Rules.mk| 5 +
>  xen/common/Makefile | 8 
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/Rules.mk b/xen/Rules.mk
> index 59072ae8df..68b10ca5ef 100644
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -63,6 +63,11 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
>  quiet_cmd_binfile = BINFILE $@
>  cmd_binfile = $(SHELL) $(srctree)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
>  
> +# gzip
> +quiet_cmd_gzip = GZIP$@
> +cmd_gzip = \
> +cat $(real-prereqs) | gzip -n -f -9 > $@
> +
>  # Figure out what we need to build from the various variables
>  # ===
>  
> diff --git a/xen/common/Makefile b/xen/common/Makefile
> index 46049eac35..f45f19c391 100644
> --- a/xen/common/Makefile
> +++ b/xen/common/Makefile
> @@ -78,13 +78,13 @@ obj-$(CONFIG_NEEDS_LIBELF) += libelf/
>  obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
>  
>  CONF_FILE := $(if $(patsubst 
> /%,,$(KCONFIG_CONFIG)),$(objtree)/)$(KCONFIG_CONFIG)
> -$(obj)/config.gz: $(CONF_FILE)
> - gzip -n -c $< >$@
> +$(obj)/config.gz: $(CONF_FILE) FORCE
> + $(call if_changed,gzip)
> +
> +targets += config.gz
>  
>  $(obj)/config_data.o: $(obj)/config.gz
>  
>  $(obj)/config_data.S: $(srctree)/tools/binfile FORCE
>   $(call if_changed,binfile,$(obj)/config.gz xen_config_data)
>  targets += config_data.S
> -
> -clean-files := config.gz




[XEN PATCH 05/15] build: introduce a generic command for gzip

2023-05-23 Thread Anthony PERARD
Make the gzip command generic and use -9 which wasn't use for
config.gz. (xen.gz does use -9)

Signed-off-by: Anthony PERARD 
---
 xen/Rules.mk| 5 +
 xen/common/Makefile | 8 
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 59072ae8df..68b10ca5ef 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -63,6 +63,11 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
 quiet_cmd_binfile = BINFILE $@
 cmd_binfile = $(SHELL) $(srctree)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
 
+# gzip
+quiet_cmd_gzip = GZIP$@
+cmd_gzip = \
+cat $(real-prereqs) | gzip -n -f -9 > $@
+
 # Figure out what we need to build from the various variables
 # ===
 
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 46049eac35..f45f19c391 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -78,13 +78,13 @@ obj-$(CONFIG_NEEDS_LIBELF) += libelf/
 obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
 
 CONF_FILE := $(if $(patsubst 
/%,,$(KCONFIG_CONFIG)),$(objtree)/)$(KCONFIG_CONFIG)
-$(obj)/config.gz: $(CONF_FILE)
-   gzip -n -c $< >$@
+$(obj)/config.gz: $(CONF_FILE) FORCE
+   $(call if_changed,gzip)
+
+targets += config.gz
 
 $(obj)/config_data.o: $(obj)/config.gz
 
 $(obj)/config_data.S: $(srctree)/tools/binfile FORCE
$(call if_changed,binfile,$(obj)/config.gz xen_config_data)
 targets += config_data.S
-
-clean-files := config.gz
-- 
Anthony PERARD