diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:10:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:10:00 +0000 |
commit | 4ba2b326284765e942044db13a7f0dae702bec93 (patch) | |
tree | cbdfaec33eed4f3a970c54cd10e8ddfe3003b3b1 /lib/defines.mk | |
parent | Initial commit. (diff) | |
download | xdp-tools-upstream.tar.xz xdp-tools-upstream.zip |
Adding upstream version 1.3.1.upstream/1.3.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/defines.mk')
-rw-r--r-- | lib/defines.mk | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/defines.mk b/lib/defines.mk new file mode 100644 index 0000000..f134c43 --- /dev/null +++ b/lib/defines.mk @@ -0,0 +1,47 @@ +CFLAGS ?= -O2 -g +BPF_CFLAGS ?= -Wno-visibility +BPF_TARGET ?= bpf + +HAVE_FEATURES := + +include $(LIB_DIR)/../config.mk +include $(LIB_DIR)/../version.mk + +PREFIX?=/usr/local +LIBDIR?=$(PREFIX)/lib +SBINDIR?=$(PREFIX)/sbin +HDRDIR?=$(PREFIX)/include/xdp +DATADIR?=$(PREFIX)/share +RUNDIR?=/run +MANDIR?=$(DATADIR)/man +SCRIPTSDIR?=$(DATADIR)/xdp-tools +BPF_DIR_MNT ?=/sys/fs/bpf +BPF_OBJECT_DIR ?=$(LIBDIR)/bpf +MAX_DISPATCHER_ACTIONS ?=10 + +HEADER_DIR = $(LIB_DIR)/../headers +TEST_DIR = $(LIB_DIR)/testing +LIBXDP_DIR := $(LIB_DIR)/libxdp +LIBBPF_DIR := $(LIB_DIR)/libbpf + +DEFINES := -DBPF_DIR_MNT=\"$(BPF_DIR_MNT)\" -DBPF_OBJECT_PATH=\"$(BPF_OBJECT_DIR)\" \ + -DMAX_DISPATCHER_ACTIONS=$(MAX_DISPATCHER_ACTIONS) -DTOOLS_VERSION=\"$(TOOLS_VERSION)\" \ + -DLIBBPF_VERSION=\"$(LIBBPF_VERSION)\" -DRUNDIR=\"$(RUNDIR)\" + +DEFINES += $(foreach feat,$(HAVE_FEATURES),-DHAVE_$(feat)) + +ifneq ($(PRODUCTION),1) +DEFINES += -DDEBUG +endif + +ifeq ($(SYSTEM_LIBBPF),y) +DEFINES += -DLIBBPF_DYNAMIC +endif + +DEFINES += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 + +CFLAGS += -std=gnu11 -Wextra -Werror $(DEFINES) +BPF_CFLAGS += $(DEFINES) $(filter -ffile-prefix-map=%,$(CFLAGS)) + +CONFIGMK := $(LIB_DIR)/../config.mk +LIBMK := Makefile $(CONFIGMK) $(LIB_DIR)/defines.mk $(LIB_DIR)/common.mk $(LIB_DIR)/../version.mk |