Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4184f11 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

kbuild: make $(checker-shell ) strip spaces around the result



It looks like GNU make version 3.80 (but apparently not 3.81) adds
leading whitespace to the result of the checker-shell execution.  This
strips them off explicitly.

Also, don't bother symlinking the output file to /dev/null.  It's likely
as expensive as just writing the temp-file, and we need to remove it
anyway afterwards.

Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 905adce4
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -60,17 +60,16 @@ endef
# Usage: option = $(call checker-shell,$(CC)...-o $$OUT,option-ok,otherwise)
# Usage: option = $(call checker-shell,$(CC)...-o $$OUT,option-ok,otherwise)
# Exit code chooses option. $$OUT is safe location for needless output.
# Exit code chooses option. $$OUT is safe location for needless output.
define checker-shell
define checker-shell
 $(strip
  $(shell set -e; \
  $(shell set -e; \
    DIR=$(KBUILD_EXTMOD); \
    DIR=$(KBUILD_EXTMOD); \
    cd $${DIR:-$(objtree)}; \
    cd $${DIR:-$(objtree)}; \
    OUT=$$PWD/.$$$$.null; \
    OUT=$$PWD/.$$$$.null; \
    \
    ln -s /dev/null $$OUT; \
    if $(1) >/dev/null 2>&1; \
    if $(1) >/dev/null 2>&1; \
      then echo "$(2)"; \
      then echo "$(2)"; \
      else echo "$(3)"; \
      else echo "$(3)"; \
    fi; \
    fi; \
    rm -f $$OUT)
    rm -f $$OUT))
endef
endef


# as-option
# as-option