[U-Boot] [PATCH] Makefile: remove BUILD_TAG from KBUILD_CFLAGS

Stephen Warren
2016-02-09T01:32:14Z

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_FLAGS and add it to the end of
"local version".

This has other advantages too:
- The special case for BUILD_TAG in display_options.c can be removed.
- The version printed by the "version" command exactly matches what is
printed at boot.

Old sign-on message:
U-Boot 2016.03-rc1-00044-g4085db5e767b (Feb ...), Build: bar-bas

New sign-on message:
U-Boot 2016.03-rc1-00044-g4085db5e767b-bar-baz (Feb ...)

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
Makefile | 4 ----
lib/display_options.c | 4 ----
scripts/setlocalversion | 4 ++++
3 files changed, 4 insertions(+), 8 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/display_options.c b/lib/display_options.c
index 29343fc00e3f..5dcdf4e429af 100644
--- a/lib/display_options.c
+++ b/lib/display_options.c
@@ -15,11 +15,7 @@

int display_options (void)
{
-#if defined(BUILD_TAG)
- printf ("\n\n%s, Build: %s\n\n", version_string, BUILD_TAG);
-#else
printf ("\n\n%s\n\n", version_string);
-#endif
return 0;
}

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 63d91e22ed7c..4ef6603b5c27 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -171,4 +171,8 @@ else
fi
fi

+if test -n "${BUILD_TAG}"; then
+ res="$res-${BUILD_TAG}"
+fi
+
echo "$res"
--
2.7.0