On 17.09.21 09:46, Peng Fan (OSS) wrote:
> From: Peng Fan <[email protected]>
>
> With Linux kernel has a change that
> "kbuild: warn if FORCE is missing for if_changed(_dep,_rule) and
> filechk", so add FORCE in Makefile/Kbuild to avoid build warning.
>
> Signed-off-by: Peng Fan <[email protected]>
> ---
> Kbuild | 4 ++--
> configs/Makefile | 2 +-
> hypervisor/Makefile | 6 +++---
> hypervisor/arch/x86/Kbuild | 6 +++---
> inmates/lib/arm64/Makefile.lib | 4 ++--
> inmates/lib/x86/Makefile | 4 ++--
> inmates/lib/x86/Makefile.lib | 4 ++--
> tools/Makefile | 6 +++---
> 8 files changed, 18 insertions(+), 18 deletions(-)
>
> diff --git a/Kbuild b/Kbuild
> index b76a8dd7..2863c121 100644
> --- a/Kbuild
> +++ b/Kbuild
> @@ -46,12 +46,12 @@ $(GEN_VERSION_H): $(src)/Makefile FORCE
>
> quiet_cmd_gen_pci_defs = GEN $@
> define cmd_gen_pci_defs
> - $^ $(src)/include/jailhouse/pci_defs.h > $@
> + $< $(src)/include/jailhouse/pci_defs.h > $@
> endef
>
> GEN_PCI_DEFS_PY := $(obj)/pyjailhouse/pci_defs.py
>
> -$(GEN_PCI_DEFS_PY): $(src)/scripts/gen_pci_defs.sh
> +$(GEN_PCI_DEFS_PY): $(src)/scripts/gen_pci_defs.sh FORCE
> $(call if_changed,gen_pci_defs)
>
> subdir-y := hypervisor configs inmates tools
> diff --git a/configs/Makefile b/configs/Makefile
> index 74b35f0d..327043b7 100644
> --- a/configs/Makefile
> +++ b/configs/Makefile
> @@ -38,5 +38,5 @@ targets += $(DTS:.dts=.dtb)
> # prevent deleting intermediate files which would cause rebuilds
> .SECONDARY: $(addprefix $(obj)/,$(CONFIGS:.c=.o))
>
> -$(obj)/%.cell: $(obj)/%.o
> +$(obj)/%.cell: $(obj)/%.o FORCE
> $(call if_changed,objcopy)
> diff --git a/hypervisor/Makefile b/hypervisor/Makefile
> index 3807e608..8ae4e332 100644
> --- a/hypervisor/Makefile
> +++ b/hypervisor/Makefile
> @@ -80,7 +80,7 @@ ASM_DEFINES_H :=
> arch/$(SRCARCH)/include/generated/asm/asm-defines.h
>
> targets := $(ASM_DEFINES_H) arch/$(SRCARCH)/asm-defines.s
>
> -$(obj)/arch/$(SRCARCH)/asm-defines.s: $(src)/arch/$(SRCARCH)/asm-defines.c
> +$(obj)/arch/$(SRCARCH)/asm-defines.s: $(src)/arch/$(SRCARCH)/asm-defines.c
> FORCE
> $(call if_changed_dep,cc_s_c)
>
> $(obj)/$(ASM_DEFINES_H): $(obj)/arch/$(SRCARCH)/asm-defines.s
> @@ -110,13 +110,13 @@ HYPERVISOR$(1)_OBJS = $$(addprefix
> $$(obj)/,$$(hypervisor$(1)-y))
> LDFLAGS_hypervisor$(1).o := --whole-archive -T
>
> targets += hypervisor$(1).o
> -$$(obj)/hypervisor$(1).o: $$(src)/hypervisor.lds $$(HYPERVISOR$(1)_OBJS)
> +$$(obj)/hypervisor$(1).o: $$(src)/hypervisor.lds $$(HYPERVISOR$(1)_OBJS)
> FORCE
> $$(call if_changed,ld)
>
> OBJCOPYFLAGS_jailhouse$(1).bin := -O binary -R .eh_frame
>
> targets += jailhouse$(1).bin
> -$$(obj)/jailhouse$(1).bin: $$(obj)/hypervisor$(1).o
> +$$(obj)/jailhouse$(1).bin: $$(obj)/hypervisor$(1).o FORCE
> $$(call if_changed,objcopy)
> endef
>
> diff --git a/hypervisor/arch/x86/Kbuild b/hypervisor/arch/x86/Kbuild
> index a6badcac..7a42adb4 100644
> --- a/hypervisor/arch/x86/Kbuild
> +++ b/hypervisor/arch/x86/Kbuild
> @@ -40,10 +40,10 @@ intel-objs := vmx.o vtd.o vmx-vmexit.o $(common-objs-y)
> cat.o
> targets += $(amd-objs) $(intel-objs)
>
> quiet_cmd_link_archive = AR $@
> -cmd_link_archive = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $^
> +cmd_link_archive = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $(filter-out
> FORCE,$^)
>
> -$(obj)/lib-amd.a: $(addprefix $(obj)/,$(amd-objs))
> +$(obj)/lib-amd.a: $(addprefix $(obj)/,$(amd-objs)) FORCE
> $(call if_changed,link_archive)
>
> -$(obj)/lib-intel.a: $(addprefix $(obj)/,$(intel-objs))
> +$(obj)/lib-intel.a: $(addprefix $(obj)/,$(intel-objs)) FORCE
> $(call if_changed,link_archive)
> diff --git a/inmates/lib/arm64/Makefile.lib b/inmates/lib/arm64/Makefile.lib
> index 2ea037cd..5df2632d 100644
> --- a/inmates/lib/arm64/Makefile.lib
> +++ b/inmates/lib/arm64/Makefile.lib
> @@ -58,8 +58,8 @@ endef
>
> .SECONDEXPANSION:
> $(obj)/%-linked.o: $(INMATES_LIB)/inmate.lds $$(addprefix
> $$(obj)/,$$($$*-y)) \
> - $(INMATES_LIB)/lib.a
> + $(INMATES_LIB)/lib.a FORCE
> $(call if_changed,ld)
>
> -$(obj)/%.bin: $(obj)/%-linked.o
> +$(obj)/%.bin: $(obj)/%-linked.o FORCE
> $(call if_changed,objcopy)
> diff --git a/inmates/lib/x86/Makefile b/inmates/lib/x86/Makefile
> index 35f04161..a3e149b3 100644
> --- a/inmates/lib/x86/Makefile
> +++ b/inmates/lib/x86/Makefile
> @@ -51,9 +51,9 @@ lib-y := $(TARGETS) $(TARGETS_64_ONLY)
> lib32-y := $(TARGETS:.o=-32.o) $(TARGETS_32_ONLY)
>
> quiet_cmd_link_archive32 = AR $@
> -cmd_link_archive32 = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $^
> +cmd_link_archive32 = rm -f $@; $(AR) rcs$(KBUILD_ARFLAGS) $@ $*
Is $* really correct here? Elsewhere, you do a filter-out of FORCE from $^.
>
> -$(obj)/lib32.a: $(addprefix $(obj)/,$(lib32-y))
> +$(obj)/lib32.a: $(addprefix $(obj)/,$(lib32-y)) FORCE
> $(call if_changed,link_archive32)
>
> targets += $(lib32-y)
> diff --git a/inmates/lib/x86/Makefile.lib b/inmates/lib/x86/Makefile.lib
> index 872b7ce0..b5748565 100644
> --- a/inmates/lib/x86/Makefile.lib
> +++ b/inmates/lib/x86/Makefile.lib
> @@ -57,10 +57,10 @@ endef
> # obj/NAME-linked.o: ... obj/$(NAME-y) lib/lib[32].a
> .SECONDEXPANSION:
> $(obj)/%-linked.o: $(INMATES_LIB)/inmate.lds $$(addprefix
> $$(obj)/,$$($$*-y)) \
> - $(INMATES_LIB)/$$(if $$($$*_32),lib32.a,lib.a)
> + $(INMATES_LIB)/$$(if $$($$*_32),lib32.a,lib.a) FORCE
> $(call if_changed,ld)
>
> -$(obj)/%.bin: $(obj)/%-linked.o
> +$(obj)/%.bin: $(obj)/%-linked.o FORCE
> $(call if_changed,objcopy)
>
> # 32-bit (i386) support
> diff --git a/tools/Makefile b/tools/Makefile
> index 4faf9430..1108433a 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -111,7 +111,7 @@ define cmd_gen_man
> sed 's/$${VERSION}/$(shell cat $(src)/../VERSION)/g' $< > $@
> endef
>
> -$(obj)/%: $(obj)/%.o
> +$(obj)/%: $(obj)/%.o FORCE
> $(call if_changed,ld)
>
> CFLAGS_jailhouse-gcov-extract.o := -I$(src)/../hypervisor/include \
> @@ -122,13 +122,13 @@ LDFLAGS_jailhouse-gcov-extract := -lgcov -fprofile-arcs
> targets += jailhouse-gcov-extract.o
> always-y += jailhouse-gcov-extract
>
> -$(obj)/jailhouse-config-collect: $(src)/jailhouse-config-create
> $(src)/jailhouse-config-collect.tmpl
> +$(obj)/jailhouse-config-collect: $(src)/jailhouse-config-create
> $(src)/jailhouse-config-collect.tmpl FORCE
> $(call if_changed,gen_collect)
>
> targets += $(MAN8_PAGES)
> always-y += $(MAN8_PAGES)
>
> -$(obj)/%.8: $(src)/%.8.in
> +$(obj)/%.8: $(src)/%.8.in FORCE
> $(call if_changed,gen_man)
>
> install-bin: $(BINARIES) $(DESTDIR)$(sbindir)
>
Looks good otherwise.
This affects 5.15+, right? Worth mentioning in the commit log.
Jan
--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/dec7614e-23e8-5381-6528-24c486a038f6%40siemens.com.