[PATCH] kbuild: Add $(strip ...) before compare make variable with string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some of ifneq in Makefile.build works improperly:

 ifneq ($(a)$(b)$(c),)
 ...
 endif

Because some make vairable contains unintended spaces introduced by:

 a := $(x) $(y)

This commit adds $(strip ...) to some potentially buggy ifneq.

Signed-off-by: Wang Nan <pi3orama@xxxxxxx>
Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
Cc: Michal Marek <michal.lkml@xxxxxxxxxxx>
---
 scripts/Makefile.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 9fcbfac..b2bc0db 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -46,7 +46,7 @@ include $(kbuild-file)
 include scripts/Makefile.lib
 
 # Do not include host rules unless needed
-ifneq ($(hostprogs)$(hostcxxlibs-y)$(hostcxxlibs-m),)
+ifneq ($(strip $(hostprogs) $(hostcxxlibs-y) $(hostcxxlibs-m)),)
 include scripts/Makefile.host
 endif
 
@@ -55,7 +55,7 @@ $(warning kbuild: Makefile.build is included improperly)
 endif
 
 ifeq ($(need-modorder),)
-ifneq ($(obj-m),)
+ifneq ($(strip $(obj-m)),)
 $(warning $(patsubst %.o,'%.ko',$(obj-m)) will not be built even though obj-m is specified.)
 $(warning You cannot use subdir-y/m to visit a module Makefile. Use obj-y/m instead.)
 endif
@@ -512,7 +512,7 @@ obj-dirs := $(sort $(obj) $(patsubst %/,%, $(dir $(targets))))
 # If targets exist, their directories apparently exist. Skip mkdir.
 existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets))))
 obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs)))
-ifneq ($(obj-dirs),)
+ifneq ($(strip $(obj-dirs)),)
 $(shell mkdir -p $(obj-dirs))
 endif
 endif
-- 
2.7.4





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux