lkl: add tests build barrier

tools/build does not support parallel builds when objects are shared
between build targets. Keep the test that uses the most common object
first and insert a build barrier to avoid rebuilding common objects.

Signed-off-by: Octavian Purdila <tavip@google.com>
This commit is contained in:
Octavian Purdila
2025-02-05 16:51:45 -08:00
parent a593a3baa4
commit 3c97822a40
2 changed files with 16 additions and 5 deletions

View File

@@ -50,8 +50,14 @@ export CFLAGS += -I$(OUTPUT)/include -Iinclude -Wall -g -O2 -Wextra \
-include Targets
TARGETS := $(progs-y:%=$(OUTPUT)%$(EXESUF))
TARGETS += $(libs-y:%=$(OUTPUT)%$(SOSUF))
# Expand targets to output location and suffix but preserve special
# targets (e.g. .WAIT)
# $1 - targets
# $2 - suffix
expand-targets = $(foreach t,$(1),$(if $(filter .%,$(t)),$(t),$(OUTPUT)$(t)$(2)))
TARGETS := $(call expand-targets,$(progs-y),$(EXESUF))
TARGETS += $(call expand-targets,$(libs-y),$(SOSUF))
all: $(TARGETS)
# this workaround is for FreeBSD
@@ -135,7 +141,7 @@ libraries_install: $(libs-y:%=$(OUTPUT)%$(SOSUF)) $(OUTPUT)liblkl.a
install -d $(DESTDIR)$(LIBDIR) ; \
install -m 644 $^ $(DESTDIR)$(LIBDIR)
programs_install: $(progs-y:%=$(OUTPUT)%$(EXESUF))
programs_install: $(call expand-targets,$(progs-y),$(EXESUF))
$(call QUIET_INSTALL, programs) \
install -d $(DESTDIR)$(BINDIR) ; \
install -m 755 $^ $(DESTDIR)$(BINDIR)
@@ -157,4 +163,4 @@ FORCE: ;
.PHONY: headers_install libraries_install programs_install install
.NOTPARALLEL : lib/lkl.o
.SECONDARY:
.WAIT:

View File

@@ -25,8 +25,13 @@ progs-$(LKL_HOST_CONFIG_ARCHIVE) += cptofs
LDLIBS_cptofs-y := -larchive
LDLIBS_cptofs-$(LKL_HOST_CONFIG_NEEDS_LARGP) += -largp
progs-y += tests/boot
# tools/build/Makefile.build does not support parallel builds when
# objects are shared between build objects so keep the test that uses
# the most common object first and insert a build barrier to avoid
# rebuilding common objects
progs-y += tests/disk
progs-y += .WAIT
progs-y += tests/boot
progs-y += tests/disk-vfio-pci
progs-y += tests/net-test
progs-y += tests/config