selftests: vm: fix clang build error multiple output files
authorYosry Ahmed <yosryahmed@google.com>
Wed, 16 Mar 2022 23:15:12 +0000 (16:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 17 Mar 2022 18:02:13 +0000 (11:02 -0700)
commit1c4debc443ef7037dcb7c4f08c33b9caebd21d2e
tree8747dda26405c24e3699430c01500d33dcca52a3
parent7b0b1332cfdb94489836b67d088a779699f8e47e
selftests: vm: fix clang build error multiple output files

When building the vm selftests using clang, some errors are seen due to
having headers in the compilation command:

  clang -Wall -I ../../../../usr/include  -no-pie    gup_test.c ../../../../mm/gup_test.h -lrt -lpthread -o .../tools/testing/selftests/vm/gup_test
  clang: error: cannot specify -o when generating multiple output files
  make[1]: *** [../lib.mk:146: .../tools/testing/selftests/vm/gup_test] Error 1

Rework to add the header files to LOCAL_HDRS before including ../lib.mk,
since the dependency is evaluated in '$(OUTPUT)/%:%.c $(LOCAL_HDRS)' in
file lib.mk.

Link: https://lkml.kernel.org/r/20220304000645.1888133-1-yosryahmed@google.com
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
tools/testing/selftests/vm/Makefile