• Viktor Malik's avatar
    samples/bpf: Fix passing LDFLAGS to libbpf · f56bcfad
    Viktor Malik authored
    samples/bpf/Makefile passes LDFLAGS=$(TPROGS_LDFLAGS) to libbpf build
    without surrounding quotes, which may cause compilation errors when
    passing custom TPROGS_USER_LDFLAGS.
    
    For example:
    
        $ make -C samples/bpf/ TPROGS_USER_LDFLAGS="-Wl,--as-needed -specs=/usr/lib/gcc/x86_64-redhat-linux/13/libsanitizer.spec"
        make: Entering directory './samples/bpf'
        make -C ../../ M=./samples/bpf BPF_SAMPLES_PATH=./samples/bpf
        make[1]: Entering directory '.'
        make -C ./samples/bpf/../../tools/lib/bpf RM='rm -rf' EXTRA_CFLAGS="-Wall -O2 -Wmissing-prototypes -Wstrict-prototypes  -I./usr/include -I./tools/testing/selftests/bpf/ -I./samples/bpf/libbpf/include -I./tools/include -I./tools/perf -I./tools/lib -DHAVE_ATTR_TEST=0" \
                LDFLAGS=-Wl,--as-needed -specs=/usr/lib/gcc/x86_64-redhat-linux/13/libsanitizer.spec srctree=./samples/bpf/../../ \
                O= OUTPUT=./samples/bpf/libbpf/ DESTDIR=./samples/bpf/libbpf prefix= \
                ./samples/bpf/libbpf/libbpf.a install_headers
        make: invalid option -- 'c'
        make: invalid option -- '='
        make: invalid option -- '/'
        make: invalid option -- 'u'
        make: invalid option -- '/'
        [...]
    
    Fix the error by properly quoting $(TPROGS_LDFLAGS).
    Suggested-by: default avatarDonald Zickus <dzickus@redhat.com>
    Signed-off-by: default avatarViktor Malik <vmalik@redhat.com>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/c690de6671cc6c983d32a566d33fd7eabd18b526.1698213811.git.vmalik@redhat.com
    f56bcfad
Makefile 14.3 KB