Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve the makefile to support #3

Open
vipinpv85 opened this issue Jul 19, 2022 · 1 comment
Open

improve the makefile to support #3

vipinpv85 opened this issue Jul 19, 2022 · 1 comment

Comments

@vipinpv85
Copy link

in order to have external dependencies for libraries and PMD and support latest DPDK, my suggestion is to update makefile

diff --git a/dpdk-apps/Makefile b/dpdk-apps/Makefile
index 3da318d..40a1e2f 100644
--- a/dpdk-apps/Makefile
+++ b/dpdk-apps/Makefile
@@ -31,7 +31,14 @@ include $(R2P2LIB_DIR)/dir.mk


 CC=gcc
-CFLAGS += -g -O3 -I$(ROOTDIR)/netstack/inc -I$(R2P2LIB_DIR)/inc -I$(RTE_SDK)/x86_64-native-linuxapp-gcc/include -I$(RAFT_DIR)/include -DNO_BATCH #-DACCELERATED #-DRAFT_STATS
+CFLAGS += -g -O3 -I$(ROOTDIR)/netstack/inc -I$(R2P2LIB_DIR)/inc -I$(RAFT_DIR)/include -DNO_BATCH #-DACCELERATED #-DRAFT_STATS
+
+DPDK_VERSION:=$(shell  pkg-config --modversion libdpdk)
+ifneq ("$(DPDK_VERSION)", "")
+       CFLAGS += ${shell pkg-config --cflags --static libdpdk}
+else
+       CFLAGS += -I$(RTE_SDK)/x86_64-native-linuxapp-gcc/include
+endif

 ifeq ($(WITH_RAFT), 1)
        CFLAGS += -DWITH_RAFT
@@ -72,7 +79,13 @@ WERROR_FLAGS += -Wformat-nonliteral -Wformat-security
 WERROR_FLAGS += -Wundef -Wwrite-strings

 CFLAGS += $(WERROR_FLAGS) -mavx2
-LDFLAGS= -Wl,--whole-archive -Wl,-ldpdk -Wl,--no-whole-archive -lrt -lpthread -lm -ldl -L$(RTE_SDK)/x86_64-native-linuxapp-gcc/lib -lconfig -lnuma -lgcov --coverage -lpcap
+
+ifneq ("$(DPDK_VERSION)", "")
+       LDFLAGS += ${shell pkg-config --libs --static libdpdk}
+else
+       LDFLAGS= -Wl,--whole-archive -Wl,-ldpdk -Wl,--no-whole-archive -lrt -lpthread -lm -ldl -L$(RTE_SDK)/x86_64-native-linuxapp-gcc/lib -lconfig -lnuma -lgcov --coverage -lpcap
+endif
+LDFLAGS += -lconfig -lgcov --coverage -lpcap

 SRCS_C := $(addprefix $(ROOTDIR)/netstack/dp/, $(DP_SRC)) $(addprefix $(ROOTDIR)/netstack/net/, $(NET_SRC)) $(addprefix $(R2P2LIB_DIR)/, $(R2P2_SRC_C))
 OBJS_C := $(patsubst %.c, %.o, $(SRCS_C))

this ensures we have fallback too

@vipinpv85
Copy link
Author

makefile: support built with new version of dpdk

current makefile uses statically linked path for both CFLAGS and LDFLAGS.
Using `pkg-config` one can allow
 - custom path by updating PKG_CONFIG_PATH
 - supported from DPDK 19.11 LTS and higher

The fallback is to default (old) build CFLAGS and LDFLAGS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant