Subject: Re: [PATCH] samples: bpf: fix outdated README build command

From: Toke Høiland-Jørgensen <[email-masked]>
Date: Mon, 11 Nov 2019 10:24:50 +0100

Andrii Nakryiko <[email-masked]> writes:

> On Sun, Nov 10, 2019 at 12:19 AM Daniel T. Lee <[email-masked]> wrote:
>>
>> Currently, building the bpf samples under samples/bpf directory isn't
>> working. Running make from the directory 'samples/bpf' will just shows
>> following result without compiling any samples.
>>
>
> Do you mind trying to see if it's possible to detect that plain `make`
> is being run from samples/bpf subdirectory, and if that's the case,
> just running something like `make M=samples/bpf -C ../../`? If that's
> not too hard, it would be a nice touch to still have it working old
> (and intuitive) way, IMO.

I think it's just the M= that's missing. Tentatively, the below seems to
work for me (I get some other compile errors, but I think that is
unrelated).

-Toke

diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 8a9af3ab7769..48e7f1ff7861 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -246,7 +246,7 @@ endif
 
 # Trick to allow make to be run from this directory
 all:
-       $(MAKE) -C ../../ $(CURDIR)/ BPF_SAMPLES_PATH=$(CURDIR)
+       $(MAKE) -C ../../ M=$(CURDIR) BPF_SAMPLES_PATH=$(CURDIR)
 
 clean:
        $(MAKE) -C ../../ M=$(CURDIR) clean