Skip to content

Commit

Permalink
build: Explicitly use gmake
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tom Jones authored and Damjan Marion committed Jan 21, 2024
1 parent 038dad7 commit 0aa0d6f
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 38 deletions.
54 changes: 27 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ") ; \
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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/ \
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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 ]
2 changes: 1 addition & 1 deletion build-data/packages/external.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions build-root/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 ; \
Expand Down
7 changes: 3 additions & 4 deletions build/external/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0aa0d6f

Please sign in to comment.