All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernd Petrovitsch <bernd@sysprog.at>
To: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Kusanagi Kouichi <slash@ac.auone-net.jp>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf tools: Don't use brace expansion.
Date: Tue, 17 Aug 2010 18:09:49 +0200	[thread overview]
Message-ID: <1282061389.5822.22.camel@thorin> (raw)
In-Reply-To: <20100817154237.GG13095@ghostprotocols.net>

On Die, 2010-08-17 at 12:42 -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Aug 17, 2010 at 01:58:00PM +0200, Bernd Petrovitsch escreveu:
[...]
> > The following patch below at the end works for me. Alas, it is against
> > vanilla main line.
> 
> Adding $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h there, to have it look:
>
> +# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
> +# we depend the various files onto their directories.
> +$(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h: $(sort $(dir $(LIB_OBJS) $(BUILTIN_OBJS)))

Hmm, that adds that $(OUTPUT)PERF-VERSION-FILE and
$(OUTPUT)common-cmds.h (also) depends on the subdirectories of the other
objects (and thus it works always because at least one of them is a
subdirectory of $(OUTPUT)).
To be 110% anal, it should look like e.g.
+$(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h: $(sort $(dir $(LIB_OBJS) $(BUILTIN_OBJS)) $(OUTPUT))

or actually all targets.

> +# In the second step, we make a rule to actually create these directories
> +$(sort $(dir $(LIB_OBJS) $(BUILTIN_OBJS))):
> +       mkdir -p $@ 2>/dev/null
> +

BTW there is no automatic variable or other make-construct to refer in
the dependencies on the own target. Therefore the copy-paste-the-
variables solution.

Perhaps an additional variable reduces clutter (and eases maintenance)?

+# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
+# we depend the various files onto their directories.
+DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
+$(DIRECTORY_DEPS): $(sort $(dir $(DIRECTORY_DEPS)))
+# In the second step, we make a rule to actually create these directories
+$(sort $(dir $(DIRECTORY_DEPS))):
+       mkdir -p $@ 2>/dev/null
+

That should guarantee that all directories from the targets are created.

> As it was failing when I did:
> 
> rm -rf ~/build/perf
> make -C tools/perf O=~/build/perf
> 
> With that it retains the existing functionality,

Ah, I `mkdir`ed the output directory explicitly before the `make` (and
after the `rm -rf`).


BTW which is the preferred tree to base patches on (for the "perf"
subsystem)?

	Bernd
-- 
mobile: +43 664 4416156              http://www.sysprog.at/
    Linux Software Development, Consulting and Services


  reply	other threads:[~2010-08-17 16:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 12:41 [PATCH] perf tools: Don't use brace expansion Kusanagi Kouichi
2010-08-16 13:30 ` Peter Zijlstra
2010-08-16 14:09 ` Bernd Petrovitsch
2010-08-16 14:30   ` Peter Zijlstra
2010-08-16 14:54     ` Bernd Petrovitsch
2010-08-16 15:29       ` Arnaldo Carvalho de Melo
2010-08-16 15:43         ` Bernd Petrovitsch
2010-08-16 15:50           ` Arnaldo Carvalho de Melo
2010-08-17 11:58             ` Bernd Petrovitsch
2010-08-17 15:42               ` Arnaldo Carvalho de Melo
2010-08-17 16:09                 ` Bernd Petrovitsch [this message]
2010-08-17 18:16                   ` Arnaldo Carvalho de Melo
2010-08-18  9:47                     ` Bernd Petrovitsch
2010-08-18  8:18               ` [tip:perf/urgent] perf tools: Fix build on POSIX shells tip-bot for Bernd Petrovitsch
2010-08-16 15:24 ` [PATCH] perf tools: Don't use brace expansion Arnaldo Carvalho de Melo

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=1282061389.5822.22.camel@thorin \
    --to=bernd@sysprog.at \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=slash@ac.auone-net.jp \
    /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.