diff options
author | Matias Elo <matias.elo@nokia.com> | 2018-01-25 13:52:22 +0200 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2018-01-30 12:17:18 +0200 |
commit | 46c26b39b7bc23a420f02d5a486f573c7a1e150a (patch) | |
tree | cbc358ceeccf3f500b837d63452fbd937ea1601f | |
parent | 0dc1b8642436481a2c8d8808902ded2f2da09b04 (diff) |
Port 89b7caa "linux-gen: stop poisoning CPPFLAGS/LDFLAGS with DPDK flags"
Signed-off-by: Matias Elo <matias.elo@nokia.com>
-rw-r--r-- | helper/test/Makefile.am | 2 | ||||
-rw-r--r-- | pkgconfig/libodp-dpdk.pc.in | 2 | ||||
-rw-r--r-- | platform/linux-dpdk/Makefile.am | 15 | ||||
-rw-r--r-- | platform/linux-dpdk/Makefile.inc | 1 | ||||
-rw-r--r-- | platform/linux-dpdk/m4/configure.m4 | 43 | ||||
-rw-r--r-- | test/linux-dpdk/Makefile.inc | 2 |
6 files changed, 27 insertions, 38 deletions
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index 1cff7afb0..4866e093b 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -5,7 +5,7 @@ LIB = $(top_builddir)/lib #in the following line, the libs using the symbols should come before #the libs containing them! The includer is given a chance to add things #before libodp by setting PRE_LDADD before the inclusion. -LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp-dpdk.la +LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp-dpdk.la $(DPDK_PMDS) INCFLAGS = \ -I$(top_builddir)/platform/@with_platform@/include \ diff --git a/pkgconfig/libodp-dpdk.pc.in b/pkgconfig/libodp-dpdk.pc.in index 2b9c5e216..6ce052c75 100644 --- a/pkgconfig/libodp-dpdk.pc.in +++ b/pkgconfig/libodp-dpdk.pc.in @@ -8,4 +8,4 @@ Description: The ODP packet processing engine Version: @PKGCONFIG_VERSION@ Libs: -L${libdir} -lodp-dpdk @DPDK_LIBS@ Libs.private: @OPENSSL_STATIC_LIBS@ @DPDK_PMDS@ @DPDK_LIBS@ @PTHREAD_LIBS@ @TIMER_LIBS@ -lpthread @ATOMIC_LIBS@ -Cflags: -I${includedir} +Cflags: -I${includedir} @DPDK_CPPFLAGS@ diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index 91ac90db5..e332e6b44 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -1,18 +1,7 @@ include $(top_srcdir)/platform/Makefile.inc include $(top_srcdir)/platform/@with_platform@/Makefile.inc -PLAT_CFLAGS = -if ARCH_X86 -PLAT_CFLAGS += -msse4.2 -endif - -if DPDK_DEFAULT_DIR -PLAT_CFLAGS += -include /usr/include/dpdk/rte_config.h -else -PLAT_CFLAGS += -include $(SDK_INSTALL_PATH)/include/rte_config.h -endif - -AM_CFLAGS += $(PLAT_CFLAGS) +AM_CFLAGS += $(DPDK_CFLAGS) AM_CFLAGS += -I$(srcdir)/include AM_CFLAGS += -I$(top_srcdir)/platform/linux-generic/include AM_CFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ @@ -21,6 +10,7 @@ AM_CFLAGS += -I$(top_builddir)/include AM_CFLAGS += -Iinclude AM_CPPFLAGS += $(OPENSSL_CPPFLAGS) +AM_CPPFLAGS += $(DPDK_CPPFLAGS) include_HEADERS = \ $(top_srcdir)/include/odp.h \ @@ -246,6 +236,7 @@ endif __LIB__libodp_dpdk_la_LIBADD = $(ATOMIC_LIBS) __LIB__libodp_dpdk_la_LIBADD += $(OPENSSL_LIBS) +__LIB__libodp_dpdk_la_LIBADD += $(DPDK_LIBS) $(DPDK_PMDS) __LIB__libodp_dpdk_la_LIBADD += $(PTHREAD_LIBS) __LIB__libodp_dpdk_la_LIBADD += $(TIMER_LIBS) diff --git a/platform/linux-dpdk/Makefile.inc b/platform/linux-dpdk/Makefile.inc index d26b2cc82..b20132b15 100644 --- a/platform/linux-dpdk/Makefile.inc +++ b/platform/linux-dpdk/Makefile.inc @@ -1,4 +1,5 @@ AM_CFLAGS += -I$(top_srcdir)/platform/$(with_platform)/arch/$(ARCH_DIR) AM_CXXFLAGS += -I$(top_srcdir)/platform/$(with_platform)/arch/$(ARCH_DIR) +AM_CPPFLAGS += $(DPDK_CPPFLAGS) AM_LDFLAGS += -R$(SDK_INSTALL_PATH)/lib LOG_COMPILER = $(top_srcdir)/test/linux-dpdk/wrapper-script.sh diff --git a/platform/linux-dpdk/m4/configure.m4 b/platform/linux-dpdk/m4/configure.m4 index 25e5c62f4..c61dae4b5 100644 --- a/platform/linux-dpdk/m4/configure.m4 +++ b/platform/linux-dpdk/m4/configure.m4 @@ -86,13 +86,14 @@ m4_include([platform/linux-dpdk/m4/odp_schedule.m4]) # DPDK build variables ########################################################################## DPDK_DRIVER_DIR=/usr/lib/$(uname -m)-linux-gnu -AS_CASE($host_cpu, [x86_64], [AM_CPPFLAGS="$AM_CPPFLAGS -msse4.2"]) +AS_CASE($host_cpu, [x86_64], [DPDK_CPPFLAGS="-msse4.2"]) if test ${DPDK_DEFAULT_DIR} = 1; then - AM_CPPFLAGS="$AM_CPPFLAGS -I/usr/include/dpdk" + DPDK_CFLAGS="-include /usr/include/dpdk/rte_config.h" + DPDK_CPPFLAGS="$DPDK_CPPFLAGS -I/usr/include/dpdk" else DPDK_DRIVER_DIR=$SDK_INSTALL_PATH/lib - AM_CPPFLAGS="$AM_CPPFLAGS -I$SDK_INSTALL_PATH/include" - AM_LDFLAGS="$AM_LDFLAGS -L$SDK_INSTALL_PATH/lib" + DPDK_CFLAGS="-include $SDK_INSTALL_PATH/include/rte_config.h" + DPDK_CPPFLAGS="$DPDK_CPPFLAGS -I$SDK_INSTALL_PATH/include" fi # Check if we should link against the static or dynamic DPDK library @@ -106,10 +107,8 @@ AM_CONDITIONAL([SHARED_DPDK], [test x$shared_dpdk = xtrue]) ########################################################################## # Save and set temporary compilation flags ########################################################################## -OLD_LDFLAGS=$LDFLAGS -OLD_CPPFLAGS=$CPPFLAGS -LDFLAGS="$AM_LDFLAGS $LDFLAGS" -CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS" +OLD_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$DPDK_CPPFLAGS $CPPFLAGS" ########################################################################## # Check for DPDK availability @@ -117,38 +116,36 @@ CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS" AC_CHECK_HEADERS([rte_config.h], [], [AC_MSG_FAILURE(["can't find DPDK headers"])]) -AC_SEARCH_LIBS([rte_eal_init], [dpdk], [], - [AC_MSG_ERROR([DPDK libraries required])], [-ldl]) - ########################################################################## # In case of static linking DPDK pmd drivers are not linked unless the # --whole-archive option is used. No spaces are allowed between the # --whole-arhive flags. ########################################################################## if test "x$shared_dpdk" = "xtrue"; then - LIBS="$LIBS -Wl,--no-as-needed,-ldpdk,-as-needed -ldl -lm -lpcap" + DPDK_LIBS="-Wl,--no-as-needed,-ldpdk,-as-needed -ldl -lm -lpcap" else - DPDK_PMD=--whole-archive, - for filename in $DPDK_DRIVER_DIR/*.a; do - cur_driver=`echo $(basename "$filename" .a) | \ - sed -n 's/^\(librte_pmd_\)/-lrte_pmd_/p' | sed -n 's/$/,/p'` + AS_VAR_SET([DPDK_PMDS], [-Wl,--whole-archive,]) + for filename in "$DPDK_DRIVER_DIR"/librte_pmd_*.a; do + cur_driver=`basename "$filename" .a | sed -e 's/^lib//'` # rte_pmd_nfp has external dependencies which break linking - if test "$cur_driver" = "-lrte_pmd_nfp,"; then + if test "$cur_driver" = "rte_pmd_nfp"; then echo "skip linking rte_pmd_nfp" else - DPDK_PMD+=$cur_driver + AS_VAR_APPEND([DPDK_PMDS], [-l$cur_driver,]) fi done - DPDK_PMD+=--no-whole-archive - - LIBS="$LIBS -ldpdk -ldl -lm -lpcap" - AM_LDFLAGS="$AM_LDFLAGS -Wl,$DPDK_PMD" + AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive]) + DPDK_LIBS="-L$DPDK_DRIVER_DIR/ -ldpdk -lpthread -ldl -lm -lpcap" fi +AC_SUBST([DPDK_CFLAGS]) +AC_SUBST([DPDK_CPPFLAGS]) +AC_SUBST([DPDK_LIBS]) +AC_SUBST([DPDK_PMDS]) + ########################################################################## # Restore old saved variables ########################################################################## -LDFLAGS=$OLD_LDFLAGS CPPFLAGS=$OLD_CPPFLAGS AC_CONFIG_FILES([platform/linux-dpdk/Makefile diff --git a/test/linux-dpdk/Makefile.inc b/test/linux-dpdk/Makefile.inc index 25493d86d..baf6dadca 100644 --- a/test/linux-dpdk/Makefile.inc +++ b/test/linux-dpdk/Makefile.inc @@ -8,7 +8,7 @@ AM_CPPFLAGS += $(CUNIT_CPPFLAGS) LIBCUNIT_COMMON = $(top_builddir)/test/common_plat/common/libcunit_common.la LIB = $(top_builddir)/lib -LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-dpdk.la +LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-dpdk.la $(DPDK_PMDS) INCCUNIT_COMMON = -I$(top_srcdir)/test/common_plat/common INCODP = -I$(top_builddir)/platform/@with_platform@/include \ |