tools/bpf/runqslower: Rebuild libbpf.a on libbpf source change
diff mbox series

Message ID 20200204175303.1423782-1-songliubraving@fb.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series
  • tools/bpf/runqslower: Rebuild libbpf.a on libbpf source change
Related show

Commit Message

Song Liu Feb. 4, 2020, 5:53 p.m. UTC
Add missing dependency of $(BPFOBJ) to $(LIBBPF_SRC), so that running make
in runqslower/ will rebuild libbpf.a when there is change in libbpf/.

Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf")
Cc: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
---
 tools/bpf/runqslower/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrii Nakryiko Feb. 4, 2020, 6:43 p.m. UTC | #1
On Tue, Feb 4, 2020 at 9:54 AM Song Liu <songliubraving@fb.com> wrote:
>
> Add missing dependency of $(BPFOBJ) to $(LIBBPF_SRC), so that running make
> in runqslower/ will rebuild libbpf.a when there is change in libbpf/.
>
> Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf")
> Cc: Andrii Nakryiko <andriin@fb.com>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  tools/bpf/runqslower/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
> index 87eae5be9bcd..ea89fcb6d68f 100644
> --- a/tools/bpf/runqslower/Makefile
> +++ b/tools/bpf/runqslower/Makefile
> @@ -75,7 +75,7 @@ $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL)
>         fi
>         $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@
>
> -$(BPFOBJ): | $(OUTPUT)
> +$(BPFOBJ): $(LIBBPF_SRC) | $(OUTPUT)

Let's instead update this rule to do what selftests/bpf do (watch *.c,
*.h and Makefile, and use all + install_headers to build libbpf and
generate bpf_helper_defs.h?

Please also specify (in subject) which tree (bpf or bpf-next) you are targeting.

>         $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC)                         \
>                     OUTPUT=$(abspath $(dir $@))/ $(abspath $@)
>
> --
> 2.17.1
>
Song Liu Feb. 4, 2020, 9:35 p.m. UTC | #2
> On Feb 4, 2020, at 10:43 AM, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> 
> On Tue, Feb 4, 2020 at 9:54 AM Song Liu <songliubraving@fb.com> wrote:
>> 
>> Add missing dependency of $(BPFOBJ) to $(LIBBPF_SRC), so that running make
>> in runqslower/ will rebuild libbpf.a when there is change in libbpf/.
>> 
>> Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf")
>> Cc: Andrii Nakryiko <andriin@fb.com>
>> Signed-off-by: Song Liu <songliubraving@fb.com>
>> ---
>> tools/bpf/runqslower/Makefile | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
>> index 87eae5be9bcd..ea89fcb6d68f 100644
>> --- a/tools/bpf/runqslower/Makefile
>> +++ b/tools/bpf/runqslower/Makefile
>> @@ -75,7 +75,7 @@ $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL)
>>        fi
>>        $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@
>> 
>> -$(BPFOBJ): | $(OUTPUT)
>> +$(BPFOBJ): $(LIBBPF_SRC) | $(OUTPUT)
> 
> Let's instead update this rule to do what selftests/bpf do (watch *.c,
> *.h and Makefile, and use all + install_headers to build libbpf and
> generate bpf_helper_defs.h?

Do you mean:

diff --git c/tools/bpf/runqslower/Makefile w/tools/bpf/runqslower/Makefile
index 87eae5be9bcd..39edd68afa8e 100644
--- c/tools/bpf/runqslower/Makefile
+++ w/tools/bpf/runqslower/Makefile
@@ -75,7 +75,7 @@ $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL)
        fi
        $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@

-$(BPFOBJ): | $(OUTPUT)
+$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)
        $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC)                         \
                    OUTPUT=$(abspath $(dir $@))/ $(abspath $@)

> 
> Please also specify (in subject) which tree (bpf or bpf-next) you are targeting.

Aha, I started with "bpf: runqslower:". Then I some how changed it to 
tools/bpf/runquslower. Will fix. 

Thanks,
Song
Andrii Nakryiko Feb. 4, 2020, 9:47 p.m. UTC | #3
On Tue, Feb 4, 2020 at 1:35 PM Song Liu <songliubraving@fb.com> wrote:
>
>
>
> > On Feb 4, 2020, at 10:43 AM, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
> >
> > On Tue, Feb 4, 2020 at 9:54 AM Song Liu <songliubraving@fb.com> wrote:
> >>
> >> Add missing dependency of $(BPFOBJ) to $(LIBBPF_SRC), so that running make
> >> in runqslower/ will rebuild libbpf.a when there is change in libbpf/.
> >>
> >> Fixes: 9c01546d26d2 ("tools/bpf: Add runqslower tool to tools/bpf")
> >> Cc: Andrii Nakryiko <andriin@fb.com>
> >> Signed-off-by: Song Liu <songliubraving@fb.com>
> >> ---
> >> tools/bpf/runqslower/Makefile | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
> >> index 87eae5be9bcd..ea89fcb6d68f 100644
> >> --- a/tools/bpf/runqslower/Makefile
> >> +++ b/tools/bpf/runqslower/Makefile
> >> @@ -75,7 +75,7 @@ $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL)
> >>        fi
> >>        $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@
> >>
> >> -$(BPFOBJ): | $(OUTPUT)
> >> +$(BPFOBJ): $(LIBBPF_SRC) | $(OUTPUT)
> >
> > Let's instead update this rule to do what selftests/bpf do (watch *.c,
> > *.h and Makefile, and use all + install_headers to build libbpf and
> > generate bpf_helper_defs.h?
>
> Do you mean:
>
> diff --git c/tools/bpf/runqslower/Makefile w/tools/bpf/runqslower/Makefile
> index 87eae5be9bcd..39edd68afa8e 100644
> --- c/tools/bpf/runqslower/Makefile
> +++ w/tools/bpf/runqslower/Makefile
> @@ -75,7 +75,7 @@ $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL)
>         fi
>         $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@
>
> -$(BPFOBJ): | $(OUTPUT)
> +$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)
>         $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC)                         \
>                     OUTPUT=$(abspath $(dir $@))/ $(abspath $@)

this works

Acked-by: Andrii Nakryiko <andriin@fb.com>

>
> >
> > Please also specify (in subject) which tree (bpf or bpf-next) you are targeting.
>
> Aha, I started with "bpf: runqslower:". Then I some how changed it to
> tools/bpf/runquslower. Will fix.
>
> Thanks,
> Song
>

Patch
diff mbox series

diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile
index 87eae5be9bcd..ea89fcb6d68f 100644
--- a/tools/bpf/runqslower/Makefile
+++ b/tools/bpf/runqslower/Makefile
@@ -75,7 +75,7 @@  $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL)
 	fi
 	$(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@
 
-$(BPFOBJ): | $(OUTPUT)
+$(BPFOBJ): $(LIBBPF_SRC) | $(OUTPUT)
 	$(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC)			       \
 		    OUTPUT=$(abspath $(dir $@))/ $(abspath $@)