Commit 347a00fb authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] kbuild: don't put temp files in source

The as-instr/ld-option need to create temporary files, but create them in the
output directory, when compiling external modules.  Reformat them a bit and
use $(CC) instead of $(AS) as the former is used by kbuild to assemble files.
Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Cc: Andi Kleen <ak@suse.de>
Cc: Jan Beulich <jbeulich@novell.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: <jpdenheijer@gmail.com>
Cc: Horst Schirmeier <horst@schirmeier.com>
Cc: Daniel Drake <dsd@gentoo.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 15964864
...@@ -56,6 +56,9 @@ endef ...@@ -56,6 +56,9 @@ endef
# gcc support functions # gcc support functions
# See documentation in Documentation/kbuild/makefiles.txt # See documentation in Documentation/kbuild/makefiles.txt
# output directory for tests below
TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
# as-option # as-option
# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) # Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,)
...@@ -66,9 +69,11 @@ as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ ...@@ -66,9 +69,11 @@ as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \
# as-instr # as-instr
# Usage: cflags-y += $(call as-instr, instr, option1, option2) # Usage: cflags-y += $(call as-instr, instr, option1, option2)
as-instr = $(shell if echo -e "$(1)" | $(AS) >/dev/null 2>&1 -W -Z -o astest$$$$.out ; \ as-instr = $(shell if echo -e "$(1)" | \
then echo "$(2)"; else echo "$(3)"; fi; \ $(CC) $(AFLAGS) -c -xassembler - \
rm -f astest$$$$.out) -o $(TMPOUT)astest$$$$.out > /dev/null 2>&1; \
then rm $(TMPOUT)astest$$$$.out; echo "$(2)"; \
else echo "$(3)"; fi)
# cc-option # cc-option
# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) # 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,10 +102,10 @@ cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \
# ld-option # ld-option
# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
ld-option = $(shell if $(CC) $(1) \ ld-option = $(shell if $(CC) $(1) -nostdlib -xc /dev/null \
-nostdlib -o ldtest$$$$.out -xc /dev/null \ -o $(TMPOUT)ldtest$$$$.out > /dev/null 2>&1; \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi; \ then rm $(TMPOUT)ldtest$$$$.out; echo "$(1)"; \
rm -f ldtest$$$$.out) else echo "$(2)"; fi)
### ###
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment