[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 10 Oct 2013 08:39:18 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
David Ahern <dsahern@...il.com>, Jiri Olsa <jolsa@...hat.com>
Subject: Re: [PATCH 50/52] tools/perf/build: Fix O=/some/dir perf.o type of
targets
* Namhyung Kim <namhyung@...nel.org> wrote:
> On Tue, 8 Oct 2013 12:11:20 +0200, Ingo Molnar wrote:
> > If someone specifies a single target, mixed with O=, the following way:
> >
> > hubble:~/tip/tools/perf> make O=/tmp/perf util/stat.o
> > BUILD: Doing 'make -j8' parallel build
> > gcc -Wbad-function-cast -Wdeclaration-after-statement -Wformat-security -Wformat-y2k [...]
> >
> > The build might even fail, if a target depends on other targets:
> >
> > hubble:~/tip/tools/perf> make O=/tmp/perf perf.o
> > ...
> > perf.c: In function ‘handle_options’:
> > perf.c:155:21: error: ‘PERF_HTML_PATH’ undeclared (first use in this function)
> >
> > The correct way to invoke such targets is:
> >
> > hubble:~/tip/tools/perf> make O=/tmp/perf /tmp/perf/perf.o
> > BUILD: Doing 'make -j8' parallel build
> > GEN /tmp/perf/common-cmds.h
> > CC /tmp/perf/perf.o
> >
> > But that's unnecessary typing and it's also easy to mistakenly build into the
> > source directory.
> >
> > To fix this remove the generic suffix rules and add redirection to $(OUTPUT)
> > for the most popular .o targets.
>
> I got this:
>
> $ cd tools/perf
> $ make
> ... (succeeded)
>
> $ make O=~/build/perf perf.o
> make: `perf.o' is up to date.
>
> $ rm ~/build/perf/perf.o
> $ make O=~/build/perf/ perf.o
> make: `perf.o' is up to date.
Yes, this is a limitation: it will only do the redirection if the source
repository is clean.
I don't see a simple solution for that, do you?
> > +util/%.o: $(OUTPUT)util/%.o
> > + @echo " # Redirected target $@ => $(OUTPUT)util/$@"
> > +bench/%.o: $(OUTPUT)bench/%.o
> > + @echo " # Redirected target $@ => $(OUTPUT)bench/$@"
> > +tests/%.o: $(OUTPUT)tests/%.o
> > + @echo " # Redirected target $@ => $(OUTPUT)tests/$@"
> > +endif
>
> It also doesn't care about other directories - arch/, scripts/ and ui/ -
> and their subdirectories. So even on clean build it'll failed to build
> these files with O=dir.
Correct - only tried to cover the most common cases. Could add all the
other directories if this is something people would like to use on a
regular basis.
I also attempted to do a generic rule that can see into subdirectories,
using secondary expansion rules, but my first few attempts failed at
producing anything usable ;-) My Make fu still needs working on.
Suggestions welcome!
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists