Skip to content

Commit 633ba3b

Browse files
bentissJiri Kosina
authored andcommitted
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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 507806e commit 633ba3b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/testing/selftests/hid/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ $(MAKE_DIRS):
9191
$(call msg,MKDIR,,$@)
9292
$(Q)mkdir -p $@
9393

94-
$(OUTPUT)/%.o: %.c
95-
$(call msg,CC,,$@)
96-
$(Q)$(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@
97-
9894
# LLVM's ld.lld doesn't support all the architectures, so use it only on x86
9995
ifeq ($(SRCARCH),x86)
10096
LLD := lld
@@ -223,7 +219,11 @@ $(BPF_SKELS): %.skel.h: %.bpf.o $(BPFTOOL) | $(OUTPUT)
223219
$(Q)$(BPFTOOL) gen object $(<:.o=.linked1.o) $<
224220
$(Q)$(BPFTOOL) gen skeleton $(<:.o=.linked1.o) name $(notdir $(<:.bpf.o=)) > $@
225221

226-
$(OUTPUT)/%:%.c $(BPF_SKELS) $(KHDR_INCLUDES)/linux/hid.h
222+
$(OUTPUT)/%.o: %.c $(BPF_SKELS) $(KHDR_INCLUDES)/linux/hid.h
223+
$(call msg,CC,,$@)
224+
$(Q)$(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@
225+
226+
$(OUTPUT)/%: $(OUTPUT)/%.o
227227
$(call msg,BINARY,,$@)
228228
$(Q)$(LINK.c) $^ $(LDLIBS) -o $@
229229

0 commit comments

Comments
 (0)