All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Herton R. Krzesinski" <herton@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, vbabka@suse.cz, jforbes@redhat.com,
	dzickus@redhat.com, scweaver@redhat.com
Subject: Re: [PATCH] tools/vm: allow users to provide additional cflags/ldflags
Date: Wed, 18 Jan 2023 10:47:21 -0300	[thread overview]
Message-ID: <Y8f4aUx7P45qHlpl@localhost.localdomain> (raw)
In-Reply-To: <20230117165326.3e693a12a45a1962ca0c40af@linux-foundation.org>

On Tue, Jan 17, 2023 at 04:53:26PM -0800, Andrew Morton wrote:
> On Mon, 16 Jan 2023 19:49:21 -0300 "Herton R. Krzesinski" <herton@redhat.com> wrote:
> 
> > Right now there is no way to provide additional cflags/ldflags when
> > building tools/vm binaries. And using eg. make CFLAGS=<options> will
> > override the CFLAGS being set in the Makefile, making the build fail
> > since it requires the include of the ../lib dir (for libapi).
> > 
> > This change then allows you to specify:
> > CFLAGS=<options> LDFLAGS=<options> make V=1 -C tools/vm
> > 
> > And the options will be correctly appended as can be seen from the
> > make output.
> > 
> > ...
> >
> > --- a/tools/vm/Makefile
> > +++ b/tools/vm/Makefile
> > @@ -8,8 +8,8 @@ TARGETS=page-types slabinfo page_owner_sort
> >  LIB_DIR = ../lib/api
> >  LIBS = $(LIB_DIR)/libapi.a
> >  
> > -CFLAGS = -Wall -Wextra -I../lib/
> > -LDFLAGS = $(LIBS)
> > +CFLAGS += -Wall -Wextra -I../lib/
> > +LDFLAGS += $(LIBS)
> >  
> 
> I think EXTRA_CFLAGS is more conventional?
> 

I was looking and there is no standard under tools/

Some use it, some not. To given an example of what uses CFLAGS:
tools/arch/x86/kcpuid/Makefile:override CFLAGS += -O2 -Wall -I../../../include
tools/arch/x86/intel_sdsi/Makefile:override CFLAGS += -O2 -Wall
tools/iio/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
tools/thermal/tmon/Makefile:override CFLAGS += $(shell $(PKG_CONFIG) --cflags $(STATIC) panelw ncursesw 2> /dev/null || \
tools/gpio/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
tools/pci/Makefile:CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
tools/spi/Makefile:CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include
tools/wmi/Makefile:CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
tools/io_uring/Makefile:CFLAGS += -Wall -Wextra -g -D_GNU_SOURCE
tools/counter/Makefile:override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include

I can however use EXTRA_CFLAGS, not a problem, eg. doing instead:
CFLAGS = -Wall -Wextra -I../lib/ $(EXTRA_CFLAGS)
LDFLAGS = $(LIBS) $(EXTRA_LDFLAGS)

Let me know and I'll resend the patch using EXTRA_* instead.

-- 
[]'s
Herton


  reply	other threads:[~2023-01-18 14:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 22:49 [PATCH] tools/vm: allow users to provide additional cflags/ldflags Herton R. Krzesinski
2023-01-18  0:53 ` Andrew Morton
2023-01-18 13:47   ` Herton R. Krzesinski [this message]
2023-01-18 22:10     ` Andrew Morton

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=Y8f4aUx7P45qHlpl@localhost.localdomain \
    --to=herton@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dzickus@redhat.com \
    --cc=jforbes@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scweaver@redhat.com \
    --cc=vbabka@suse.cz \
    /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.