Message ID | 20201110164310.2600671-6-jean-philippe@linaro.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 85e59344d0790379e063bf3cd3dd0fe91ce3b505 |
Delegated to: | BPF |
Headers | show |
Series | tools/bpftool: Some build fixes | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for bpf-next |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | fail | Errors and warnings before: 4 this patch: 4 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | fail | Link |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Tue, Nov 10, 2020 at 8:46 AM Jean-Philippe Brucker <jean-philippe@linaro.org> wrote: > > Enable out-of-tree build for runqslower. Only set OUTPUT=.output if it > wasn't already set by the user. > > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> > --- > v3: > * Drop clean recipe for bpftool and libbpf, since the whole output > directories are removed by the clean recipe. > * Use ?= for $(OUTPUT) > --- > tools/bpf/runqslower/Makefile | 32 ++++++++++++++++++-------------- > 1 file changed, 18 insertions(+), 14 deletions(-) > [...] > clean: > $(call QUIET_CLEAN, runqslower) > - $(Q)rm -rf $(OUTPUT) runqslower > + $(Q)$(RM) -r $(BPFOBJ_OUTPUT) $(BPFTOOL_OUTPUT) > + $(Q)$(RM) $(OUTPUT)*.o $(OUTPUT)*.d > + $(Q)$(RM) $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h > + $(Q)$(RM) $(OUTPUT)runqslower > + $(Q)$(RM) -r .output hard-coding .output here doesn't seem right, didn't all the other lines clean up everything already? > > $(OUTPUT)/runqslower: $(OUTPUT)/runqslower.o $(BPFOBJ) > $(QUIET_LINK)$(CC) $(CFLAGS) $^ -lelf -lz -o $@ > @@ -59,8 +65,8 @@ $(OUTPUT)/%.bpf.o: %.bpf.c $(BPFOBJ) | $(OUTPUT) > $(OUTPUT)/%.o: %.c | $(OUTPUT) > $(QUIET_CC)$(CC) $(CFLAGS) $(INCLUDES) -c $(filter %.c,$^) -o $@ > [...]
On Tue, Nov 10, 2020 at 09:11:05PM -0800, Andrii Nakryiko wrote: > On Tue, Nov 10, 2020 at 8:46 AM Jean-Philippe Brucker > <jean-philippe@linaro.org> wrote: > > > > Enable out-of-tree build for runqslower. Only set OUTPUT=.output if it > > wasn't already set by the user. > > > > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> > > --- > > v3: > > * Drop clean recipe for bpftool and libbpf, since the whole output > > directories are removed by the clean recipe. > > * Use ?= for $(OUTPUT) > > --- > > tools/bpf/runqslower/Makefile | 32 ++++++++++++++++++-------------- > > 1 file changed, 18 insertions(+), 14 deletions(-) > > > > [...] > > > clean: > > $(call QUIET_CLEAN, runqslower) > > - $(Q)rm -rf $(OUTPUT) runqslower > > + $(Q)$(RM) -r $(BPFOBJ_OUTPUT) $(BPFTOOL_OUTPUT) > > + $(Q)$(RM) $(OUTPUT)*.o $(OUTPUT)*.d > > + $(Q)$(RM) $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h > > + $(Q)$(RM) $(OUTPUT)runqslower > > + $(Q)$(RM) -r .output > > hard-coding .output here doesn't seem right, didn't all the other > lines clean up everything already? Yes, but to clean the source tree, the .output directory needs to be removed. On the other hand when $(OUTPUT) is out-of-tree, we only want to remove its content but not the dir itself, because it was created by the user. Thanks, Jean > > > > > $(OUTPUT)/runqslower: $(OUTPUT)/runqslower.o $(BPFOBJ) > > $(QUIET_LINK)$(CC) $(CFLAGS) $^ -lelf -lz -o $@ > > @@ -59,8 +65,8 @@ $(OUTPUT)/%.bpf.o: %.bpf.c $(BPFOBJ) | $(OUTPUT) > > $(OUTPUT)/%.o: %.c | $(OUTPUT) > > $(QUIET_CC)$(CC) $(CFLAGS) $(INCLUDES) -c $(filter %.c,$^) -o $@ > > > > [...]
On Wed, Nov 11, 2020 at 12:54 AM Jean-Philippe Brucker <jean-philippe@linaro.org> wrote: > > On Tue, Nov 10, 2020 at 09:11:05PM -0800, Andrii Nakryiko wrote: > > On Tue, Nov 10, 2020 at 8:46 AM Jean-Philippe Brucker > > <jean-philippe@linaro.org> wrote: > > > > > > Enable out-of-tree build for runqslower. Only set OUTPUT=.output if it > > > wasn't already set by the user. > > > > > > Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> > > > --- > > > v3: > > > * Drop clean recipe for bpftool and libbpf, since the whole output > > > directories are removed by the clean recipe. > > > * Use ?= for $(OUTPUT) > > > --- > > > tools/bpf/runqslower/Makefile | 32 ++++++++++++++++++-------------- > > > 1 file changed, 18 insertions(+), 14 deletions(-) > > > > > > > [...] > > > > > clean: > > > $(call QUIET_CLEAN, runqslower) > > > - $(Q)rm -rf $(OUTPUT) runqslower > > > + $(Q)$(RM) -r $(BPFOBJ_OUTPUT) $(BPFTOOL_OUTPUT) > > > + $(Q)$(RM) $(OUTPUT)*.o $(OUTPUT)*.d > > > + $(Q)$(RM) $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h > > > + $(Q)$(RM) $(OUTPUT)runqslower > > > + $(Q)$(RM) -r .output > > > > hard-coding .output here doesn't seem right, didn't all the other > > lines clean up everything already? > > Yes, but to clean the source tree, the .output directory needs to be > removed. On the other hand when $(OUTPUT) is out-of-tree, we only want to > remove its content but not the dir itself, because it was created by the > user. Right, this is fine. > > Thanks, > Jean > > > > > > > > > $(OUTPUT)/runqslower: $(OUTPUT)/runqslower.o $(BPFOBJ) > > > $(QUIET_LINK)$(CC) $(CFLAGS) $^ -lelf -lz -o $@ > > > @@ -59,8 +65,8 @@ $(OUTPUT)/%.bpf.o: %.bpf.c $(BPFOBJ) | $(OUTPUT) > > > $(OUTPUT)/%.o: %.c | $(OUTPUT) > > > $(QUIET_CC)$(CC) $(CFLAGS) $(INCLUDES) -c $(filter %.c,$^) -o $@ > > > > > > > [...]
diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile index bcc4a7396713..0fc4d4046193 100644 --- a/tools/bpf/runqslower/Makefile +++ b/tools/bpf/runqslower/Makefile @@ -1,15 +1,18 @@ # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) include ../../scripts/Makefile.include -OUTPUT := .output +OUTPUT ?= $(abspath .output)/ + CLANG ?= clang LLC ?= llc LLVM_STRIP ?= llvm-strip -DEFAULT_BPFTOOL := $(OUTPUT)/sbin/bpftool +BPFTOOL_OUTPUT := $(OUTPUT)bpftool/ +DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)bpftool BPFTOOL ?= $(DEFAULT_BPFTOOL) LIBBPF_SRC := $(abspath ../../lib/bpf) -BPFOBJ := $(OUTPUT)/libbpf.a -BPF_INCLUDE := $(OUTPUT) +BPFOBJ_OUTPUT := $(OUTPUT)libbpf/ +BPFOBJ := $(BPFOBJ_OUTPUT)libbpf.a +BPF_INCLUDE := $(BPFOBJ_OUTPUT) INCLUDES := -I$(OUTPUT) -I$(BPF_INCLUDE) -I$(abspath ../../lib) \ -I$(abspath ../../include/uapi) CFLAGS := -g -Wall @@ -20,7 +23,6 @@ VMLINUX_BTF_PATHS := /sys/kernel/btf/vmlinux /boot/vmlinux-$(KERNEL_REL) VMLINUX_BTF_PATH := $(or $(VMLINUX_BTF),$(firstword \ $(wildcard $(VMLINUX_BTF_PATHS)))) -abs_out := $(abspath $(OUTPUT)) ifeq ($(V),1) Q = else @@ -38,7 +40,11 @@ runqslower: $(OUTPUT)/runqslower clean: $(call QUIET_CLEAN, runqslower) - $(Q)rm -rf $(OUTPUT) runqslower + $(Q)$(RM) -r $(BPFOBJ_OUTPUT) $(BPFTOOL_OUTPUT) + $(Q)$(RM) $(OUTPUT)*.o $(OUTPUT)*.d + $(Q)$(RM) $(OUTPUT)*.skel.h $(OUTPUT)vmlinux.h + $(Q)$(RM) $(OUTPUT)runqslower + $(Q)$(RM) -r .output $(OUTPUT)/runqslower: $(OUTPUT)/runqslower.o $(BPFOBJ) $(QUIET_LINK)$(CC) $(CFLAGS) $^ -lelf -lz -o $@ @@ -59,8 +65,8 @@ $(OUTPUT)/%.bpf.o: %.bpf.c $(BPFOBJ) | $(OUTPUT) $(OUTPUT)/%.o: %.c | $(OUTPUT) $(QUIET_CC)$(CC) $(CFLAGS) $(INCLUDES) -c $(filter %.c,$^) -o $@ -$(OUTPUT): - $(QUIET_MKDIR)mkdir -p $(OUTPUT) +$(OUTPUT) $(BPFOBJ_OUTPUT) $(BPFTOOL_OUTPUT): + $(QUIET_MKDIR)mkdir -p $@ $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL) $(Q)if [ ! -e "$(VMLINUX_BTF_PATH)" ] ; then \ @@ -70,10 +76,8 @@ $(OUTPUT)/vmlinux.h: $(VMLINUX_BTF_PATH) | $(OUTPUT) $(BPFTOOL) fi $(QUIET_GEN)$(BPFTOOL) btf dump file $(VMLINUX_BTF_PATH) format c > $@ -$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT) - $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) \ - OUTPUT=$(abspath $(dir $@))/ $(abspath $@) +$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(BPFOBJ_OUTPUT) + $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(BPFOBJ_OUTPUT) $@ -$(DEFAULT_BPFTOOL): - $(Q)$(MAKE) $(submake_extras) -C ../bpftool \ - prefix= OUTPUT=$(abs_out)/ DESTDIR=$(abs_out) install +$(DEFAULT_BPFTOOL): | $(BPFTOOL_OUTPUT) + $(Q)$(MAKE) $(submake_extras) -C ../bpftool OUTPUT=$(BPFTOOL_OUTPUT)
Enable out-of-tree build for runqslower. Only set OUTPUT=.output if it wasn't already set by the user. Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org> --- v3: * Drop clean recipe for bpftool and libbpf, since the whole output directories are removed by the clean recipe. * Use ?= for $(OUTPUT) --- tools/bpf/runqslower/Makefile | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)