build: Explicitly use gmake

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>
This commit is contained in:
Tom Jones
2024-01-18 10:48:17 +00:00
committed by Damjan Marion
parent 038dad7ef2
commit 0aa0d6ffbe
5 changed files with 37 additions and 38 deletions

View File

@ -298,7 +298,7 @@ help:
$(BR)/.deps.ok: $(BR)/.deps.ok:
ifeq ($(findstring y,$(UNATTENDED)),y) ifeq ($(findstring y,$(UNATTENDED)),y)
make install-dep $(MAKE) install-dep
endif endif
ifeq ($(filter ubuntu debian linuxmint,$(OS_ID)),$(OS_ID)) ifeq ($(filter ubuntu debian linuxmint,$(OS_ID)),$(OS_ID))
@MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \ @MISSING=$$(apt-get install -y -qq -s $(DEB_DEPENDS) | grep "^Inst ") ; \
@ -371,7 +371,7 @@ endif
install-deps: install-dep install-deps: install-dep
define make define make
@make -C $(BR) PLATFORM=$(PLATFORM) TAG=$(1) $(2) @$(MAKE) -C $(BR) PLATFORM=$(PLATFORM) TAG=$(1) $(2)
endef endef
$(BR)/scripts/.version: $(BR)/scripts/.version:
@ -436,9 +436,9 @@ rebuild-release: wipe-release build-release
export TEST_DIR ?= $(WS_ROOT)/test export TEST_DIR ?= $(WS_ROOT)/test
define 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) $(eval libs:=lib lib64)
make -C test \ $(MAKE) -C test \
VPP_BUILD_DIR=$(BR)/build-$(1)-native/vpp \ VPP_BUILD_DIR=$(BR)/build-$(1)-native/vpp \
VPP_BIN=$(BR)/install-$(1)-native/vpp/bin/vpp \ VPP_BIN=$(BR)/install-$(1)-native/vpp/bin/vpp \
VPP_INSTALL_PATH=$(BR)/install-$(1)-native/ \ VPP_INSTALL_PATH=$(BR)/install-$(1)-native/ \
@ -511,15 +511,15 @@ papi-wipe: test-wipe-papi
.PHONY: test-wipe-papi .PHONY: test-wipe-papi
test-wipe-papi: test-wipe-papi:
@make -C test wipe-papi @$(MAKE) -C test wipe-papi
.PHONY: test-help .PHONY: test-help
test-help: test-help:
@make -C test help @$(MAKE) -C test help
.PHONY: test-wipe .PHONY: test-wipe
test-wipe: test-wipe:
@make -C test wipe @$(MAKE) -C test wipe
.PHONY: test-shell .PHONY: test-shell
test-shell: test-shell:
@ -552,27 +552,27 @@ test-wipe-doc:
.PHONY: test-wipe-cov .PHONY: test-wipe-cov
test-wipe-cov: test-wipe-cov:
$(call make,$(PLATFORM)_gcov,$(addsuffix -wipe,$(TARGETS))) $(call make,$(PLATFORM)_gcov,$(addsuffix -wipe,$(TARGETS)))
@make -C test wipe-cov @$(MAKE) -C test wipe-cov
.PHONY: test-wipe-all .PHONY: test-wipe-all
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 # Note: All python venv consolidated in test/Makefile, test/requirements*.txt
.PHONY: test-checkstyle .PHONY: test-checkstyle
test-checkstyle: test-checkstyle:
$(warning test-checkstyle is deprecated. Running checkstyle-python.") $(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 # Note: All python venv consolidated in test/Makefile, test/requirements*.txt
.PHONY: test-checkstyle-diff .PHONY: test-checkstyle-diff
test-checkstyle-diff: test-checkstyle-diff:
$(warning test-checkstyle-diff is deprecated. Running checkstyle-python.") $(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 .PHONY: test-refresh-deps
test-refresh-deps: test-refresh-deps:
@make -C test refresh-deps @$(MAKE) -C test refresh-deps
.PHONY: retest .PHONY: retest
retest: retest:
@ -634,7 +634,7 @@ debug:
.PHONY: build-coverity .PHONY: build-coverity
build-coverity: build-coverity:
$(call make,$(PLATFORM)_coverity,install-packages) $(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 .PHONY: debug-release
debug-release: debug-release:
@ -672,15 +672,15 @@ pkg-deb-debug:
.PHONY: pkg-rpm .PHONY: pkg-rpm
pkg-rpm: dist pkg-rpm: dist
make -C extras/rpm $(MAKE) -C extras/rpm
.PHONY: pkg-srpm .PHONY: pkg-srpm
pkg-srpm: dist pkg-srpm: dist
make -C extras/rpm srpm $(MAKE) -C extras/rpm srpm
.PHONY: install-ext-deps .PHONY: install-ext-deps
install-ext-deps: install-ext-deps:
make -C build/external install-$(PKG) $(MAKE) -C build/external install-$(PKG)
.PHONY: install-ext-dep .PHONY: install-ext-dep
install-ext-dep: install-ext-deps install-ext-dep: install-ext-deps
@ -727,12 +727,12 @@ checkstyle-commit:
.PHONY: checkstyle-test .PHONY: checkstyle-test
checkstyle-test: checkstyle-test:
$(warning test-checkstyle is deprecated. Running checkstyle-python.") $(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 # Note: All python venv consolidated in test/Makefile, test/requirements*.txt
.PHONY: checkstyle-python .PHONY: checkstyle-python
checkstyle-python: checkstyle-python:
@make -C test checkstyle-python-all @$(MAKE) -C test checkstyle-python-all
.PHONY: checkstyle-all .PHONY: checkstyle-all
checkstyle-all: checkstyle-commit checkstyle checkstyle-python docs-spell 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 # Note: All python venv consolidated in test/Makefile, test/requirements*.txt
.PHONY: fixstyle-python .PHONY: fixstyle-python
fixstyle-python: fixstyle-python:
@make -C test fixstyle-python-all @$(MAKE) -C test fixstyle-python-all
.PHONY: checkstyle-api .PHONY: checkstyle-api
checkstyle-api: checkstyle-api:
@ -788,22 +788,22 @@ wipe-doxygen:
.PHONY: docs-% .PHONY: docs-%
docs-%: docs-%:
@make -C $(WS_ROOT)/docs $* @$(MAKE) -C $(WS_ROOT)/docs $*
.PHONY: docs .PHONY: docs
docs: docs:
@make -C $(WS_ROOT)/docs docs @$(MAKE) -C $(WS_ROOT)/docs docs
.PHONY: pkg-verify .PHONY: pkg-verify
pkg-verify: install-dep $(BR)/.deps.ok install-ext-deps pkg-verify: install-dep $(BR)/.deps.ok install-ext-deps
$(call banner,"Building for PLATFORM=vpp") $(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") $(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") $(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") $(call banner,"Building $(PKG) packages")
@make pkg-$(PKG) @$(MAKE) pkg-$(PKG)
# Note: 'make verify' target is not used by ci-management scripts # Note: 'make verify' target is not used by ci-management scripts
MAKE_VERIFY_GATE_OS ?= ubuntu-22.04 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") $(call banner,"Testing vppapigen")
@src/tools/vppapigen/test_vppapigen.py @src/tools/vppapigen/test_vppapigen.py
$(call banner,"Running tests") $(call banner,"Running tests")
@make COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test @$(MAKE) COMPRESS_FAILED_TEST_LOGS=yes RETRIES=3 test
else else
$(call banner,"Skipping tests. Tests under 'make verify' supported on $(MAKE_VERIFY_GATE_OS)") $(call banner,"Skipping tests. Tests under 'make verify' supported on $(MAKE_VERIFY_GATE_OS)")
endif endif
.PHONY: check-dpdk-mlx .PHONY: check-dpdk-mlx
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 ]

View File

@ -42,4 +42,4 @@ external_configure = echo
external_build = 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

View File

@ -365,7 +365,7 @@ NATIVE_TOOLS_$(IS_LINUX) += $(NATIVE_TOOLS_LINUX)
CROSS_TOOLS_$(IS_LINUX) += glibc gcc CROSS_TOOLS_$(IS_LINUX) += glibc gcc
# must be first for bootstrapping # must be first for bootstrapping
NATIVE_TOOLS = findutils make NATIVE_TOOLS = findutils $(MAKE)
# basic tools needed for build system # basic tools needed for build system
NATIVE_TOOLS += git automake autoconf libtool texinfo tar NATIVE_TOOLS += git automake autoconf libtool texinfo tar
@ -614,7 +614,7 @@ check_platform = \
-a ! -x "`which 2> /dev/null $${target_gcc}`" ] ; then \ -a ! -x "`which 2> /dev/null $${target_gcc}`" ] ; then \
$(call build_msg_fn, \ $(call build_msg_fn, \
No cross-compiler found for platform $(PLATFORM) target $(TARGET); \ No cross-compiler found for platform $(PLATFORM) target $(TARGET); \
try make PLATFORM=$(PLATFORM) install-tools) ; \ try $(MAKE) PLATFORM=$(PLATFORM) install-tools) ; \
exit 1 ; \ exit 1 ; \
fi fi
@ -800,7 +800,7 @@ pull-all:
$(call build_msg_fn,Git pull build tools) ; \ $(call build_msg_fn,Git pull build tools) ; \
$(call tool_make_target_fn,pull-all) ; \ $(call tool_make_target_fn,pull-all) ; \
$(call build_msg_fn,Git pull packages for platform $(PLATFORM)) ; \ $(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 .PHONY: %-diff
%-diff: %-diff:
@ -968,7 +968,7 @@ $(PLATFORM_IMAGE_DIR)/ro.img ro-image: $(patsubst %,%-find-source,$(ROOT_PACKAGE
$(patsubst %,%-image_install, \ $(patsubst %,%-image_install, \
basic_system \ basic_system \
$(ROOT_PACKAGES)) ; \ $(ROOT_PACKAGES)) ; \
: make dev directory ; \ : $(MAKE) dev directory ; \
$(linuxrc_makedev) ; \ $(linuxrc_makedev) ; \
echo @@@@ Relocating ELF executables to run in / @@@@ ; \ echo @@@@ Relocating ELF executables to run in / @@@@ ; \
scripts/set-rpath /$(arch_lib_dir):/lib ; \ scripts/set-rpath /$(arch_lib_dir):/lib ; \

View File

@ -15,7 +15,6 @@
SHELL := $(shell which bash) SHELL := $(shell which bash)
DL_CACHE_DIR = $(HOME)/Downloads DL_CACHE_DIR = $(HOME)/Downloads
MAKE ?= make
MAKE_ARGS ?= -j MAKE_ARGS ?= -j
BUILD_DIR ?= $(CURDIR)/_build BUILD_DIR ?= $(CURDIR)/_build
INSTALL_DIR ?= $(CURDIR)/_install INSTALL_DIR ?= $(CURDIR)/_install
@ -159,17 +158,17 @@ ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)
@echo "development package by invoking 'make install-ext-deps'" @echo "development package by invoking 'make install-ext-deps'"
@echo "from the top level directory" @echo "from the top level directory"
@echo "==========================================================" @echo "=========================================================="
make config $(MAKE) config
else else
ifneq ($(INSTALLED_VER),) ifneq ($(INSTALLED_VER),)
make check-deb make check-deb
endif endif
ifneq ($(INSTALLED_RPM_VER),) ifneq ($(INSTALLED_RPM_VER),)
make check-rpm $(MAKE) check-rpm
endif endif
endif endif
ebuild-install: ebuild-install:
ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),) ifeq ($(INSTALLED_VER)$(INSTALLED_RPM_VER),)
make install $(MAKE) install
endif endif

View File

@ -107,7 +107,7 @@ $(PIP_TOOLS_INSTALL_DONE):
$(PYTHON_DEPENDS): requirements.txt $(PYTHON_DEPENDS): requirements.txt
@bash -c "source $(VENV_PATH)/bin/activate && \ @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 $@" python3 -m piptools compile -q --generate-hashes requirements.txt --output-file $@"
$(PIP_INSTALL_DONE): $(PIP_TOOLS_INSTALL_DONE) $(PYTHON_DEPENDS) $(PIP_INSTALL_DONE): $(PIP_TOOLS_INSTALL_DONE) $(PYTHON_DEPENDS)
@ -379,7 +379,7 @@ cov-post: wipe-cov $(BUILD_COV_DIR)
.PHONY: cov .PHONY: cov
cov: cov:
make -C . cov-prep test cov-post $(MAKE) -C . cov-prep test cov-post
.PHONY: wipe-cov .PHONY: wipe-cov
wipe-cov: wipe wipe-cov: wipe