ACL-plugin: fix coverity issue
[vpp.git] / build-root / Makefile
index a7d8943..81f7b90 100644 (file)
@@ -165,6 +165,7 @@ BASIC_ARCH = \
 # x86_64 can be either 32/64.  set BIACH=32 to get 32 bit libraries.
 BIARCH = 64
 
+aarch64_libdir = 64
 x86_64_libdir = $(BIARCH)
 native_libdir = $($(NATIVE_ARCH)_libdir)
 
@@ -220,6 +221,11 @@ else
 endif
 export MARCH
 
+MTUNE = $(strip $($(PLATFORM)_mtune))
+ifeq ($(MTUNE),)
+  MTUNE = generic
+endif
+
 ######################################################################
 # Generic build stuff
 ######################################################################
@@ -237,28 +243,10 @@ TAG_PREFIX = $(if $(TAG),$(TAG)-)
 tag_var_with_added_space_fn = $(if $($(TAG)_TAG_$(1)),$($(TAG)_TAG_$(1)) )
 
 # TAG=debug for debugging
-debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH)
-debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH)
-
-# TAG=prof for profiling
-prof_TAG_CFLAGS = -g -pg -O2
-prof_TAG_LDFLAGS = -g -pg -O2
-
-# TAG=o0
-o0_TAG_CFLAGS = -g -O0
-o1_TAG_LDFLAGS = -g -O0
-
-# TAG=o1
-o1_TAG_CFLAGS = -g -O1
-o1_TAG_LDFLAGS = -g -O1
-
-# TAG=o2
-o2_TAG_CFLAGS = -g -O2
-o2_TAG_LDFLAGS = -g -O2
-
-# TAG=o3
-o3_TAG_CFLAGS = -g -O3
-o3_TAG_LDFLAGS = -g -O3
+debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
+                  -fstack-protector-all -fPIC
+debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
+                  -fstack-protector-all -fPIC
 
 BUILD_PREFIX_package = build-$(TAG_PREFIX)
 BUILD_PREFIX_tool = build-tool-$(TAG_PREFIX)
@@ -592,7 +580,7 @@ image_extra_dependencies = $($(PLATFORM)_image_extra_dependencies)
 ### dbarach
 
 configure_package_gnu =                                                \
-  s=$(call find_source_fn,$(PACKAGE_SOURCE)) ;                 \
+  s=$(call find_source_fn,$(PACKAGE_SOURCE))$(PACKAGE_SUBDIR) ;        \
   if [ ! -f $$s/configure ] ; then                             \
     autoreconf -i -f $$s ;                                     \
   fi ;                                                         \
@@ -648,7 +636,8 @@ configure_check_timestamp =                                         \
   mkdir -p $(PACKAGE_INSTALL_DIR) ;                                    \
   conf="$(TIMESTAMP_DIR)/$(CONFIGURE_TIMESTAMP)" ;                     \
   dirs="$(call package_mk_fn,$(PACKAGE))                               \
-       $(wildcard $(call find_source_fn,$(PACKAGE_SOURCE))/configure)  \
+       $(wildcard $(call find_source_fn,                               \
+                    $(PACKAGE_SOURCE))$(PACKAGE_SUBDIR)/configure)     \
        $(MU_BUILD_ROOT_DIR)/config.site" ;                             \
   if [[ $(call find_newer_fn, $${conf}, $${dirs}, $?) ]]; then         \
     $(configure_package) ;                                             \
@@ -665,16 +654,13 @@ configure_check_timestamp =                                               \
 # Package build
 ######################################################################
 
-linux_n_cpus = `grep '^processor' /proc/cpuinfo | wc -l`
-
-MAKE_PARALLEL_JOBS =                           \
-  -j $(shell                                   \
-    if [ -f /proc/cpuinfo ] ; then             \
-      expr 2 '*' $(linux_n_cpus) ;             \
-    else                                       \
-      echo 1 ;                                 \
-    fi)
-
+# /proc/cpuinfo does not exist on platforms without a /proc and on some
+# platforms, notably inside containers, it has no content. In those cases
+# we assume there's 1 processor; we use 2*ncpu for the -j option.
+# NB: GNU Make 4.2 will let us use '$(file </proc/cpuinfo)' to both test
+# for file presence and content; for now this will have to do.
+MAKE_PARALLEL_JOBS = -j $(if $(shell [ -f /proc/cpuinfo ] && head /proc/cpuinfo), \
+       $(shell expr 2 '*' $$(grep -c ^processor /proc/cpuinfo)), 2)
 MAKE_PARALLEL_FLAGS = $(if $($(PACKAGE)_make_parallel_fails),,$(MAKE_PARALLEL_JOBS))
 
 # Make command shorthand for packages & tools.
@@ -760,6 +746,7 @@ GIT = git
 # Multiple packages may use a single source tree.
 # For example, gcc-bootstrap package shares gcc source.
 PACKAGE_SOURCE = $(if $($(PACKAGE)_source),$($(PACKAGE)_source),$(PACKAGE))
+PACKAGE_SUBDIR = $(if $($(PACKAGE)_configure_subdir),/$($(PACKAGE)_configure_subdir),)
 
 # Use git to download source if directory is not found
 find_source_for_package =                                                                      \
@@ -1177,7 +1164,7 @@ distclean:
        rm -rf $(MU_BUILD_ROOT_DIR)/*.deb
        rm -rf $(MU_BUILD_ROOT_DIR)/*.rpm
        rm -rf $(MU_BUILD_ROOT_DIR)/*.changes
+       rm -rf $(MU_BUILD_ROOT_DIR)/python
        if [ -e /usr/bin/dh ];then (cd $(MU_BUILD_ROOT_DIR)/deb/;debian/rules clean); fi
        rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.install
-       rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/*.dkms
        rm -f $(MU_BUILD_ROOT_DIR)/deb/debian/changelog