summaryrefslogtreecommitdiffstats
path: root/scripts/Kbuild.include
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2009-09-19 10:31:45 +0200
committerSam Ravnborg <sam@ravnborg.org>2009-09-20 12:27:42 +0200
commit691ef3e7fdc1fe4dded169d9404f740987f67d66 (patch)
tree06e8842f0dd8bb015b678a96655e8c2f17baaaa5 /scripts/Kbuild.include
parentkbuild: rename ld-option to cc-ldoption (diff)
downloadlinux-691ef3e7fdc1fe4dded169d9404f740987f67d66.tar.xz
linux-691ef3e7fdc1fe4dded169d9404f740987f67d66.zip
kbuild: introduce ld-option
ld-option is used to check if $(LD) supports a specific option. Based on patch from Andi Kleen. Cc: Andi Kleen <ak@linux.intel.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> First use is to check if option -X is supported (upcoming patch). Theis is ne
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r--scripts/Kbuild.include8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 94a4f682f385..b3452601b0b1 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -83,11 +83,12 @@ TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
# is automatically cleaned up.
try-run = $(shell set -e; \
TMP="$(TMPOUT).$$$$.tmp"; \
+ TMPO="$(TMPOUT).$$$$.o"; \
if ($(1)) >/dev/null 2>&1; \
then echo "$(2)"; \
else echo "$(3)"; \
fi; \
- rm -f "$$TMP")
+ rm -f "$$TMP" "$$TMPO")
# as-option
# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
@@ -135,6 +136,11 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
cc-ldoption = $(call try-run,\
$(CC) $(1) -nostdlib -xc /dev/null -o "$$TMP",$(1),$(2))
+# ld-option
+# Usage: LDFLAGS += $(call ld-option, -X)
+ld-option = $(call try-run,\
+ $(CC) /dev/null -c -o "$$TMPO" ; $(LD) $(1) "$$TMPO" -o "$$TMP",$(1),$(2))
+
######
###