Commit b8b0618cf6fab3bd5b1da8c72f4b29847d81ac42

Authored by Cheng Renquan
Committed by Sam Ravnborg
1 parent 3e56f08bff

kbuild: remove extra ifdef/endif of top Makefile

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
Documentation/Changes is GNU make 3.79.1, 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>

Showing 1 changed file with 9 additions and 17 deletions Side-by-side Diff

... ... @@ -35,10 +35,8 @@
35 35 # To put more focus on warnings, be less verbose as default
36 36 # Use 'make V=1' to see the full commands
37 37  
38   -ifdef V
39   - ifeq ("$(origin V)", "command line")
40   - KBUILD_VERBOSE = $(V)
41   - endif
  38 +ifeq ("$(origin V)", "command line")
  39 + KBUILD_VERBOSE = $(V)
42 40 endif
43 41 ifndef KBUILD_VERBOSE
44 42 KBUILD_VERBOSE = 0
... ... @@ -54,10 +52,8 @@
54 52 # See the file "Documentation/sparse.txt" for more details, including
55 53 # where to get the "sparse" utility.
56 54  
57   -ifdef C
58   - ifeq ("$(origin C)", "command line")
59   - KBUILD_CHECKSRC = $(C)
60   - endif
  55 +ifeq ("$(origin C)", "command line")
  56 + KBUILD_CHECKSRC = $(C)
61 57 endif
62 58 ifndef KBUILD_CHECKSRC
63 59 KBUILD_CHECKSRC = 0
64 60  
... ... @@ -69,13 +65,11 @@
69 65 ifdef SUBDIRS
70 66 KBUILD_EXTMOD ?= $(SUBDIRS)
71 67 endif
72   -ifdef M
73   - ifeq ("$(origin M)", "command line")
74   - KBUILD_EXTMOD := $(M)
75   - endif
  68 +
  69 +ifeq ("$(origin M)", "command line")
  70 + KBUILD_EXTMOD := $(M)
76 71 endif
77 72  
78   -
79 73 # kbuild supports saving output files in a separate directory.
80 74 # To locate output files in a separate directory two syntaxes are supported.
81 75 # In both cases the working directory must be the root of the kernel src.
... ... @@ -98,10 +92,8 @@
98 92  
99 93 # OK, Make called in directory where kernel src resides
100 94 # Do we want to locate output files in a separate directory?
101   -ifdef O
102   - ifeq ("$(origin O)", "command line")
103   - KBUILD_OUTPUT := $(O)
104   - endif
  95 +ifeq ("$(origin O)", "command line")
  96 + KBUILD_OUTPUT := $(O)
105 97 endif
106 98  
107 99 # That's our default target when none is given on the command line