All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] Makefile: remove extra ifdef/endif of top Makefile
@ 2015-04-07  5:09 Masahiro Yamada
  2015-04-07 17:13 ` Yann E. MORIN
  2015-04-07 19:34 ` Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Masahiro Yamada @ 2015-04-07  5:09 UTC (permalink / raw)
  To: buildroot

The GNU make's origin function know undefined variable well,
so the outer ifdef/endif conditional checking is unneeded.

From `info make` documentation, origin will return

  `undefined'
     if VARIABLE was never defined.
  `command line'
     if VARIABLE was defined on the command line.
   ...

Therefore, $(origin V) will get a value anyway, killing ifdef/endif
is viable and safe.

Furthermore, I've checked the minimal requirements from the top
Makefile is GNU make 3.81, and that version of GNU make has support
of origin function well already, so now it's safe to kill the outer
conditional checking, without upgrading the minimal requirements.

Signed-off-by: Cheng Renquan <crq@kernel.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
[ Commit description is borrowed from Linux Kernel
  (commit b8b0618cf6fa) and adjusted for Buildroot ]
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v2:
  - Add more detailed explanation

 Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index d6426b3..9db52a8 100644
--- a/Makefile
+++ b/Makefile
@@ -184,10 +184,8 @@ endif
 
 # To put more focus on warnings, be less verbose as default
 # Use 'make V=1' to see the full commands
-ifdef V
-  ifeq ("$(origin V)", "command line")
-    KBUILD_VERBOSE = $(V)
-  endif
+ifeq ("$(origin V)", "command line")
+  KBUILD_VERBOSE = $(V)
 endif
 ifndef KBUILD_VERBOSE
   KBUILD_VERBOSE = 0
-- 
1.9.1

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

* [Buildroot] [PATCH v2] Makefile: remove extra ifdef/endif of top Makefile
  2015-04-07  5:09 [Buildroot] [PATCH v2] Makefile: remove extra ifdef/endif of top Makefile Masahiro Yamada
@ 2015-04-07 17:13 ` Yann E. MORIN
  2015-04-07 19:34 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2015-04-07 17:13 UTC (permalink / raw)
  To: buildroot

Masahiro, All,

On 2015-04-07 14:09 +0900, Masahiro Yamada spake thusly:
> The GNU make's origin function know undefined variable well,
> so the outer ifdef/endif conditional checking is unneeded.
> 
> From `info make` documentation, origin will return
> 
>   `undefined'
>      if VARIABLE was never defined.
>   `command line'
>      if VARIABLE was defined on the command line.
>    ...
> 
> Therefore, $(origin V) will get a value anyway, killing ifdef/endif
> is viable and safe.
> 
> Furthermore, I've checked the minimal requirements from the top
> Makefile is GNU make 3.81, and that version of GNU make has support
> of origin function well already, so now it's safe to kill the outer
> conditional checking, without upgrading the minimal requirements.
> 
> Signed-off-by: Cheng Renquan <crq@kernel.org>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> [ Commit description is borrowed from Linux Kernel
>   (commit b8b0618cf6fa) and adjusted for Buildroot ]
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
> 
> Changes in v2:
>   - Add more detailed explanation
> 
>  Makefile | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index d6426b3..9db52a8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -184,10 +184,8 @@ endif
>  
>  # To put more focus on warnings, be less verbose as default
>  # Use 'make V=1' to see the full commands
> -ifdef V
> -  ifeq ("$(origin V)", "command line")
> -    KBUILD_VERBOSE = $(V)
> -  endif
> +ifeq ("$(origin V)", "command line")
> +  KBUILD_VERBOSE = $(V)
>  endif
>  ifndef KBUILD_VERBOSE
>    KBUILD_VERBOSE = 0
> -- 
> 1.9.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH v2] Makefile: remove extra ifdef/endif of top Makefile
  2015-04-07  5:09 [Buildroot] [PATCH v2] Makefile: remove extra ifdef/endif of top Makefile Masahiro Yamada
  2015-04-07 17:13 ` Yann E. MORIN
@ 2015-04-07 19:34 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2015-04-07 19:34 UTC (permalink / raw)
  To: buildroot

Dear Masahiro Yamada,

On Tue,  7 Apr 2015 14:09:09 +0900, Masahiro Yamada wrote:
> The GNU make's origin function know undefined variable well,
> so the outer ifdef/endif conditional checking is unneeded.
> 
> From `info make` documentation, origin will return
> 
>   `undefined'
>      if VARIABLE was never defined.
>   `command line'
>      if VARIABLE was defined on the command line.
>    ...
> 
> Therefore, $(origin V) will get a value anyway, killing ifdef/endif
> is viable and safe.
> 
> Furthermore, I've checked the minimal requirements from the top
> Makefile is GNU make 3.81, and that version of GNU make has support
> of origin function well already, so now it's safe to kill the outer
> conditional checking, without upgrading the minimal requirements.
> 
> Signed-off-by: Cheng Renquan <crq@kernel.org>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> [ Commit description is borrowed from Linux Kernel
>   (commit b8b0618cf6fa) and adjusted for Buildroot ]
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Applied, thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2015-04-07 19:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07  5:09 [Buildroot] [PATCH v2] Makefile: remove extra ifdef/endif of top Makefile Masahiro Yamada
2015-04-07 17:13 ` Yann E. MORIN
2015-04-07 19:34 ` Thomas Petazzoni

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.