linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: adjust make rules
@ 2012-03-08  9:29 Jan Beulich
  2012-03-14 19:17 ` Arnaldo Carvalho de Melo
  2012-03-19 19:55 ` [tip:perf/core] perf tools: Adjust " tip-bot for Jan Beulich
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2012-03-08  9:29 UTC (permalink / raw)
  To: a.p.zijlstra, mingo, acme, paulus; +Cc: linux-kernel

Add rules to generate pre-processed files (just like are available for
the normal kernel build), and adjust the rule to create assembly files
from C ones to produce its output in the output directory rather than
in the source tree.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

---
 tools/perf/Makefile |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- 3.3-rc6/tools/perf/Makefile
+++ 3.3-rc6-perf-make-rules/tools/perf/Makefile
@@ -706,10 +706,14 @@ $(OUTPUT)perf.o perf.spec \
 
 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
+$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
 $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $<
 $(OUTPUT)%.o: %.S
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
+$(OUTPUT)%.s: %.S
+	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
 
 $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf: adjust make rules
  2012-03-08  9:29 [PATCH] perf: adjust make rules Jan Beulich
@ 2012-03-14 19:17 ` Arnaldo Carvalho de Melo
  2012-03-15 12:14   ` Jan Beulich
  2012-03-19 19:55 ` [tip:perf/core] perf tools: Adjust " tip-bot for Jan Beulich
  1 sibling, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-03-14 19:17 UTC (permalink / raw)
  To: Jan Beulich; +Cc: a.p.zijlstra, mingo, paulus, linux-kernel

Em Thu, Mar 08, 2012 at 09:29:28AM +0000, Jan Beulich escreveu:
> Add rules to generate pre-processed files (just like are available for
> the normal kernel build), and adjust the rule to create assembly files
> from C ones to produce its output in the output directory rather than
> in the source tree.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

I'm trying to use it but hit this:

[acme@sandy linux]$ make -C tools/perf/ O=/home/git/build/perf /home/git/build/perf/perf.s
make: Entering directory `/home/git/linux/tools/perf'
    CC /home/git/build/perf/perf.s
perf.c: In function ‘handle_options’:
perf.c:111: error: ‘PERF_HTML_PATH’ undeclared (first use in this function)
perf.c:111: error: (Each undeclared identifier is reported only once
perf.c:111: error: for each function it appears in.)
perf.c: At top level:
perf.c:238: error: ‘PERF_VERSION’ undeclared here (not in a function)
make: *** [/home/git/build/perf/perf.s] Error 1
make: Leaving directory `/home/git/linux/tools/perf'
[acme@sandy linux]

Do I have to go to tools/perf and do it from there, trying...

[acme@sandy perf]$ make O=/home/git/build/perf /home/git/build/perf/perf.s
    CC /home/git/build/perf/perf.s
perf.c: In function ‘handle_options’:
perf.c:111: error: ‘PERF_HTML_PATH’ undeclared (first use in this function)
perf.c:111: error: (Each undeclared identifier is reported only once
perf.c:111: error: for each function it appears in.)
perf.c: At top level:
perf.c:238: error: ‘PERF_VERSION’ undeclared here (not in a function)
make: *** [/home/git/build/perf/perf.s] Error 1
[acme@sandy perf]$ make O=/home/git/build/perf perf.s
make: *** No rule to make target `perf.s'.  Stop.
[acme@sandy perf]$

Same result, what am I doing wrong?

- Arnaldo
 
> ---
>  tools/perf/Makefile |    6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> --- 3.3-rc6/tools/perf/Makefile
> +++ 3.3-rc6-perf-make-rules/tools/perf/Makefile
> @@ -706,10 +706,14 @@ $(OUTPUT)perf.o perf.spec \
>  
>  $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
> +$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
> +	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
>  $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
> -	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
> +	$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $<
>  $(OUTPUT)%.o: %.S
>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
> +$(OUTPUT)%.s: %.S
> +	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
>  
>  $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf: adjust make rules
  2012-03-14 19:17 ` Arnaldo Carvalho de Melo
@ 2012-03-15 12:14   ` Jan Beulich
  2012-03-15 17:28     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2012-03-15 12:14 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: a.p.zijlstra, mingo, paulus, linux-kernel

>>> On 14.03.12 at 20:17, Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
wrote:
> Em Thu, Mar 08, 2012 at 09:29:28AM +0000, Jan Beulich escreveu:
>> Add rules to generate pre-processed files (just like are available for
>> the normal kernel build), and adjust the rule to create assembly files
>> from C ones to produce its output in the output directory rather than
>> in the source tree.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> I'm trying to use it but hit this:
> 
> [acme@sandy linux]$ make -C tools/perf/ O=/home/git/build/perf 
> /home/git/build/perf/perf.s
> make: Entering directory `/home/git/linux/tools/perf'
>     CC /home/git/build/perf/perf.s
> perf.c: In function ‘handle_options’:
> perf.c:111: error: ‘PERF_HTML_PATH’ undeclared (first use in this function)
> perf.c:111: error: (Each undeclared identifier is reported only once
> perf.c:111: error: for each function it appears in.)
> perf.c: At top level:
> perf.c:238: error: ‘PERF_VERSION’ undeclared here (not in a function)
> make: *** [/home/git/build/perf/perf.s] Error 1
> make: Leaving directory `/home/git/linux/tools/perf'
> [acme@sandy linux]
> 
> Do I have to go to tools/perf and do it from there, trying...

No. perf.c just is a bad example - perf.o has a special make rule,
and hence the pattern rule for perf.s fails because the symbols
defined for perf.o don't get also defined for perf.s. Those special
rules look pretty strange anyway - as long as using GNU make is a
requirement, they could be re-written to use the pattern rule, and
then would be much easier to extend to cover .i and .s generation
as well.

Using the rules added in this patch works fine for me for any of the
source files that don't have custom .o rules (which is what I needed
when I came up with this patch).

Jan

> [acme@sandy perf]$ make O=/home/git/build/perf /home/git/build/perf/perf.s
>     CC /home/git/build/perf/perf.s
> perf.c: In function ‘handle_options’:
> perf.c:111: error: ‘PERF_HTML_PATH’ undeclared (first use in this function)
> perf.c:111: error: (Each undeclared identifier is reported only once
> perf.c:111: error: for each function it appears in.)
> perf.c: At top level:
> perf.c:238: error: ‘PERF_VERSION’ undeclared here (not in a function)
> make: *** [/home/git/build/perf/perf.s] Error 1
> [acme@sandy perf]$ make O=/home/git/build/perf perf.s
> make: *** No rule to make target `perf.s'.  Stop.
> [acme@sandy perf]$
> 
> Same result, what am I doing wrong?
> 
> - Arnaldo
>  
>> ---
>>  tools/perf/Makefile |    6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>> 
>> --- 3.3-rc6/tools/perf/Makefile
>> +++ 3.3-rc6-perf-make-rules/tools/perf/Makefile
>> @@ -706,10 +706,14 @@ $(OUTPUT)perf.o perf.spec \
>>  
>>  $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
>>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
>> +$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
>> +	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
>>  $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
>> -	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
>> +	$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $<
>>  $(OUTPUT)%.o: %.S
>>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
>> +$(OUTPUT)%.s: %.S
>> +	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
>>  
>>  $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
>>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
>> 
>> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf: adjust make rules
  2012-03-15 12:14   ` Jan Beulich
@ 2012-03-15 17:28     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-03-15 17:28 UTC (permalink / raw)
  To: Jan Beulich; +Cc: a.p.zijlstra, mingo, paulus, linux-kernel

Em Thu, Mar 15, 2012 at 12:14:32PM +0000, Jan Beulich escreveu:
> >>> On 14.03.12 at 20:17, Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> wrote:
> > Em Thu, Mar 08, 2012 at 09:29:28AM +0000, Jan Beulich escreveu:
> >> Add rules to generate pre-processed files (just like are available for
> >> the normal kernel build), and adjust the rule to create assembly files
> >> from C ones to produce its output in the output directory rather than
> >> in the source tree.
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > 
> > I'm trying to use it but hit this:
> > 
> > [acme@sandy linux]$ make -C tools/perf/ O=/home/git/build/perf 
> > /home/git/build/perf/perf.s
> > make: Entering directory `/home/git/linux/tools/perf'
> >     CC /home/git/build/perf/perf.s
> > perf.c: In function ‘handle_options’:
> > perf.c:111: error: ‘PERF_HTML_PATH’ undeclared (first use in this function)
> > perf.c:111: error: (Each undeclared identifier is reported only once
> > perf.c:111: error: for each function it appears in.)
> > perf.c: At top level:
> > perf.c:238: error: ‘PERF_VERSION’ undeclared here (not in a function)
> > make: *** [/home/git/build/perf/perf.s] Error 1
> > make: Leaving directory `/home/git/linux/tools/perf'
> > [acme@sandy linux]
> > 
> > Do I have to go to tools/perf and do it from there, trying...
> 
> No. perf.c just is a bad example - perf.o has a special make rule,
> and hence the pattern rule for perf.s fails because the symbols
> defined for perf.o don't get also defined for perf.s. Those special
> rules look pretty strange anyway - as long as using GNU make is a
> requirement, they could be re-written to use the pattern rule, and
> then would be much easier to extend to cover .i and .s generation
> as well.

Feel free to provide patches if you have the time to improve this
situation.

IIRC these things came from the git sources, having them closer to the
kernel Makefile practices would be good.
 
> Using the rules added in this patch works fine for me for any of the
> source files that don't have custom .o rules (which is what I needed
> when I came up with this patch).

Ok, I just tried it with another target and it worked. Applying.
 
> Jan
> 
> > [acme@sandy perf]$ make O=/home/git/build/perf /home/git/build/perf/perf.s
> >     CC /home/git/build/perf/perf.s
> > perf.c: In function ‘handle_options’:
> > perf.c:111: error: ‘PERF_HTML_PATH’ undeclared (first use in this function)
> > perf.c:111: error: (Each undeclared identifier is reported only once
> > perf.c:111: error: for each function it appears in.)
> > perf.c: At top level:
> > perf.c:238: error: ‘PERF_VERSION’ undeclared here (not in a function)
> > make: *** [/home/git/build/perf/perf.s] Error 1
> > [acme@sandy perf]$ make O=/home/git/build/perf perf.s
> > make: *** No rule to make target `perf.s'.  Stop.
> > [acme@sandy perf]$
> > 
> > Same result, what am I doing wrong?
> > 
> > - Arnaldo
> >  
> >> ---
> >>  tools/perf/Makefile |    6 +++++-
> >>  1 file changed, 5 insertions(+), 1 deletion(-)
> >> 
> >> --- 3.3-rc6/tools/perf/Makefile
> >> +++ 3.3-rc6-perf-make-rules/tools/perf/Makefile
> >> @@ -706,10 +706,14 @@ $(OUTPUT)perf.o perf.spec \
> >>  
> >>  $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
> >>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
> >> +$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
> >> +	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
> >>  $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
> >> -	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
> >> +	$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $<
> >>  $(OUTPUT)%.o: %.S
> >>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
> >> +$(OUTPUT)%.s: %.S
> >> +	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
> >>  
> >>  $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
> >>  	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
> >> 
> >> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:perf/core] perf tools: Adjust make rules
  2012-03-08  9:29 [PATCH] perf: adjust make rules Jan Beulich
  2012-03-14 19:17 ` Arnaldo Carvalho de Melo
@ 2012-03-19 19:55 ` tip-bot for Jan Beulich
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Jan Beulich @ 2012-03-19 19:55 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, hpa, mingo, a.p.zijlstra, jbeulich,
	JBeulich, tglx

Commit-ID:  4a3d2d9bfb3b594b6e1f2b7eabfaf4e820a18c0e
Gitweb:     http://git.kernel.org/tip/4a3d2d9bfb3b594b6e1f2b7eabfaf4e820a18c0e
Author:     Jan Beulich <JBeulich@suse.com>
AuthorDate: Thu, 8 Mar 2012 09:29:28 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 15 Mar 2012 14:23:28 -0300

perf tools: Adjust make rules

Add rules to generate pre-processed files (just like are available for
the normal kernel build), and adjust the rule to create assembly files
from C ones to produce its output in the output directory rather than
in the source tree.

E.g.

  $ make -C tools/perf/ O=/tmp/perf /tmp/perf/builtin-top.i
  make: Entering directory `/home/git/linux/tools/perf'
      CC /tmp/perf/builtin-top.i
  make: Leaving directory `/home/git/linux/tools/perf'
  $ wc -l /tmp/perf/builtin-top.i
  31379 /tmp/perf/builtin-top.i
  $

Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/4F588A0802000078000770FF@nat28.tlf.novell.com
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index fa04340..bd32855 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -727,10 +727,14 @@ $(OUTPUT)perf.o perf.spec \
 
 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
+$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
 $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
+	$(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $<
 $(OUTPUT)%.o: %.S
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
+$(OUTPUT)%.s: %.S
+	$(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
 
 $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-19 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-08  9:29 [PATCH] perf: adjust make rules Jan Beulich
2012-03-14 19:17 ` Arnaldo Carvalho de Melo
2012-03-15 12:14   ` Jan Beulich
2012-03-15 17:28     ` Arnaldo Carvalho de Melo
2012-03-19 19:55 ` [tip:perf/core] perf tools: Adjust " tip-bot for Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).