All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2] Makefile: remove BUILD_TAG from KBUILD_CFLAGS
@ 2016-02-10 20:36 Stephen Warren
  2016-02-10 22:12 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Warren @ 2016-02-10 20:36 UTC (permalink / raw)
  To: u-boot

From: Stephen Warren <swarren@nvidia.com>

If BUILD_TAG is part of KBUILD_CFLAGS, then any time the value changes,
all files get rebuilt. In a continuous integration environment, the value
will change every build. This wastes time, assuming that incremental
builds would otherwise occur.

To solve this, remove BUILD_TAG from KBUILD_CFLAGS and add it to CFLAGS
for just the one file that uses it. This does have the disadvantage that
if any other files want to use the flag, we'll need to duplicate this
custom CFLAGS setup logic. However, it seems unlikely we'll need this.

An alternative would be to add BUILD_TAG to the "local version" and remove
the special case code from display_options.c. However, that would affect
the format of the U-Boot signon message, which may negatively affect
people looking for specific data there. The approach of using
file-specific CFLAGS was suggested by Masahiro Yamada.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
v2: Set CFLAGS on display_options.c rather than modifying
scripts/setlocalversion to add BUILD_TAG to the local version.
---
 Makefile     | 4 ----
 lib/Makefile | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 42fad45afee1..2265b8995a7b 100644
--- a/Makefile
+++ b/Makefile
@@ -562,10 +562,6 @@ else
 KBUILD_CFLAGS	+= -O2
 endif
 
-ifdef BUILD_TAG
-KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
-endif
-
 KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
 KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks)
 
diff --git a/lib/Makefile b/lib/Makefile
index dd36f25b2a32..d4491b8319f5 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -67,7 +67,7 @@ obj-$(CONFIG_ADDR_MAP) += addr_map.o
 obj-y += hashtable.o
 obj-y += errno.o
 obj-y += display_options.o
-obj-$(CONFIG_BCH) += bch.o
+CFLAGS_display_options.o := $(if $(BUILD_TAG),-DBUILD_TAG='"$(BUILD_TAG)"')
 obj-y += crc32.o
 obj-y += ctype.o
 obj-y += div64.o
-- 
2.7.0

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

* [U-Boot] [PATCH V2] Makefile: remove BUILD_TAG from KBUILD_CFLAGS
  2016-02-10 20:36 [U-Boot] [PATCH V2] Makefile: remove BUILD_TAG from KBUILD_CFLAGS Stephen Warren
@ 2016-02-10 22:12 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2016-02-10 22:12 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 10, 2016 at 01:36:38PM -0700, Stephen Warren wrote:

[snip]
> diff --git a/lib/Makefile b/lib/Makefile
> index dd36f25b2a32..d4491b8319f5 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -67,7 +67,7 @@ obj-$(CONFIG_ADDR_MAP) += addr_map.o
>  obj-y += hashtable.o
>  obj-y += errno.o
>  obj-y += display_options.o
> -obj-$(CONFIG_BCH) += bch.o
> +CFLAGS_display_options.o := $(if $(BUILD_TAG),-DBUILD_TAG='"$(BUILD_TAG)"')
>  obj-y += crc32.o
>  obj-y += ctype.o
>  obj-y += div64.o

OK, clearly you didn't intend to remove bch.o :)

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160210/b22ff352/attachment.sig>

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

end of thread, other threads:[~2016-02-10 22:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-10 20:36 [U-Boot] [PATCH V2] Makefile: remove BUILD_TAG from KBUILD_CFLAGS Stephen Warren
2016-02-10 22:12 ` Tom Rini

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.