mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 12:15:08 +07:00
658e85aa4f
Several minor fixes and harmonisation items for Makefiles: * Use the same mechanism for verbose/non-verbose output in two files ("$(Q)"), for all commands. * Use calls to "QUIET_INSTALL" and equivalent in Makefile. In particular, use "call(descend, ...)" instead of "make -C" to run documentation targets. * Add a "doc-clean" target, aligned on "doc" and "doc-install". * Make "install" target in Makefile depend on "bpftool". * Remove condition on DESTDIR to initialise prefix in doc Makefile. * Remove modification of VPATH based on OUTPUT, it is unused. * Formatting: harmonise spaces around equal signs. * Make install path for man pages /usr/local/man instead of /usr/local/share/man (respects the Makefile conventions, and the latter is usually a symbolic link to the former anyway). * Do not erase prefix if set by user in bpftool Makefile. * Fix install target for bpftool: append DESTDIR to install path. Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
87 lines
2.0 KiB
Makefile
87 lines
2.0 KiB
Makefile
include ../../scripts/Makefile.include
|
|
include ../../scripts/utilities.mak
|
|
|
|
ifeq ($(srctree),)
|
|
srctree := $(patsubst %/,%,$(dir $(CURDIR)))
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
srctree := $(patsubst %/,%,$(dir $(srctree)))
|
|
endif
|
|
|
|
ifeq ($(V),1)
|
|
Q =
|
|
else
|
|
Q = @
|
|
endif
|
|
|
|
BPF_DIR = $(srctree)/tools/lib/bpf/
|
|
|
|
ifneq ($(OUTPUT),)
|
|
BPF_PATH = $(OUTPUT)
|
|
else
|
|
BPF_PATH = $(BPF_DIR)
|
|
endif
|
|
|
|
LIBBPF = $(BPF_PATH)libbpf.a
|
|
|
|
$(LIBBPF): FORCE
|
|
$(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
|
|
|
|
$(LIBBPF)-clean:
|
|
$(call QUIET_CLEAN, libbpf)
|
|
$(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) clean >/dev/null
|
|
|
|
prefix ?= /usr/local
|
|
bash_compdir ?= /usr/share/bash-completion/completions
|
|
|
|
CC = gcc
|
|
|
|
CFLAGS += -O2
|
|
CFLAGS += -W -Wall -Wextra -Wno-unused-parameter -Wshadow
|
|
CFLAGS += -D__EXPORTED_HEADERS__ -I$(srctree)/tools/include/uapi -I$(srctree)/tools/include -I$(srctree)/tools/lib/bpf -I$(srctree)/kernel/bpf/
|
|
LIBS = -lelf -lbfd -lopcodes $(LIBBPF)
|
|
|
|
INSTALL ?= install
|
|
RM ?= rm -f
|
|
|
|
include $(wildcard *.d)
|
|
|
|
all: $(OUTPUT)bpftool
|
|
|
|
SRCS = $(wildcard *.c)
|
|
OBJS = $(patsubst %.c,$(OUTPUT)%.o,$(SRCS)) $(OUTPUT)disasm.o
|
|
|
|
$(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
|
|
$(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
|
|
|
|
$(OUTPUT)bpftool: $(OBJS) $(LIBBPF)
|
|
$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
|
|
|
$(OUTPUT)%.o: %.c
|
|
$(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
|
|
|
|
clean: $(LIBBPF)-clean
|
|
$(call QUIET_CLEAN, bpftool)
|
|
$(Q)$(RM) $(OUTPUT)bpftool $(OUTPUT)*.o $(OUTPUT)*.d
|
|
|
|
install: $(OUTPUT)bpftool
|
|
$(call QUIET_INSTALL, bpftool)
|
|
$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(prefix)/sbin
|
|
$(Q)$(INSTALL) $(OUTPUT)bpftool $(DESTDIR)$(prefix)/sbin/bpftool
|
|
$(Q)$(INSTALL) -m 0755 -d $(DESTDIR)$(bash_compdir)
|
|
$(Q)$(INSTALL) -m 0644 bash-completion/bpftool $(DESTDIR)$(bash_compdir)
|
|
|
|
doc:
|
|
$(call descend,Documentation)
|
|
|
|
doc-clean:
|
|
$(call descend,Documentation,clean)
|
|
|
|
doc-install:
|
|
$(call descend,Documentation,install)
|
|
|
|
FORCE:
|
|
|
|
.PHONY: all FORCE clean install
|
|
.PHONY: doc doc-clean doc-install
|
|
.DEFAULT_GOAL := all
|