From: thuth@redhat.com (Thomas Huth)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC kvm-unit-tests PATCH 6/8] Makefiles: handle linking of scripts into build-tree
Date: Fri, 7 Apr 2017 11:22:56 +0200 [thread overview]
Message-ID: <a81e981b-1c6e-c8ac-82a6-ced80c045461@redhat.com> (raw)
In-Reply-To: <20170406190727.5624-7-alex.bennee@linaro.org>
On 06.04.2017 21:07, Alex Benn?e wrote:
> When doing an out-of-src-tree build we still want access to the
> various bits of common script machinery to run. This is handled by the
> scripts-common list which sub-builds can add explicit extra stuff to.
>
> The final rule is conditional so we don't attempt to link files when
> we are doing an in-src-tree build.
>
> Signed-off-by: Alex Benn?e <alex.bennee@linaro.org>
> ---
> Makefile | 13 +++++++++++++
> x86/Makefile.common | 4 ++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 56598df..c9fea88 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -31,6 +31,10 @@ cflatobjs := \
> lib/report.o \
> lib/stack.o
>
> +# These are scripts we want linked from the source tree
> +scripts-common := run_tests.sh \
> + scripts
> +
> # libfdt paths
> LIBFDT_objdir = $(SRCDIR)/lib/libfdt
> LIBFDT_srcdir = $(SRCDIR)/lib/libfdt
> @@ -86,8 +90,17 @@ $(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
> mkdir -p $(dir $@)
> $(CC) $(CFLAGS) -c -o $@ $<
>
> +$(scripts-common): $(SRCDIR)/$@
> + ln -sf $<$@ $@
The prerequisite does not seem to work correctly here. I can see that
the symlinks are regenerated each time I run make. Even worse, during
the second run, there is a
ln -sf /home/thuth/devel/kvm-unit-tests/scripts scripts
which generates a symlink in the source directory, since the "scripts"
symlink already exists!
I think you can not use automatic variables like $@ in the prerequisite
list, can you?
Maybe it would be better to create these symlinks in the configure
script already?
> -include */.*.d */*/.*.d
>
> +
> +# We only need to link common scripts for out-of-src-tree builds
> +ifneq ($(CURDIR), $(SRCDIR))
> +all: $(scripts-common)
> +endif
> +
> all: $(shell git -C $(SRCDIR) rev-parse --verify --short=8 HEAD >build-head 2>/dev/null)
>
> standalone: all
> diff --git a/x86/Makefile.common b/x86/Makefile.common
> index fbab82c..ef6e543 100644
> --- a/x86/Makefile.common
> +++ b/x86/Makefile.common
> @@ -54,8 +54,12 @@ tests-common += api/dirty-log
> tests-common += api/dirty-log-perf
> endif
>
> +scripts-common += $(TEST_DIR)/run
> +scripts-common += $(TEST_DIR)/unittests.cfg
> +
> test_cases: $(tests-common) $(tests)
>
> +
Cosmetic nit: Superfluous white space change.
> $(TEST_DIR)/%.o: CFLAGS += -std=gnu99 -ffreestanding -I lib -I lib/x86
>
> $(TEST_DIR)/realmode.elf: $(TEST_DIR)/realmode.o
>
Thomas
next prev parent reply other threads:[~2017-04-07 9:22 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 19:07 [RFC kvm-unit-tests PATCH 0/8] Support for out-of-tree builds Alex Bennée
2017-04-06 19:07 ` [RFC kvm-unit-tests PATCH 1/8] configure: make it run-able from outside source tree Alex Bennée
2017-04-07 11:40 ` Andrew Jones
2017-04-07 11:46 ` Peter Maydell
2017-04-06 19:07 ` [RFC kvm-unit-tests PATCH 2/8] Makefile: ensure build-head works out-of-src-tree Alex Bennée
2017-04-07 11:44 ` Andrew Jones
2017-04-06 19:07 ` [RFC kvm-unit-tests PATCH 3/8] Makefile: set VPATH based on SRCDIR Alex Bennée
2017-04-07 11:56 ` Andrew Jones
2017-04-06 19:07 ` [RFC kvm-unit-tests PATCH 4/8] Makefiles: use explicit path for including sub-Makefiles Alex Bennée
2017-04-07 8:53 ` Thomas Huth
2017-04-07 9:21 ` Alex Bennée
2017-04-07 12:20 ` Andrew Jones
2017-04-27 15:54 ` Paolo Bonzini
2017-04-06 19:07 ` [RFC kvm-unit-tests PATCH 5/8] Makefile: add explicit mkdir for .o targets Alex Bennée
2017-04-07 14:42 ` Andrew Jones
2017-04-27 15:57 ` Paolo Bonzini
2017-05-11 15:30 ` Alex Bennée
2017-05-12 10:36 ` Paolo Bonzini
2017-05-12 11:14 ` Alex Bennée
2017-04-06 19:07 ` [RFC kvm-unit-tests PATCH 6/8] Makefiles: handle linking of scripts into build-tree Alex Bennée
2017-04-07 9:22 ` Thomas Huth [this message]
2017-04-07 10:38 ` Alex Bennée
2017-04-07 13:37 ` Andrew Jones
2017-04-06 19:07 ` [RFC kvm-unit-tests PATCH 7/8] Makefiles: fix up the x86 build include and link paths Alex Bennée
2017-04-07 13:31 ` Andrew Jones
2017-04-07 14:30 ` Alex Bennée
2017-04-06 19:07 ` [RFC kvm-unit-tests PATCH 8/8] Makefiles: fix up the arm " Alex Bennée
2017-04-07 6:58 ` [RFC kvm-unit-tests PATCH 9/8] Makefiles: Fix up the powerpc " Thomas Huth
2017-04-07 8:02 ` Alex Bennée
2017-04-07 13:56 ` [RFC kvm-unit-tests PATCH 8/8] Makefiles: fix up the arm " Andrew Jones
2017-04-07 14:29 ` Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a81e981b-1c6e-c8ac-82a6-ced80c045461@redhat.com \
--to=thuth@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).