Skip to content

Commit

Permalink
tools/bpf: Don't use $(COMPILE.c)
Browse files Browse the repository at this point in the history
When using make kselftest TARGETS=bpf, tools/bpf is built with
MAKEFLAGS=rR, which causes $(COMPILE.c) to be undefined, which in turn
causes the build to fail with

  CC       kselftest/bpf/tools/build/bpftool/map_perf_ring.o
/bin/sh: 1: -MMD: not found

Fix by using $(CC) $(CFLAGS) -c instead of $(COMPILE.c).

Signed-off-by: Ilya Leoshkevich <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
iii-i authored and borkmann committed Jun 2, 2020
1 parent 9bc499b commit d70a6be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tools/bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ $(OUTPUT)%.lex.c: $(srctree)/tools/bpf/%.l
$(QUIET_FLEX)$(LEX) -o $@ $<

$(OUTPUT)%.o: $(srctree)/tools/bpf/%.c
$(QUIET_CC)$(COMPILE.c) -o $@ $<
$(QUIET_CC)$(CC) $(CFLAGS) -c -o $@ $<

$(OUTPUT)%.yacc.o: $(OUTPUT)%.yacc.c
$(QUIET_CC)$(COMPILE.c) -o $@ $<
$(QUIET_CC)$(CC) $(CFLAGS) -c -o $@ $<
$(OUTPUT)%.lex.o: $(OUTPUT)%.lex.c
$(QUIET_CC)$(COMPILE.c) -o $@ $<
$(QUIET_CC)$(CC) $(CFLAGS) -c -o $@ $<

PROGS = $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg $(OUTPUT)bpf_asm

Expand Down
8 changes: 4 additions & 4 deletions tools/bpf/bpftool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ else
endif

$(OUTPUT)_prog.o: prog.c
$(QUIET_CC)$(COMPILE.c) -MMD -DBPFTOOL_WITHOUT_SKELETONS -o $@ $<
$(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -DBPFTOOL_WITHOUT_SKELETONS -o $@ $<

$(OUTPUT)_bpftool: $(_OBJS) $(LIBBPF)
$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(_OBJS) $(LIBS)
Expand All @@ -141,18 +141,18 @@ profiler.skel.h: $(OUTPUT)_bpftool skeleton/profiler.bpf.o
$(QUIET_GEN)$(OUTPUT)./_bpftool gen skeleton skeleton/profiler.bpf.o > $@

$(OUTPUT)prog.o: prog.c profiler.skel.h
$(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
$(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -o $@ $<

$(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
$(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
$(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -o $@ $<

$(OUTPUT)feature.o: | zdep

$(OUTPUT)bpftool: $(__OBJS) $(LIBBPF)
$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(__OBJS) $(LIBS)

$(OUTPUT)%.o: %.c
$(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
$(QUIET_CC)$(CC) $(CFLAGS) -c -MMD -o $@ $<

clean: $(LIBBPF)-clean
$(call QUIET_CLEAN, bpftool)
Expand Down

0 comments on commit d70a6be

Please sign in to comment.