build: Explicitly use gmake
[vpp.git] / build-root / Makefile
index e5db8b8..68d295e 100644 (file)
@@ -39,7 +39,7 @@
 ######################################################################
 
 # Scripts require non-POSIX parts of bash
-SHELL := /bin/bash
+SHELL := $(shell which bash)
 
 # Where this makefile lives
 MU_BUILD_ROOT_DIR = $(shell pwd)
@@ -243,11 +243,11 @@ 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 -DFORTIFY_SOURCE=2 -march=$(MARCH) \
+debug_TAG_CFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH) \
                   -fstack-protector-all -fPIC
-debug_TAG_CXXFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
+debug_TAG_CXXFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH) \
                   -fstack-protector-all -fPIC
-debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -DFORTIFY_SOURCE=2 -march=$(MARCH) \
+debug_TAG_LDFLAGS = -g -O0 -DCLIB_DEBUG -march=$(MARCH) \
                   -fstack-protector-all -fPIC
 
 BUILD_PREFIX_package = build-$(TAG_PREFIX)
@@ -365,7 +365,7 @@ NATIVE_TOOLS_$(IS_LINUX) += $(NATIVE_TOOLS_LINUX)
 CROSS_TOOLS_$(IS_LINUX) += glibc gcc
 
 # must be first for bootstrapping
-NATIVE_TOOLS = findutils make
+NATIVE_TOOLS = findutils $(MAKE)
 
 # basic tools needed for build system
 NATIVE_TOOLS += git automake autoconf libtool texinfo tar
@@ -416,7 +416,7 @@ find_filter += -and -not -path '*/.mu_build_*'
 find_newer_filtered_fn =                       \
   (! -f $(1)                                   \
     || -n $(call find_newer_files_fn,$(1),$(3))        \
-    || -n "`find -H $(2)                       \
+    || -n "`find -L $(2)                       \
              -type f                           \
               -and -newer $(1)                 \
              -and \( $(4) \)                   \
@@ -614,7 +614,7 @@ check_platform =                                                            \
        -a ! -x "`which 2> /dev/null $${target_gcc}`" ] ; then                  \
     $(call build_msg_fn,                                                       \
           No cross-compiler found for platform $(PLATFORM) target $(TARGET);   \
-            try make PLATFORM=$(PLATFORM) install-tools) ;                     \
+            try $(MAKE) PLATFORM=$(PLATFORM) install-tools) ;                  \
     exit 1 ;                                                                   \
   fi
 
@@ -800,7 +800,7 @@ pull-all:
        $(call build_msg_fn,Git pull build tools) ;                             \
        $(call tool_make_target_fn,pull-all) ;                                  \
        $(call build_msg_fn,Git pull packages for platform $(PLATFORM)) ;       \
-       make PLATFORM=$(PLATFORM) $(patsubst %,%-pull-all,$(ROOT_PACKAGES))
+       $(MAKE) PLATFORM=$(PLATFORM) $(patsubst %,%-pull-all,$(ROOT_PACKAGES))
 
 .PHONY: %-diff
 %-diff:
@@ -962,13 +962,13 @@ $(PLATFORM_IMAGE_DIR)/ro.img ro-image: $(patsubst %,%-find-source,$(ROOT_PACKAGE
        chmod 0755 $${tmp_dir} ;                                        \
        cd $${tmp_dir} ;                                                \
        trap "rm -rf $${tmp_dir}" err ;                                 \
-       fakeroot /bin/bash -c "{                                        \
+       fakeroot $(SHELL) -c "{                                 \
          set -eu$(BUILD_DEBUG) ;                                       \
          $(MAKE) -C $(MU_BUILD_ROOT_DIR) IMAGE_INSTALL_DIR=$${tmp_dir} \
            $(patsubst %,%-image_install,                               \
              basic_system                                              \
              $(ROOT_PACKAGES)) ;                                       \
-         : make dev directory ;                                        \
+         : $(MAKE) dev directory ;                                     \
          $(linuxrc_makedev) ;                                          \
          echo @@@@ Relocating ELF executables to run in / @@@@ ;       \
          scripts/set-rpath /$(arch_lib_dir):/lib ;                     \
@@ -1054,7 +1054,7 @@ rw-image: rw-image-check-type ro-image
        chmod 0755 $${tmp_dir} ;                                \
        cd $${tmp_dir} ;                                        \
        trap "rm -rf $${tmp_dir}" err ;                         \
-       fakeroot /bin/bash -c "{                                \
+       fakeroot $(SHELL) -c "{                         \
          set -eu$(BUILD_DEBUG) ;                               \
          $(linuxrc_makedev) ;                                  \
          $(call rw_image_embed_ro_image_fn,$${ro_image}) ;     \