All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Shuah Khan <shuah@kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	David Matlack <dmatlack@google.com>,
	patches@lists.linux.dev, Shuah Khan <skhan@linuxfoundation.org>,
	alex@shazbot.org
Subject: Re: [PATCH v2] vfio: selftests: Fix out-of-tree build with make O=
Date: Wed, 20 May 2026 15:11:59 -0600	[thread overview]
Message-ID: <20260520151159.5bbda153@shazbot.org> (raw)
In-Reply-To: <0-v2-4ccc247e6aff+1d93-vfio_st_make_o_jgg@nvidia.com>

On Thu, 14 May 2026 13:04:44 -0300
Jason Gunthorpe <jgg@nvidia.com> wrote:

> The test programs are compiled via a static pattern rule that requires
> intermediate .o files:
> 
>   $(TEST_GEN_PROGS): %: %.o $(LIBVFIO_O)
> 
> After lib.mk prefixes TEST_GEN_PROGS with $(OUTPUT), this creates
> dependencies on .o files in the output directory (e.g.
> $(OUTPUT)/vfio_dma_mapping_test.o). However, there is no rule to compile
> these .o files from the source directory .c files when OUTPUT differs
> from the source directory.
> 
> Add an explicit chain of pattern rules:
>   $(OUTPUT)/% -> $(OUTPUT)/%.o -> %.c
> 
> Following the same pattern already used in libvfio.mk for the library
> objects.
> 
> Fixes: 19faf6fd969c ("vfio: selftests: Add a helper library for VFIO selftests")
> Reviewed-by: David Matlack <dmatlack@google.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>  tools/testing/selftests/vfio/Makefile | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> v2: Fix the typo
> 
> diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile
> index 40165d087a0bc4..0a4cfd1a6c7ed6 100644
> --- a/tools/testing/selftests/vfio/Makefile
> +++ b/tools/testing/selftests/vfio/Makefile
> @@ -27,10 +27,13 @@ CFLAGS += $(EXTRA_CFLAGS)
>  
>  LDFLAGS += -pthread
>  
> -$(TEST_GEN_PROGS): %: %.o $(LIBVFIO_O)
> +$(TEST_GEN_PROGS): $(OUTPUT)/%: $(OUTPUT)/%.o $(LIBVFIO_O)
>  	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< $(LIBVFIO_O) $(LDLIBS) -o $@
>  
>  TEST_GEN_PROGS_O = $(patsubst %, %.o, $(TEST_GEN_PROGS))
> +$(TEST_GEN_PROGS_O): $(OUTPUT)/%.o: %.c
> +	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
> +
>  TEST_DEP_FILES = $(patsubst %.o, %.d, $(TEST_GEN_PROGS_O) $(LIBVFIO_O))
>  -include $(TEST_DEP_FILES)
>  
> 
> base-commit: b5953f774781f0b489ae1f34d49eb08fefe176a6

Applied to vfio next branch for v7.2.  Thanks,

Alex

      reply	other threads:[~2026-05-20 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 16:04 [PATCH v2] vfio: selftests: Fix out-of-tree build with make O= Jason Gunthorpe
2026-05-20 21:11 ` Alex Williamson [this message]

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=20260520151159.5bbda153@shazbot.org \
    --to=alex@shazbot.org \
    --cc=alex.williamson@redhat.com \
    --cc=dmatlack@google.com \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.