summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-11-10 20:26:50 +0100
committerFlorin Coras <florin.coras@gmail.com>2017-11-11 00:18:25 +0000
commitba3c77364cc8b7dfb136e955458177e1a9a14c98 (patch)
tree8fa0a15956f5d4753f93184469fd5bc81231c047
parent60caa064e5109f21a9ccc170cb3f90ff1f82ecde (diff)
Handle CPU flags from autotools project
Change-Id: Id085c1e3cbc7bf03df02755f9e35896cdb57e9e3 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--build-data/platforms/vpp.mk44
-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
6 files changed, 28 insertions, 35 deletions
diff --git a/build-data/platforms/vpp.mk b/build-data/platforms/vpp.mk
index f764a1f9ae5..9f01a656e0b 100644
--- a/build-data/platforms/vpp.mk
+++ b/build-data/platforms/vpp.mk
@@ -16,18 +16,8 @@
MACHINE=$(shell uname -m)
vpp_arch = native
-ifeq ($(MACHINE),$(filter $(MACHINE),x86_64 i686))
-vpp_march = corei7 # Nehalem Instruction set
-vpp_mtune = corei7-avx # Optimize for Sandy Bridge
-else ifeq ($(MACHINE),aarch64)
ifeq ($(TARGET_PLATFORM),thunderx)
-vpp_march = armv8-a+crc
-vpp_mtune = thunderx
vpp_dpdk_target = arm64-thunderx-linuxapp-gcc
-else
-vpp_march = native
-vpp_mtune = generic
-endif
endif
vpp_native_tools = vppapigen
@@ -56,28 +46,20 @@ endif
# uncomment the following...
# vpp_configure_args_vpp += --disable-vom
-vpp_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
+vpp_debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 \
-fstack-protector-all -fPIC -Werror
-vpp_debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
+vpp_debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 \
-fstack-protector-all -fPIC -Werror
-vpp_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -march=$(MARCH) -mtune=$(MTUNE) \
- -fstack-protector -fPIC -Werror
-vpp_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -march=$(MARCH) -mtune=$(MTUNE) \
- -fstack-protector -fPIC -Werror
-
-vpp_clang_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -march=$(MARCH) -mtune=$(MTUNE) \
- -fstack-protector -fPIC -Werror
-vpp_clang_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -march=$(MARCH) -mtune=$(MTUNE) \
- -fstack-protector -fPIC -Werror
-
-vpp_gcov_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH) \
- -fPIC -Werror -fprofile-arcs -ftest-coverage
-vpp_gcov_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH) \
- -fPIC -Werror -coverage
-
-vpp_coverity_TAG_CFLAGS = -g -O2 -march=$(MARCH) -mtune=$(MTUNE) \
- -fPIC -Werror -D__COVERITY__
-vpp_coverity_TAG_LDFLAGS = -g -O2 -march=$(MARCH) -mtune=$(MTUNE) \
- -fPIC -Werror -D__COVERITY__
+vpp_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror
+vpp_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror
+
+vpp_clang_TAG_CFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror
+vpp_clang_TAG_LDFLAGS = -g -O2 -DFORTIFY_SOURCE=2 -fstack-protector -fPIC -Werror
+
+vpp_gcov_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -fPIC -Werror -fprofile-arcs -ftest-coverage
+vpp_gcov_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -fPIC -Werror -coverage
+
+vpp_coverity_TAG_CFLAGS = -g -O2 -fPIC -Werror -D__COVERITY__
+vpp_coverity_TAG_LDFLAGS = -g -O2 -fPIC -Werror -D__COVERITY__
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