Commit ecafda60 authored by Kusanagi Kouichi's avatar Kusanagi Kouichi Committed by Arnaldo Carvalho de Melo

perf tools: Fix build error on read only source.

Parts of the build process were generating files outside the specified
O= directory, causing the build to fail on systems where the sources are
in a read only file system.

Fix it by using $(OUTPUT) on these locations.

Also check that $(OUTPUT) actually exists, just like the top level
kernel Makefile does. Otherwise the failure message emitted is
completely misleading.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <20100817140841.0859362C03A@msa106.auone-net.jp>
Signed-off-by: default avatarKusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 033a273f
...@@ -5,6 +5,12 @@ endif ...@@ -5,6 +5,12 @@ endif
# The default target of this Makefile is... # The default target of this Makefile is...
all:: all::
ifneq ($(OUTPUT),)
# check that the output directory actually exists
OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd)
$(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist))
endif
# Define V=1 to have a more verbose compile. # Define V=1 to have a more verbose compile.
# Define V=2 to have an even more verbose compile. # Define V=2 to have an even more verbose compile.
# #
...@@ -931,15 +937,15 @@ $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) ...@@ -931,15 +937,15 @@ $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
$(QUIET_GEN)$(RM) $@ $@+ && \ $(QUIET_GEN)$(RM) $(OUTPUT)$@ $(OUTPUT)$@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \ -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
$@.sh >$@+ && \ $@.sh > $(OUTPUT)$@+ && \
chmod +x $@+ && \ chmod +x $(OUTPUT)$@+ && \
mv $@+ $(OUTPUT)$@ mv $(OUTPUT)$@+ $(OUTPUT)$@
configure: configure.ac configure: configure.ac
$(QUIET_GEN)$(RM) $@ $<+ && \ $(QUIET_GEN)$(RM) $@ $<+ && \
......
...@@ -113,7 +113,7 @@ endef ...@@ -113,7 +113,7 @@ endef
# try-cc # try-cc
# Usage: option = $(call try-cc, source-to-build, cc-options) # Usage: option = $(call try-cc, source-to-build, cc-options)
try-cc = $(shell sh -c \ try-cc = $(shell sh -c \
'TMP="$(TMPOUT).$$$$"; \ 'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \
echo "$(1)" | \ echo "$(1)" | \
$(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \ $(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \
rm -f "$$TMP"') rm -f "$$TMP"')
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