refactor test framework
[vpp.git] / build-root / Makefile
index aa50255..6e26e90 100644 (file)
@@ -220,6 +220,11 @@ else
 endif
 export MARCH
 
+MTUNE = $(strip $($(PLATFORM)_mtune))
+ifeq ($(MTUNE),)
+  MTUNE = generic
+endif
+
 ######################################################################
 # Generic build stuff
 ######################################################################
@@ -237,28 +242,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)
@@ -318,10 +305,15 @@ BUILD_DEBUG =
 # Message from build system itself (as opposed to make or shell commands)
 build_msg_fn = echo "@@@@ $(1) @@@@"
 
+# Allow CCACHE_DIR to be overridden, e.g. in .../build-root/build-config.mk
+ifeq ($(CCACHE_DIR),)
+  CCACHE_DIR=$(MU_BUILD_ROOT_DIR)/.ccache
+endif
+
 # Always prefer our own tools to those installed on system.
 # Note: ccache-bin must be before tool bin.
 BUILD_ENV =                                                                            \
-    export CCACHE_DIR=$(MU_BUILD_ROOT_DIR)/.ccache ;                                   \
+    export CCACHE_DIR=$(CCACHE_DIR) ;                                  \
     export PATH=$(TOOL_INSTALL_DIR)/ccache-bin:$(TOOL_INSTALL_DIR)/bin:$${PATH} ;      \
     export PATH="`echo $${PATH} | sed -e s/[.]://`" ;                                  \
     $(if $(not_native),export CONFIG_SITE=$(MU_BUILD_ROOT_DIR)/config.site ;,) \
@@ -665,7 +657,7 @@ linux_n_cpus = `grep '^processor' /proc/cpuinfo | wc -l`
 MAKE_PARALLEL_JOBS =                           \
   -j $(shell                                   \
     if [ -f /proc/cpuinfo ] ; then             \
-      expr 4 '*' $(linux_n_cpus) ;             \
+      expr 2 '*' $(linux_n_cpus) ;             \
     else                                       \
       echo 1 ;                                 \
     fi)
@@ -1170,8 +1162,10 @@ distclean:
        rm -rf $(MU_BUILD_ROOT_DIR)/$(IMAGES_PREFIX)*
        rm -rf $(TOOL_INSTALL_DIR)
        rm -rf $(MU_BUILD_ROOT_DIR)/*.deb
+       rm -rf $(MU_BUILD_ROOT_DIR)/*.rpm
        rm -rf $(MU_BUILD_ROOT_DIR)/*.changes
-       (cd $(MU_BUILD_ROOT_DIR)/deb/;debian/rules clean)
+       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