public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Kusanagi Kouichi <slash@ac.auone-net.jp>,
	Bernd Petrovitsch <bernd@sysprog.at>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf tools: Fix build error on read only source.
Date: Wed, 18 Aug 2010 16:09:59 -0300	[thread overview]
Message-ID: <20100818190959.GI9410@ghostprotocols.net> (raw)
In-Reply-To: <20100818170158.GG9410@ghostprotocols.net>

Em Wed, Aug 18, 2010 at 02:01:58PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Aug 18, 2010 at 01:56:42PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Wed, Aug 18, 2010 at 04:27:45PM +0200, Peter Zijlstra escreveu:
> > > On Wed, 2010-08-18 at 11:16 -0300, Arnaldo Carvalho de Melo wrote:
> > > > rm -rf ~/build
> > > > make O=~/build
> > > > 
> > > > and have everything work? Saving some keystrokes 8)
> > > 
> > > The turn side is that if you typo the output dir you'll probably not
> > > ever find it again.. and you could have typed: rm -rf ~/build/* instead.
> > 
> > Not something I'll argue too much :)

Ok, here it is, stolen directly from the toplevel kernel Makefile, will push to
Ingo today:

[acme@emilia linux-2.6-tip]$ rm -rf ~/git/build/perf
[acme@emilia linux-2.6-tip]$ make -j9 O=~/git/build/perf -C tools/perf
/bin/sh: line 0: cd: /home/acme/git/build/perf/: No such file or directory
make: Entering directory `/home/acme/git/linux-2.6-tip/tools/perf'
Makefile:12: *** output directory "/home/acme/git/build/perf/" does not exist.  Stop.
make: Leaving directory `/home/acme/git/linux-2.6-tip/tools/perf'
[acme@emilia linux-2.6-tip]$ mkdir ~/git/build/perf 
[acme@emilia linux-2.6-tip]$ make -j9 O=~/git/build/perf -C tools/perf
make: Entering directory `/home/acme/git/linux-2.6-tip/tools/perf'
    MKDIR /home/acme/git/build/perf/bench
<SNIP>
PERF_VERSION = 2.6.36.rc1.2.g033a273.dirty
make: Leaving directory `/home/acme/git/linux-2.6-tip/tools/perf'
make: Entering directory `/home/acme/git/linux-2.6-tip/tools/perf'
    GEN /home/acme/git/build/perf/common-cmds.h
    * new build flags or prefix
    GEN perf-archive
    CC /home/acme/git/build/perf/builtin-annotate.o
<SNIP>
    AR /home/acme/git/build/perf/libperf.a
    LINK /home/acme/git/build/perf/perf
make: Leaving directory `/home/acme/git/linux-2.6-tip/tools/perf'
[acme@emilia linux-2.6-tip]$

- Arnaldo

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index dcb9700..4f1fa77 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -5,6 +5,12 @@ endif
 # The default target of this Makefile is...
 all::
 
+ifneq ($(OUTPUT),)
+# check that the output directory actually exists
+OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
+$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
+endif
+
 # Define V=1 to have a more verbose compile.
 # Define V=2 to have an even more verbose compile.
 #
@@ -931,15 +937,15 @@ $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
 	$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
 
 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
-	$(QUIET_GEN)$(RM) $@ $@+ && \
+	$(QUIET_GEN)$(RM) $(OUTPUT)$@ $(OUTPUT)$@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
 	    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
 	    -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \
 	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
-	    $@.sh >$@+ && \
-	chmod +x $@+ && \
-	mv $@+ $(OUTPUT)$@
+	    $@.sh > $(OUTPUT)$@+ && \
+	chmod +x $(OUTPUT)$@+ && \
+	mv $(OUTPUT)$@+ $(OUTPUT)$@
 
 configure: configure.ac
 	$(QUIET_GEN)$(RM) $@ $<+ && \
diff --git a/tools/perf/feature-tests.mak b/tools/perf/feature-tests.mak
index ddb68e6..7a7b608 100644
--- a/tools/perf/feature-tests.mak
+++ b/tools/perf/feature-tests.mak
@@ -113,7 +113,7 @@ endef
 # try-cc
 # Usage: option = $(call try-cc, source-to-build, cc-options)
 try-cc = $(shell sh -c						  \
-	'TMP="$(TMPOUT).$$$$";			 		  \
+	'TMP="$(OUTPUT)$(TMPOUT).$$$$";				  \
 	 echo "$(1)" |						  \
 	 $(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \
 	 rm -f "$$TMP"')

  reply	other threads:[~2010-08-18 19:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-17 18:18 [PATCH] perf tools: Fix build error on read only source Arnaldo Carvalho de Melo
2010-08-18 12:37 ` Kusanagi Kouichi
2010-08-18 12:40   ` Peter Zijlstra
2010-08-18 14:16     ` Arnaldo Carvalho de Melo
2010-08-18 14:27       ` Peter Zijlstra
2010-08-18 16:56         ` Arnaldo Carvalho de Melo
2010-08-18 17:01           ` Arnaldo Carvalho de Melo
2010-08-18 19:09             ` Arnaldo Carvalho de Melo [this message]
2010-08-19  9:02               ` Bernd Petrovitsch
2010-08-18 14:14   ` Arnaldo Carvalho de Melo
2010-08-18 15:25     ` Bernd Petrovitsch
2010-08-18 17:19       ` Arnaldo Carvalho de Melo
2010-08-19 10:31         ` Bernd Petrovitsch
2010-08-19 14:13           ` Arnaldo Carvalho de Melo
  -- strict thread matches above, loose matches on Subject: below --
2010-08-16 12:40 Kusanagi Kouichi
2010-08-16 15:24 ` Arnaldo Carvalho de Melo
2010-08-17 12:57   ` Kusanagi Kouichi
2010-08-17 14:08   ` Kusanagi Kouichi
2010-08-17 14:17     ` 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=20100818190959.GI9410@ghostprotocols.net \
    --to=acme@infradead.org \
    --cc=bernd@sysprog.at \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox