• Quentin Monnet's avatar
    bpftool: Do not FORCE-build libbpf · ced846c6
    Quentin Monnet authored
    In bpftool's Makefile, libbpf has a FORCE dependency, to make sure we
    rebuild it in case its source files changed. Let's instead make the
    rebuild depend on the source files directly, through a call to the
    "$(wildcard ...)" function. This avoids descending into libbpf's
    directory if there is nothing to update.
    
    Do the same for the bootstrap libbpf version.
    
    This results in a slightly faster operation and less verbose output when
    running make a second time in bpftool's directory.
    
    Before:
    
        Auto-detecting system features:
        ...                        libbfd: [ on  ]
        ...        disassembler-four-args: [ on  ]
        ...                          zlib: [ on  ]
        ...                        libcap: [ on  ]
        ...               clang-bpf-co-re: [ on  ]
    
        make[1]: Entering directory '/root/dev/linux/tools/lib/bpf'
        make[1]: Entering directory '/root/dev/linux/tools/lib/bpf'
        make[1]: Nothing to be done for 'install_headers'.
        make[1]: Leaving directory '/root/dev/linux/tools/lib/bpf'
        make[1]: Leaving directory '/root/dev/linux/tools/lib/bpf'
    
    After:
    
        Auto-detecting system features:
        ...                        libbfd: [ on  ]
        ...        disassembler-four-args: [ on  ]
        ...                          zlib: [ on  ]
        ...                        libcap: [ on  ]
        ...               clang-bpf-co-re: [ on  ]
    
    Other ways to clean up the output could be to pass the "-s" option, or
    to redirect the output to >/dev/null, when calling make recursively to
    descend into libbpf's directory. However, this would suppress some
    useful output if something goes wrong during the build. A better
    alternative would be to pass "--no-print-directory" to the recursive
    make, but that would still leave us with some noise for
    "install_headers". Skipping the descent into libbpf's directory if no
    source file has changed works best, and seems the most logical option
    overall.
    Reported-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Signed-off-by: default avatarQuentin Monnet <quentin@isovalent.com>
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
    Link: https://lore.kernel.org/bpf/20211009210341.6291-3-quentin@isovalent.com
    ced846c6
Makefile 7.32 KB