diff mbox series

[4/4] kbuild: make LINUX_VERSION_CODE in <linux/version.h> more readable

Message ID 1546244651-10447-4-git-send-email-yamada.masahiro@socionext.com
State New
Headers show
Series [1/4] kbuild: remove redundant target cleaning on failure | expand

Commit Message

Masahiro Yamada Dec. 31, 2018, 8:24 a.m. UTC
Makefile does not need to calculate LINUX_VERSION_CODE.
Let's leave it to the preprocessor.

This commit changes include/generated/uapi/linux/version.h as follows:

Before:

  #define LINUX_VERSION_CODE 267264
  #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

After:

  #define LINUX_VERSION_CODE KERNEL_VERSION(4, 20, 0)
  #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

The latter is more human-readable in my opinion.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.7.4

Comments

Masahiro Yamada Jan. 3, 2019, 1:14 a.m. UTC | #1
On Mon, Dec 31, 2018 at 5:25 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>

> Makefile does not need to calculate LINUX_VERSION_CODE.

> Let's leave it to the preprocessor.

>

> This commit changes include/generated/uapi/linux/version.h as follows:

>

> Before:

>

>   #define LINUX_VERSION_CODE 267264

>   #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

>

> After:

>

>   #define LINUX_VERSION_CODE KERNEL_VERSION(4, 20, 0)

>   #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

>

> The latter is more human-readable in my opinion.

>

> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>



I retract this patch
because it would cause a build error.




> ---

>

>  Makefile | 3 +--

>  1 file changed, 1 insertion(+), 2 deletions(-)

>

> diff --git a/Makefile b/Makefile

> index 437d603..1ebf5ed 100644

> --- a/Makefile

> +++ b/Makefile

> @@ -1131,8 +1131,7 @@ define filechk_utsrelease.h

>  endef

>

>  define filechk_version.h

> -       echo \#define LINUX_VERSION_CODE $(shell                         \

> -       expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \

> +       echo '#define LINUX_VERSION_CODE KERNEL_VERSION($(VERSION), $(PATCHLEVEL), $(SUBLEVEL))'; \

>         echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'

>  endef

>

> --

> 2.7.4

>



-- 
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 437d603..1ebf5ed 100644
--- a/Makefile
+++ b/Makefile
@@ -1131,8 +1131,7 @@  define filechk_utsrelease.h
 endef
 
 define filechk_version.h
-	echo \#define LINUX_VERSION_CODE $(shell                         \
-	expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
+	echo '#define LINUX_VERSION_CODE KERNEL_VERSION($(VERSION), $(PATCHLEVEL), $(SUBLEVEL))'; \
 	echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'
 endef