linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to echo $(KBUILD_CFLAGS)
@ 2015-08-20  2:03 RaphaelWu
  2015-08-20  8:57 ` Michal Marek
  0 siblings, 1 reply; 9+ messages in thread
From: RaphaelWu @ 2015-08-20  2:03 UTC (permalink / raw)
  To: mmarek, daniel.baluta; +Cc: linux-kbuild, octavian.purdila, bogdan.m.davidoaia

Hi,
        Recently I wrote a test module, within my module I need remove -pg flag
which is defined by host Makefile (which enable -pg, ftrace function).
        I used a trick in my module makefile KBUILD_CFLAGS := $(subst -pg,,$(KBUILD_CFLAGS)),
and it works well.
        The point that I can not echo out $(KBUILD_CFLAGS) in my module makefile to verify immediately is confusing me.
        So is there a proper or hack way how I can echo out system's KBUILD_CFLAGS.
        Looking for your tips, and thanks very much.

Best regards,
Raphael
The information transmitted in this e-mail is intended only for the addressee and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please notify the sender immediately, and delete this e-mail and any attachments. Thank you.

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

* Re: how to echo $(KBUILD_CFLAGS)
  2015-08-20  2:03 RaphaelWu
@ 2015-08-20  8:57 ` Michal Marek
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Marek @ 2015-08-20  8:57 UTC (permalink / raw)
  To: RaphaelWu
  Cc: daniel.baluta, linux-kbuild, octavian.purdila, bogdan.m.davidoaia

On 2015-08-20 04:03, RaphaelWu@viatech.com.cn wrote:
> Hi,
>         Recently I wrote a test module, within my module I need remove -pg flag
> which is defined by host Makefile (which enable -pg, ftrace function).
>         I used a trick in my module makefile KBUILD_CFLAGS := $(subst -pg,,$(KBUILD_CFLAGS)),

You are probably looking for CLFAGS_REMOVE_<file.o>.

Michal

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

* Re: how to echo $(KBUILD_CFLAGS)
@ 2015-08-20 10:45 RaphaelWu
  2015-08-20 10:49 ` Michal Marek
  0 siblings, 1 reply; 9+ messages in thread
From: RaphaelWu @ 2015-08-20 10:45 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kbuild

Hi,

I have seen this VAR used in some kernel module which also forbid ftrace.
but I was curious about whenever I echo $(KBUILD_CFLAGS), it's always empty.

all:
@echo $(KBUILD_CFLAGS)
$(MAKE) -C /path-of-kernel/ M=$(PWD) modules

The modification of the option did works, but in the scope of the deferred truly building
out-of-tree modules process, the VAR's value seems gone.

Thanks for your time.

Raphael

> ----------original
> sender: linux-kbuild-owner@vger.kernel.org
> [mailto:linux-kbuild-owner@vger.kernel.org] on behave Michal Marek
> On: 2015-08-20 16:58
> receiver: Raphael Wu
> cc: daniel.baluta@intel.com; linux-kbuild@vger.kernel.org;
> octavian.purdila@intel.com; bogdan.m.davidoaia@intel.com
> Title: Re: how to echo $(KBUILD_CFLAGS)
>
> On 2015-08-20 04:03, RaphaelWu@viatech.com.cn wrote:
> > Hi,
> >         Recently I wrote a test module, within my module I need remove
> > -pg flag which is defined by host Makefile (which enable -pg, ftrace function).
> >         I used a trick in my module makefile KBUILD_CFLAGS := $(subst
> > -pg,,$(KBUILD_CFLAGS)),
>
> You are probably looking for CLFAGS_REMOVE_<file.o>.
>
> Michal
> --

The information transmitted in this e-mail is intended only for the addressee and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please notify the sender immediately, and delete this e-mail and any attachments. Thank you.

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

* Re: how to echo $(KBUILD_CFLAGS)
  2015-08-20 10:45 RaphaelWu
@ 2015-08-20 10:49 ` Michal Marek
  0 siblings, 0 replies; 9+ messages in thread
From: Michal Marek @ 2015-08-20 10:49 UTC (permalink / raw)
  To: RaphaelWu; +Cc: linux-kbuild

On 2015-08-20 12:45, RaphaelWu@viatech.com.cn wrote:
> Hi,
> 
> I have seen this VAR used in some kernel module which also forbid ftrace.
> but I was curious about whenever I echo $(KBUILD_CFLAGS), it's always empty.
> 
> all:
> @echo $(KBUILD_CFLAGS)
> $(MAKE) -C /path-of-kernel/ M=$(PWD) modules

This does not look like a kbuild makefile, so it does not see any
KBUILD_* variables.

Michal

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

* Re: how to echo $(KBUILD_CFLAGS)
@ 2015-08-20 11:03 RaphaelWu
  2015-08-20 11:34 ` Michal Marek
  2015-08-20 17:19 ` Sam Ravnborg
  0 siblings, 2 replies; 9+ messages in thread
From: RaphaelWu @ 2015-08-20 11:03 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kbuild

Let me show the simplified piece.

obj-m += test.o
KBUILD_CFLAGS := $(subst -pg,,$(KBUILD_CFLAGS))

all:
        @echo $(KBUILD_CFLAGS)
        $(MAKE) -C /lib/modules/`uname`/build M=$(PWD) modules

So if it's not a kbuild makefile, why the -pg flag can be successful removed through KBUILD_CFLAGS.
I objdump my test.o, there is not mcount inside. Opposite, with -pg every function inside test.o will be insert
a ftrace point.

Best regards,
Raphael

> On 2015-08-20 12:45, RaphaelWu@viatech.com.cn wrote:
> > Hi,
> >
> > I have seen this VAR used in some kernel module which also forbid ftrace.
> > but I was curious about whenever I echo $(KBUILD_CFLAGS), it's always
> empty.
> >
> > all:
> > @echo $(KBUILD_CFLAGS)
> > $(MAKE) -C /path-of-kernel/ M=$(PWD) modules
>
> This does not look like a kbuild makefile, so it does not see any
> KBUILD_* variables.
>
> Michal
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the
> body of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html
The information transmitted in this e-mail is intended only for the addressee and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please notify the sender immediately, and delete this e-mail and any attachments. Thank you.

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

* Re: how to echo $(KBUILD_CFLAGS)
  2015-08-20 11:03 how to echo $(KBUILD_CFLAGS) RaphaelWu
@ 2015-08-20 11:34 ` Michal Marek
  2015-08-20 17:19 ` Sam Ravnborg
  1 sibling, 0 replies; 9+ messages in thread
From: Michal Marek @ 2015-08-20 11:34 UTC (permalink / raw)
  To: RaphaelWu; +Cc: linux-kbuild

On 2015-08-20 13:03, RaphaelWu@viatech.com.cn wrote:
> Let me show the simplified piece.
> 
> obj-m += test.o
> KBUILD_CFLAGS := $(subst -pg,,$(KBUILD_CFLAGS))
> 
> all:
>         @echo $(KBUILD_CFLAGS)
>         $(MAKE) -C /lib/modules/`uname`/build M=$(PWD) modules
> 
> So if it's not a kbuild makefile, why the -pg flag can be successful removed through KBUILD_CFLAGS.

There are no all: rules in kbuild files.

Michal


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

* Re: how to echo $(KBUILD_CFLAGS)
@ 2015-08-20 12:04 RaphaelWu
  0 siblings, 0 replies; 9+ messages in thread
From: RaphaelWu @ 2015-08-20 12:04 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kbuild

Thanks Michal for correcting the concept. :)
And I get to understand your point.
It's an out-of-tree module makefile, I'll still try to figure out how -pg removed.

Best regards,
Raphael

> -----origin-----
> sender: Michal Marek [mailto:mmarek@suse.com]
>
> On 2015-08-20 13:03, RaphaelWu@viatech.com.cn wrote:
> > Let me show the simplified piece.
> >
> > obj-m += test.o
> > KBUILD_CFLAGS := $(subst -pg,,$(KBUILD_CFLAGS))
> >
> > all:
> >         @echo $(KBUILD_CFLAGS)
> >         $(MAKE) -C /lib/modules/`uname`/build M=$(PWD) modules
> >
> > So if it's not a kbuild makefile, why the -pg flag can be successful removed
> through KBUILD_CFLAGS.
>
> There are no all: rules in kbuild files.
>
> Michal

The information transmitted in this e-mail is intended only for the addressee and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please notify the sender immediately, and delete this e-mail and any attachments. Thank you.

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

* Re: how to echo $(KBUILD_CFLAGS)
  2015-08-20 11:03 how to echo $(KBUILD_CFLAGS) RaphaelWu
  2015-08-20 11:34 ` Michal Marek
@ 2015-08-20 17:19 ` Sam Ravnborg
  1 sibling, 0 replies; 9+ messages in thread
From: Sam Ravnborg @ 2015-08-20 17:19 UTC (permalink / raw)
  To: RaphaelWu; +Cc: mmarek, linux-kbuild

Hi RaphaelWu

Try this:
 
obj-m += test.o

$(warning Before-KBUILD_CFLAGS=$(KBUILD_CFLAGS))

KBUILD_CFLAGS := $(subst -pg,,$(KBUILD_CFLAGS))

$(warning After-KBUILD_CFLAGS=$(KBUILD_CFLAGS))

	Sam

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

* Re: how to echo $(KBUILD_CFLAGS)
@ 2015-08-21  1:08 RaphaelWu
  0 siblings, 0 replies; 9+ messages in thread
From: RaphaelWu @ 2015-08-21  1:08 UTC (permalink / raw)
  To: sam; +Cc: mmarek, linux-kbuild

Hi Sam

That exactly hits what I need. I'll dig more about kbuild makefile hooking out-of-tree
makefile. As marked by Michal before, it's not a completely kbuild makefile.

Again, thank you very much for your spare time.

Best regards
Raphael


>
> Hi RaphaelWu
>
> Try this:
>
> obj-m += test.o
>
> $(warning Before-KBUILD_CFLAGS=$(KBUILD_CFLAGS))
>
> KBUILD_CFLAGS := $(subst -pg,,$(KBUILD_CFLAGS))
>
> $(warning After-KBUILD_CFLAGS=$(KBUILD_CFLAGS))
>
>       Sam
The information transmitted in this e-mail is intended only for the addressee and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please notify the sender immediately, and delete this e-mail and any attachments. Thank you.

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

end of thread, other threads:[~2015-08-21  1:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-20 11:03 how to echo $(KBUILD_CFLAGS) RaphaelWu
2015-08-20 11:34 ` Michal Marek
2015-08-20 17:19 ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2015-08-21  1:08 RaphaelWu
2015-08-20 12:04 RaphaelWu
2015-08-20 10:45 RaphaelWu
2015-08-20 10:49 ` Michal Marek
2015-08-20  2:03 RaphaelWu
2015-08-20  8:57 ` Michal Marek

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).