From ba3c77364cc8b7dfb136e955458177e1a9a14c98 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Fri, 10 Nov 2017 20:26:50 +0100 Subject: Handle CPU flags from autotools project Change-Id: Id085c1e3cbc7bf03df02755f9e35896cdb57e9e3 Signed-off-by: Damjan Marion --- src/Makefile.am | 2 +- src/configure.ac | 11 +++++++++++ src/plugins/Makefile.am | 2 +- src/vpp-api/java/Makefile.am | 2 +- src/vpp-api/vapi/Makefile.am | 2 +- 5 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 6f146fea4a7..04b6c5c5d6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,7 +19,7 @@ AUTOMAKE_OPTIONS = foreign subdir-objects ACLOCAL_AMFLAGS = -I m4 AM_LIBTOOLFLAGS = --quiet -AM_CFLAGS = -Wall +AM_CFLAGS = @CPU_FLAGS@ -Wall AM_CXXFLAGS = -Wall -std=gnu++11 SUBDIRS = . diff --git a/src/configure.ac b/src/configure.ac index 8b79cff224f..ee4985b5471 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -160,6 +160,17 @@ AC_ARG_WITH(pre-data, *) with_pre_data="pre-data-not-set" ;; esac], [with_pre_data=128]) +############################################################################### +# Target CPU flags +############################################################################### + +AS_CASE([$build_cpu], + [x86_64], [CPU_FLAGS="-march=corei7 -mtune=corei7-avx"], + [aarch64], [CPU_FLAGS="-march=armv8-a+crc"], + [CPU_FLAGS=""], +) +AC_SUBST([CPU_FLAGS]) + ############################################################################### # Substitutions and defines ############################################################################### diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index bd77c45f631..97f2f88f821 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -14,7 +14,7 @@ AUTOMAKE_OPTIONS = foreign subdir-objects -AM_CFLAGS = -Wall -I${top_srcdir} -I${top_builddir} +AM_CFLAGS = @CPU_FLAGS@ -Wall -I${top_srcdir} -I${top_builddir} AM_LDFLAGS = -module -shared -avoid-version AM_LIBTOOLFLAGS = --quiet SUFFIXES = .api.h .api .api.json diff --git a/src/vpp-api/java/Makefile.am b/src/vpp-api/java/Makefile.am index 637bb774f6e..1ce6dffd0b6 100644 --- a/src/vpp-api/java/Makefile.am +++ b/src/vpp-api/java/Makefile.am @@ -15,7 +15,7 @@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 AM_LIBTOOLFLAGS = --quiet -AM_CFLAGS = -Wall -I${top_srcdir} -I${top_builddir} \ +AM_CFLAGS = @CPU_FLAGS@ -Wall -I${top_srcdir} -I${top_builddir} \ -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \ -I@top_srcdir@/plugins -I@top_builddir@/plugins diff --git a/src/vpp-api/vapi/Makefile.am b/src/vpp-api/vapi/Makefile.am index 74b2b47e8e4..07ef46ef296 100644 --- a/src/vpp-api/vapi/Makefile.am +++ b/src/vpp-api/vapi/Makefile.am @@ -15,7 +15,7 @@ AUTOMAKE_OPTIONS = foreign ACLOCAL_AMFLAGS = -I m4 AM_LIBTOOLFLAGS = --quiet -AM_CFLAGS = -Wall -I${top_srcdir} -I${top_builddir} -I. -I$(top_srcdir)/vpp-api/ +AM_CFLAGS = @CPU_FLAGS@ -Wall -I${top_srcdir} -I${top_builddir} -I. -I$(top_srcdir)/vpp-api/ AM_LDFLAGS = -shared -avoid-version -rpath /none -no-undefined -- cgit 1.2.3-korg