Skip to content

Commit a50b7f8

Browse files
Jiri Bencborkmann
authored andcommitted
tools: bpf: respect quiet/verbose build
Default to quiet build, with V=1 enabling verbose build as is usual. Signed-off-by: Jiri Benc <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent 58416c3 commit a50b7f8

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

tools/bpf/Makefile

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ srctree := $(patsubst %/,%,$(dir $(CURDIR)))
1717
srctree := $(patsubst %/,%,$(dir $(srctree)))
1818
endif
1919

20+
ifeq ($(V),1)
21+
Q =
22+
else
23+
Q = @
24+
endif
25+
2026
FEATURE_USER = .bpf
2127
FEATURE_TESTS = libbfd disassembler-four-args
2228
FEATURE_DISPLAY = libbfd disassembler-four-args
@@ -42,38 +48,48 @@ CFLAGS += -DDISASM_FOUR_ARGS_SIGNATURE
4248
endif
4349

4450
$(OUTPUT)%.yacc.c: $(srctree)/tools/bpf/%.y
45-
$(YACC) -o $@ -d $<
51+
$(QUIET_BISON)$(YACC) -o $@ -d $<
4652

4753
$(OUTPUT)%.lex.c: $(srctree)/tools/bpf/%.l
48-
$(LEX) -o $@ $<
54+
$(QUIET_FLEX)$(LEX) -o $@ $<
4955

5056
$(OUTPUT)%.o: $(srctree)/tools/bpf/%.c
51-
$(COMPILE.c) -o $@ $<
57+
$(QUIET_CC)$(COMPILE.c) -o $@ $<
58+
59+
$(OUTPUT)%.yacc.o: $(OUTPUT)%.yacc.c
60+
$(QUIET_CC)$(COMPILE.c) -o $@ $<
61+
$(OUTPUT)%.lex.o: $(OUTPUT)%.lex.c
62+
$(QUIET_CC)$(COMPILE.c) -o $@ $<
5263

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

5566
all: $(PROGS) bpftool
5667

5768
$(OUTPUT)bpf_jit_disasm: CFLAGS += -DPACKAGE='bpf_jit_disasm'
58-
$(OUTPUT)bpf_jit_disasm: LDLIBS = -lopcodes -lbfd -ldl
5969
$(OUTPUT)bpf_jit_disasm: $(OUTPUT)bpf_jit_disasm.o
70+
$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ -lopcodes -lbfd -ldl
6071

61-
$(OUTPUT)bpf_dbg: LDLIBS = -lreadline
6272
$(OUTPUT)bpf_dbg: $(OUTPUT)bpf_dbg.o
73+
$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ -lreadline
6374

64-
$(OUTPUT)bpf_asm: LDLIBS =
6575
$(OUTPUT)bpf_asm: $(OUTPUT)bpf_asm.o $(OUTPUT)bpf_exp.yacc.o $(OUTPUT)bpf_exp.lex.o
76+
$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^
77+
6678
$(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.yacc.c
6779

6880
clean: bpftool_clean
69-
rm -rf $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
81+
$(call QUIET_CLEAN, bpf-progs)
82+
$(Q)rm -rf $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
7083
$(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
7184

7285
install: $(PROGS) bpftool_install
73-
$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/bin
74-
$(INSTALL) $(OUTPUT)bpf_jit_disasm $(DESTDIR)$(prefix)/bin/bpf_jit_disasm
75-
$(INSTALL) $(OUTPUT)bpf_dbg $(DESTDIR)$(prefix)/bin/bpf_dbg
76-
$(INSTALL) $(OUTPUT)bpf_asm $(DESTDIR)$(prefix)/bin/bpf_asm
86+
$(call QUIET_INSTALL, bpf_jit_disasm)
87+
$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/bin
88+
$(Q)$(INSTALL) $(OUTPUT)bpf_jit_disasm $(DESTDIR)$(prefix)/bin/bpf_jit_disasm
89+
$(call QUIET_INSTALL, bpf_dbg)
90+
$(Q)$(INSTALL) $(OUTPUT)bpf_dbg $(DESTDIR)$(prefix)/bin/bpf_dbg
91+
$(call QUIET_INSTALL, bpf_asm)
92+
$(Q)$(INSTALL) $(OUTPUT)bpf_asm $(DESTDIR)$(prefix)/bin/bpf_asm
7793

7894
bpftool:
7995
$(call descend,bpftool)

0 commit comments

Comments
 (0)