diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 4f5ff19b992b..f01f8c072852 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -56,6 +56,9 @@ endef | |||
56 | # gcc support functions | 56 | # gcc support functions |
57 | # See documentation in Documentation/kbuild/makefiles.txt | 57 | # See documentation in Documentation/kbuild/makefiles.txt |
58 | 58 | ||
59 | # output directory for tests below | ||
60 | TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) | ||
61 | |||
59 | # as-option | 62 | # as-option |
60 | # Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) | 63 | # Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) |
61 | 64 | ||
@@ -66,9 +69,11 @@ as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ | |||
66 | # as-instr | 69 | # as-instr |
67 | # Usage: cflags-y += $(call as-instr, instr, option1, option2) | 70 | # Usage: cflags-y += $(call as-instr, instr, option1, option2) |
68 | 71 | ||
69 | as-instr = $(shell if echo -e "$(1)" | $(AS) >/dev/null 2>&1 -W -Z -o astest$$$$.out ; \ | 72 | as-instr = $(shell if echo -e "$(1)" | \ |
70 | then echo "$(2)"; else echo "$(3)"; fi; \ | 73 | $(CC) $(AFLAGS) -c -xassembler - \ |
71 | rm -f astest$$$$.out) | 74 | -o $(TMPOUT)astest$$$$.out > /dev/null 2>&1; \ |
75 | then rm $(TMPOUT)astest$$$$.out; echo "$(2)"; \ | ||
76 | else echo "$(3)"; fi) | ||
72 | 77 | ||
73 | # cc-option | 78 | # cc-option |
74 | # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) | 79 | # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) |
@@ -97,10 +102,10 @@ cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ | |||
97 | 102 | ||
98 | # ld-option | 103 | # ld-option |
99 | # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) | 104 | # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) |
100 | ld-option = $(shell if $(CC) $(1) \ | 105 | ld-option = $(shell if $(CC) $(1) -nostdlib -xc /dev/null \ |
101 | -nostdlib -o ldtest$$$$.out -xc /dev/null \ | 106 | -o $(TMPOUT)ldtest$$$$.out > /dev/null 2>&1; \ |
102 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi; \ | 107 | then rm $(TMPOUT)ldtest$$$$.out; echo "$(1)"; \ |
103 | rm -f ldtest$$$$.out) | 108 | else echo "$(2)"; fi) |
104 | 109 | ||
105 | ### | 110 | ### |
106 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= | 111 | # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= |