summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/configure.ac11
-rw-r--r--src/plugins/Makefile.am2
-rw-r--r--src/vpp-api/java/Makefile.am2
-rw-r--r--src/vpp-api/vapi/Makefile.am2
5 files changed, 15 insertions, 4 deletions
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
@@ -161,6 +161,17 @@ AC_ARG_WITH(pre-data,
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