build: Explicitly use gmake 16/40216/3
authorTom Jones <thj@freebsd.org>
Thu, 18 Jan 2024 10:48:17 +0000 (10:48 +0000)
committerDamjan Marion <dmarion@0xa5.net>
Sun, 21 Jan 2024 14:42:03 +0000 (14:42 +0000)
VPP requires GNU Make to build, on GNU systems (such as Debian), GNU
Make is installed as 'make', typically with a symlink from 'gmake'.

On other systems (such as FreeBSD), 'make' is a BSD Make derriviative
and GNU Make is installed a 'gmake'.

Use $(MAKE) variable for make calls from within Makefiles.  This
variable is set to the path of the calling make program, i.e.,
/usr/local/bin/gmake on a bsd system.

This is the recommended way to call make from Makefiles in the GNU Make
documentation.

Type: improvement
Change-Id: Id9162a34a0f8358f22090718087918dae31c0fce
Signed-off-by: Tom Jones <thj@freebsd.org>
Makefile
build-data/packages/external.mk
build-root/Makefile
build/external/Makefile
test/Makefile

index d82a625..17d6335 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -298,7 +298,7 @@ help:
 
 $(BR)/.deps.ok:
 ifeq ($(findstring y,$(UNATTENDED)),y)
-       make install-dep
+       $(MAKE) install-dep
 endif
 ifeq ($(filter ubuntu debian linuxmint,$(OS_ID)),$(OS_ID))
        @MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \
@@ -371,7 +371,7 @@ endif
 install-deps: install-dep
 
 define make
-       @make -C $(BR) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
+       @$(MAKE) -C $(BR) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
 endef
 
 $(BR)/scripts/.version:
@@ -436,9 +436,9 @@ rebuild-release: wipe-release build-release
 export TEST_DIR ?= $(WS_ROOT)/test
 
 define test
-       $(if $(filter-out $(2),retest),make -C $(BR) PLATFORM=vpp TAG=$(1) CC=$(CC) vpp-install,)
+       $(if $(filter-out $(2),retest),$(MAKE) -C $(BR) PLATFORM=vpp TAG=$(1) CC=$(CC) vpp-install,)
        $(eval libs:=lib lib64)
-       make -C test \
+       $(MAKE) -C test \
          VPP_BUILD_DIR=$(BR)/build-$(1)-native/vpp \
          VPP_BIN=$(BR)/install-$(1)-native/vpp/bin/vpp \
          VPP_INSTALL_PATH=$(BR)/install-$(1)-native/ \
@@ -511,15 +511,15 @@ papi-wipe: test-wipe-papi
 
 .PHONY: test-wipe-papi
 test-wipe-papi:
-       @make -C test wipe-papi
+       @$(MAKE) -C test wipe-papi
 
 .PHONY: test-help
 test-help:
-       @make -C test help
+       @$(MAKE) -C test help
 
 .PHONY: test-wipe
 test-wipe:
-       @make -C test wipe
+       @$(MAKE) -C test wipe
 
 .PHONY: test-shell
 test-shell:
@@ -552,27 +552,27 @@ test-wipe-doc:
 .PHONY: test-wipe-cov
 test-wipe-cov:
        $(call make,$(PLATFORM)_gcov,$(addsuffix -wipe,$(TARGETS)))
-       @make -C test wipe-cov
+       @$(MAKE) -C test wipe-cov
 
 .PHONY: test-wipe-all
 test-wipe-all:
-       @make -C test wipe-all
+       @$(MAKE) -C test wipe-all
 
 # Note: All python venv consolidated in test/Makefile, test/requirements*.txt
 .PHONY: test-checkstyle
 test-checkstyle:
        $(warning test-checkstyle is deprecated. Running checkstyle-python.")
-       @make -C test checkstyle-python-all
+       @$(MAKE) -C test checkstyle-python-all
 
 # Note: All python venv consolidated in test/Makefile, test/requirements*.txt
 .PHONY: test-checkstyle-diff
 test-checkstyle-diff:
        $(warning test-checkstyle-diff is deprecated. Running checkstyle-python.")
-       @make -C test checkstyle-python-all
+       @$(MAKE) -C test checkstyle-python-all
 
 .PHONY: test-refresh-deps
 test-refresh-deps:
-       @make -C test refresh-deps
+       @$(MAKE) -C test refresh-deps
 
 .PHONY: retest
 retest:
@@ -634,7 +634,7 @@ debug:
 .PHONY: build-coverity
 build-coverity:
        $(call make,$(PLATFORM)_coverity,install-packages)
-       @make -C build-root PLATFORM=vpp TAG=vpp_coverity libmemif-install
+       @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp_coverity libmemif-install
 
 .PHONY: debug-release
 debug-release:
@@ -672,15 +672,15 @@ pkg-deb-debug:
 
 .PHONY: pkg-rpm
 pkg-rpm: dist
-       make -C extras/rpm
+       $(MAKE) -C extras/rpm
 
 .PHONY: pkg-srpm
 pkg-srpm: dist
-       make -C extras/rpm srpm
+       $(MAKE) -C extras/rpm srpm
 
 .PHONY: install-ext-deps
 install-ext-deps:
-       make -C build/external install-$(PKG)
+       $(MAKE) -C build/external install-$(PKG)
 
 .PHONY: install-ext-dep
 install-ext-dep: install-ext-deps
@@ -727,12 +727,12 @@ checkstyle-commit:
 .PHONY: checkstyle-test
 checkstyle-test:
        $(warning test-checkstyle is deprecated. Running checkstyle-python.")
-       @make -C test checkstyle-python-all
+       @$(MAKE) -C test checkstyle-python-all
 
 # Note: All python venv consolidated in test/Makefile, test/requirements*.txt
 .PHONY: checkstyle-python
 checkstyle-python:
-       @make -C test checkstyle-python-all
+       @$(MAKE) -C test checkstyle-python-all
 
 .PHONY: checkstyle-all
 checkstyle-all: checkstyle-commit checkstyle checkstyle-python docs-spell
@@ -744,7 +744,7 @@ fixstyle:
 # Note: All python venv consolidated in test/Makefile, test/requirements*.txt
 .PHONY: fixstyle-python
 fixstyle-python:
-       @make -C test fixstyle-python-all
+       @$(MAKE) -C test fixstyle-python-all
 
 .PHONY: checkstyle-api
 checkstyle-api:
@@ -788,22 +788,22 @@ wipe-doxygen:
 
 .PHONY: docs-%
 docs-%:
-       @make -C $(WS_ROOT)/docs $*
+       @$(MAKE) -C $(WS_ROOT)/docs $*
 
 .PHONY: docs
 docs:
-       @make -C $(WS_ROOT)/docs docs
+       @$(MAKE) -C $(WS_ROOT)/docs docs
 
 .PHONY: pkg-verify
 pkg-verify: install-dep $(BR)/.deps.ok install-ext-deps
        $(call banner,"Building for PLATFORM=vpp")
-       @make -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages
+       @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp wipe-all install-packages
        $(call banner,"Building sample-plugin")
-       @make -C build-root PLATFORM=vpp TAG=vpp sample-plugin-install
+       @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp sample-plugin-install
        $(call banner,"Building libmemif")
-       @make -C build-root PLATFORM=vpp TAG=vpp libmemif-install
+       @$(MAKE) -C build-root PLATFORM=vpp TAG=vpp libmemif-install
        $(call banner,"Building $(PKG) packages")
-       @make pkg-$(PKG)
+       @$(MAKE) pkg-$(PKG)
 
 # Note: 'make verify' target is not used by ci-management scripts
 MAKE_VERIFY_GATE_OS ?= ubuntu-22.04
@@ -813,11 +813,11 @@ ifeq ($(OS_ID)-$(OS_VERSION_ID),$(MAKE_VERIFY_GATE_OS))
        $(call banner,"Testing vppapigen")
        @src/tools/vppapigen/test_vppapigen.py
        $(call banner,"Running tests")
-       @make COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test
+       @$(MAKE) COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test
 else
        $(call banner,"Skipping tests. Tests under 'make verify' supported on $(MAKE_VERIFY_GATE_OS)")
 endif
 
 .PHONY: check-dpdk-mlx
 check-dpdk-mlx:
-       @[ $$(make -sC build/external dpdk-show-DPDK_MLX_DEFAULT) = y ]
+       @[ $$($(MAKE) -sC build/external dpdk-show-DPDK_MLX_DEFAULT) = y ]
index db31add..7aa5476 100644 (file)
@@ -42,4 +42,4 @@ external_configure = echo
 
 external_build = echo
 
-external_install =  make $(DPDK_MAKE_ARGS) -C external ebuild-build ebuild-install
+external_install =  $(MAKE) $(DPDK_MAKE_ARGS) -C external ebuild-build ebuild-install
index 6416de2..68d295e 100644 (file)
@@ -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
@@ -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:
@@ -968,7 +968,7 @@ $(PLATFORM_IMAGE_DIR)/ro.img ro-image: $(patsubst %,%-find-source,$(ROOT_PACKAGE
            $(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 ;                     \
index a445d7b..af2512c 100644 (file)
@@ -15,7 +15,6 @@
 SHELL := $(shell which bash)
 
 DL_CACHE_DIR = $(HOME)/Downloads
-MAKE ?= make
 MAKE_ARGS ?= -j
 BUILD_DIR        ?= $(CURDIR)/_build
 INSTALL_DIR      ?= $(CURDIR)/_install
@@ -159,17 +158,17 @@ ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)
        @echo "development package by invoking 'make install-ext-deps'"
        @echo "from the top level directory"
        @echo "=========================================================="
-       make config
+       $(MAKE) config
 else
 ifneq ($(INSTALLED_VER),)
        make check-deb
 endif
 ifneq ($(INSTALLED_RPM_VER),)
-       make check-rpm
+       $(MAKE) check-rpm
 endif
 endif
 
 ebuild-install:
 ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)
-       make install
+       $(MAKE) install
 endif
index 7ea83ac..af503dc 100644 (file)
@@ -107,7 +107,7 @@ $(PIP_TOOLS_INSTALL_DONE):
 
 $(PYTHON_DEPENDS): requirements.txt
        @bash -c "source $(VENV_PATH)/bin/activate && \
-                 CUSTOM_COMPILE_COMMAND='make test-refresh-deps (or update requirements.txt)' \
+                 CUSTOM_COMPILE_COMMAND='$(MAKE) test-refresh-deps (or update requirements.txt)' \
                  python3 -m piptools compile -q --generate-hashes requirements.txt --output-file $@"
 
 $(PIP_INSTALL_DONE): $(PIP_TOOLS_INSTALL_DONE) $(PYTHON_DEPENDS)
@@ -379,7 +379,7 @@ cov-post: wipe-cov $(BUILD_COV_DIR)
 
 .PHONY: cov
 cov:
-       make -C . cov-prep test cov-post
+       $(MAKE) -C . cov-prep test cov-post
 
 .PHONY: wipe-cov
 wipe-cov: wipe