mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
lkl: link tests against common private library
This effectively reverts commit 3c97822a40 ("lkl: add tests build
barrier"), replacing the tests .WAIT barrier with a common-object
prerequisite to keep parallel builds working.
Prerequisites are preferable to explicit .WAIT barriers, as they better
allow for build concurrency and also avoid install target breakage
described in the previous commit.
One minor drawback is that some of the test binaries don't use any
cla.o symbols, but get linked nevertheless. E.g. Before:
text data bss dec hex filename
7878818 4851995 885880 13616693 cfc635 tools/lkl/tests/boot
After:
text data bss dec hex filename
7880494 4852094 885856 13618444 cfcd0c tools/lkl/tests/boot
I don't see it as a problem, but if it is then we could split up the
prerequisites.
Signed-off-by: David Disseldorp <ddiss@suse.de>
This commit is contained in:
@@ -52,15 +52,9 @@ export CFLAGS += -I$(OUTPUT)/include -Iinclude -Wall -g -O2 -Wextra \
|
||||
|
||||
include Targets
|
||||
|
||||
# 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,$(tests-y),$(EXESUF))
|
||||
TARGETS += $(call expand-targets,$(libs-y),$(SOSUF))
|
||||
TARGETS := $(progs-y:%=$(OUTPUT)%$(EXESUF))
|
||||
TARGETS := $(tests-y:%=$(OUTPUT)%$(EXESUF))
|
||||
TARGETS += $(libs-y:%=$(OUTPUT)%$(SOSUF))
|
||||
all: $(TARGETS)
|
||||
|
||||
# this workaround is for FreeBSD
|
||||
@@ -103,6 +97,9 @@ $(OUTPUT)liblkl.a: $(OUTPUT)lib/liblkl-in.o $(OUTPUT)lib/lkl.o
|
||||
$(OUTPUT)%$(EXESUF): $(OUTPUT)%-in.o $(OUTPUT)liblkl.a
|
||||
$(QUIET_LINK)$(CC) $(LDFLAGS) $(LDFLAGS_$*-y) -o $@ $^ $(LDLIBS) $(LDLIBS_$*-y)
|
||||
|
||||
# tests use a common private lib
|
||||
$(tests-y:%=$(OUTPUT)%$(EXESUF)): $(tests-priv-y:%=$(OUTPUT)%-in.o)
|
||||
|
||||
# rule to build objects
|
||||
$(OUTPUT)%-in.o: $(OUTPUT)lib/lkl.o FORCE
|
||||
$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(patsubst %/,%,$(dir $*)) obj=$(notdir $*)
|
||||
@@ -182,7 +179,7 @@ libraries_install: $(libs-y:%=$(OUTPUT)%$(SOSUF)) $(OUTPUT)liblkl.a
|
||||
install -d $(DESTDIR)$(LIBDIR) ; \
|
||||
install -m 644 $^ $(DESTDIR)$(LIBDIR)
|
||||
|
||||
programs_install: $(call expand-targets,$(progs-y),$(EXESUF))
|
||||
programs_install: $(progs-y:%=$(OUTPUT)%$(EXESUF))
|
||||
$(call QUIET_INSTALL, programs) \
|
||||
install -d $(DESTDIR)$(BINDIR) ; \
|
||||
install -m 755 $^ $(DESTDIR)$(BINDIR)
|
||||
@@ -198,4 +195,3 @@ FORCE: ;
|
||||
.PHONY: headers_install libraries_install programs_install install
|
||||
.NOTPARALLEL : lib/lkl.o
|
||||
.SECONDARY:
|
||||
.WAIT:
|
||||
|
||||
@@ -27,11 +27,10 @@ LDLIBS_cptofs-y := -larchive
|
||||
LDLIBS_cptofs-$(LKL_HOST_CONFIG_NEEDS_LARGP) += -largp
|
||||
|
||||
# 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
|
||||
# objects are shared between build objects so use tests-common-in.o
|
||||
# as a tests build prerequisite which gets linked into each binary.
|
||||
tests-priv-y := tests/tests-common
|
||||
tests-y := tests/disk
|
||||
tests-y += .WAIT
|
||||
tests-y += tests/boot
|
||||
tests-y += tests/disk-vfio-pci
|
||||
tests-y += tests/net-test
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
boot-y += boot.o test.o
|
||||
disk-y += disk.o cla.o test.o
|
||||
disk-vfio-pci-y += disk-vfio-pci.o cla.o test.o
|
||||
net-test-y += net-test.o cla.o test.o
|
||||
config-y += config.o test.o
|
||||
test-dlmopen-y += test-dlmopen.o test.o
|
||||
tests-common-y += cla.o test.o
|
||||
boot-y += boot.o
|
||||
disk-y += disk.o
|
||||
disk-vfio-pci-y += disk-vfio-pci.o
|
||||
net-test-y += net-test.o
|
||||
config-y += config.o
|
||||
test-dlmopen-y += test-dlmopen.o
|
||||
|
||||
Reference in New Issue
Block a user