Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: hid: allow to compile hid_bpf with LLVM

clang doesn't like to compile a source to the final binary directly:

clang-14: error: cannot specify -o when generating multiple output files

So split the final rule in 2, and ensure we compile all dependencies
before.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Benjamin Tissoires and committed by
Jiri Kosina
633ba3be 507806e9

+5 -5
+5 -5
tools/testing/selftests/hid/Makefile
··· 91 91 $(call msg,MKDIR,,$@) 92 92 $(Q)mkdir -p $@ 93 93 94 - $(OUTPUT)/%.o: %.c 95 - $(call msg,CC,,$@) 96 - $(Q)$(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@ 97 - 98 94 # LLVM's ld.lld doesn't support all the architectures, so use it only on x86 99 95 ifeq ($(SRCARCH),x86) 100 96 LLD := lld ··· 219 223 $(Q)$(BPFTOOL) gen object $(<:.o=.linked1.o) $< 220 224 $(Q)$(BPFTOOL) gen skeleton $(<:.o=.linked1.o) name $(notdir $(<:.bpf.o=)) > $@ 221 225 222 - $(OUTPUT)/%:%.c $(BPF_SKELS) $(KHDR_INCLUDES)/linux/hid.h 226 + $(OUTPUT)/%.o: %.c $(BPF_SKELS) $(KHDR_INCLUDES)/linux/hid.h 227 + $(call msg,CC,,$@) 228 + $(Q)$(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@ 229 + 230 + $(OUTPUT)/%: $(OUTPUT)/%.o 223 231 $(call msg,BINARY,,$@) 224 232 $(Q)$(LINK.c) $^ $(LDLIBS) -o $@ 225 233