All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: kvm@vger.kernel.org, marc.zyngier@arm.com,
	linux-arm-kernel@lists.infradead.org, pbonzini@redhat.com,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [RFC kvm-unit-tests PATCH 5/8] Makefile: add explicit mkdir for .o targets
Date: Fri, 7 Apr 2017 16:42:34 +0200	[thread overview]
Message-ID: <20170407144234.kmq2ofvh5e6vyssq@kamzik.brq.redhat.com> (raw)
In-Reply-To: <20170406190727.5624-6-alex.bennee@linaro.org>

On Thu, Apr 06, 2017 at 08:07:24PM +0100, Alex Bennée wrote:
> This is fairly direct way of ensuring the target build directories are
> created before we build a binary blob. mkdir -p fails gracefully if
> the directory is already there.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 781186e..56598df 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -79,8 +79,13 @@ $(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
>  	$(AR) rcs $@ $^
>  
>  %.o: %.S
> +	mkdir -p $(dir $@)
>  	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
>  
> +%.o: %.c
> +	mkdir -p $(dir $@)
> +	$(CC) $(CFLAGS) -c -o $@ $<

This rule will override any arch makefile %.o rule.  I don't think we want
to do that.  And I guess that means we should move the '%.o: %.S' rule up
above the include $(TEST_DIR)/Makefile so we don't override those either.

> +
>  -include */.*.d */*/.*.d
>  
>  all: $(shell git -C $(SRCDIR) rev-parse --verify --short=8 HEAD >build-head 2>/dev/null)
> -- 
> 2.11.0
>

I'd prefer we just have a couple places where we do mkdir:  one in the
common Makefile for common dirs (BUILD_DIRS) and one in the arch makefile
for arch dirs (ARCH_BUILD_DIRS).

The example linked below looks like something we might be able to apply.

https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html#Prerequisite-Types

Thanks,
drew

WARNING: multiple messages have this Message-ID (diff)
From: drjones@redhat.com (Andrew Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC kvm-unit-tests PATCH 5/8] Makefile: add explicit mkdir for .o targets
Date: Fri, 7 Apr 2017 16:42:34 +0200	[thread overview]
Message-ID: <20170407144234.kmq2ofvh5e6vyssq@kamzik.brq.redhat.com> (raw)
In-Reply-To: <20170406190727.5624-6-alex.bennee@linaro.org>

On Thu, Apr 06, 2017 at 08:07:24PM +0100, Alex Benn?e wrote:
> This is fairly direct way of ensuring the target build directories are
> created before we build a binary blob. mkdir -p fails gracefully if
> the directory is already there.
> 
> Signed-off-by: Alex Benn?e <alex.bennee@linaro.org>
> ---
>  Makefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 781186e..56598df 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -79,8 +79,13 @@ $(LIBFDT_archive): $(addprefix $(LIBFDT_objdir)/,$(LIBFDT_OBJS))
>  	$(AR) rcs $@ $^
>  
>  %.o: %.S
> +	mkdir -p $(dir $@)
>  	$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
>  
> +%.o: %.c
> +	mkdir -p $(dir $@)
> +	$(CC) $(CFLAGS) -c -o $@ $<

This rule will override any arch makefile %.o rule.  I don't think we want
to do that.  And I guess that means we should move the '%.o: %.S' rule up
above the include $(TEST_DIR)/Makefile so we don't override those either.

> +
>  -include */.*.d */*/.*.d
>  
>  all: $(shell git -C $(SRCDIR) rev-parse --verify --short=8 HEAD >build-head 2>/dev/null)
> -- 
> 2.11.0
>

I'd prefer we just have a couple places where we do mkdir:  one in the
common Makefile for common dirs (BUILD_DIRS) and one in the arch makefile
for arch dirs (ARCH_BUILD_DIRS).

The example linked below looks like something we might be able to apply.

https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html#Prerequisite-Types

Thanks,
drew

  reply	other threads:[~2017-04-07 14:42 UTC|newest]

Thread overview: 62+ 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 ` 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-06 19:07   ` Alex Bennée
2017-04-07 11:40   ` Andrew Jones
2017-04-07 11:40     ` Andrew Jones
2017-04-07 11:46     ` Peter Maydell
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-06 19:07   ` Alex Bennée
2017-04-07 11:44   ` Andrew Jones
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-06 19:07   ` Alex Bennée
2017-04-07 11:56   ` Andrew Jones
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-06 19:07   ` Alex Bennée
2017-04-07  8:53   ` Thomas Huth
2017-04-07  8:53     ` Thomas Huth
2017-04-07  9:21     ` Alex Bennée
2017-04-07  9:21       ` Alex Bennée
2017-04-07 12:20   ` Andrew Jones
2017-04-07 12:20     ` Andrew Jones
2017-04-27 15:54     ` Paolo Bonzini
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-06 19:07   ` Alex Bennée
2017-04-07 14:42   ` Andrew Jones [this message]
2017-04-07 14:42     ` Andrew Jones
2017-04-27 15:57   ` Paolo Bonzini
2017-04-27 15:57     ` Paolo Bonzini
2017-05-11 15:30     ` Alex Bennée
2017-05-11 15:30       ` Alex Bennée
2017-05-12 10:36       ` Paolo Bonzini
2017-05-12 10:36         ` Paolo Bonzini
2017-05-12 11:14         ` Alex Bennée
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-06 19:07   ` Alex Bennée
2017-04-07  9:22   ` Thomas Huth
2017-04-07  9:22     ` Thomas Huth
2017-04-07 10:38     ` Alex Bennée
2017-04-07 10:38       ` Alex Bennée
2017-04-07 13:37       ` Andrew Jones
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-06 19:07   ` Alex Bennée
2017-04-07 13:31   ` Andrew Jones
2017-04-07 13:31     ` Andrew Jones
2017-04-07 14:30     ` Alex Bennée
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-06 19:07   ` 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  6:58     ` Thomas Huth
2017-04-07  8:02     ` Alex Bennée
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 13:56     ` Andrew Jones
2017-04-07 14:29     ` Alex Bennée
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=20170407144234.kmq2ofvh5e6vyssq@kamzik.brq.redhat.com \
    --to=drjones@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=pbonzini@redhat.com \
    /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.