On Mon, Nov 9, 2020 at 3:11 AM Jean-Philippe Brucker <jean-philippe@xxxxxxxxxx> 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@xxxxxxxxxx> > --- > tools/bpf/runqslower/Makefile | 45 +++++++++++++++++++++++------------ > 1 file changed, 30 insertions(+), 15 deletions(-) > > diff --git a/tools/bpf/runqslower/Makefile b/tools/bpf/runqslower/Makefile > index bcc4a7396713..861f4dcde960 100644 > --- a/tools/bpf/runqslower/Makefile > +++ b/tools/bpf/runqslower/Makefile > @@ -1,15 +1,20 @@ > # SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) > include ../../scripts/Makefile.include > > -OUTPUT := .output > +ifeq ($(OUTPUT),) > + OUTPUT = $(abspath .output)/ > +endif OUTPUT ?= .. didn't work? > + > 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 +25,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 > @@ -36,9 +40,13 @@ all: runqslower > > runqslower: $(OUTPUT)/runqslower > > -clean: > +clean: $(DEFAULT_BPFTOOL)-clean $(BPFOBJ)-clean why separate targets for $(DEFAULT_BPFTOOL)-clean and $(BPFOBJ)-clean? Are they intended to be called separately? I don't think parallelization is that important for the clean up. Let's just keep all the cleaning in one place, not spreading it across Makefile? > $(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 > [...]