• John Hubbard's avatar
    selftests/x86: fix Makefile dependencies to work with clang · 825658b7
    John Hubbard authored
    When building with clang, via:
    
        make LLVM=1 -C tools/testing/selftests
    
    ...the following build failure occurs in selftests/x86:
    
       clang: error: cannot specify -o when generating multiple output files
    
    This happens because, although gcc doesn't complain if you invoke it
    like this:
    
        gcc file1.c header2.h
    
    ...clang won't accept that form--it rejects the .h file(s). Also, the
    above approach is inaccurate anyway, because file.c includes header2.h
    in this case, and the inclusion of header2.h on the invocation is an
    artifact of the Makefile's desire to maintain dependencies.
    
    In Makefiles of this type, a better way to do it is to use Makefile
    dependencies to trigger the appropriate incremental rebuilds, and
    separately use file lists (see EXTRA_FILES in this commit) to track what
    to pass to the compiler.
    
    This commit splits those concepts up, by setting up both EXTRA_FILES and
    the Makefile dependencies with a single call to the new Makefile
    function extra-files.
    
    That fixes the build failure, while still providing the correct
    dependencies in all cases.
    Acked-by: default avatarMuhammad Usama Anjum <usama.anjum@collabora.com>
    Signed-off-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    825658b7
Makefile 4.24 KB