Skip to content

Commit

Permalink
perf tools: Fix build error on read only source.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Kusanagi Kouichi <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
k7k7 authored and acmel committed Aug 18, 2010
1 parent 033a273 commit ecafda6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ endif
# The default target of this Makefile is...
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=2 to have an even more verbose compile.
#
Expand Down Expand Up @@ -931,15 +937,15 @@ $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
$(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@

$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
$(QUIET_GEN)$(RM) $@ $@+ && \
$(QUIET_GEN)$(RM) $(OUTPUT)$@ $(OUTPUT)$@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
$@.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $(OUTPUT)$@
$@.sh > $(OUTPUT)$@+ && \
chmod +x $(OUTPUT)$@+ && \
mv $(OUTPUT)$@+ $(OUTPUT)$@

configure: configure.ac
$(QUIET_GEN)$(RM) $@ $<+ && \
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/feature-tests.mak
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ endef
# try-cc
# Usage: option = $(call try-cc, source-to-build, cc-options)
try-cc = $(shell sh -c \
'TMP="$(TMPOUT).$$$$"; \
'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \
echo "$(1)" | \
$(CC) -x c - $(2) -o "$$TMP" > /dev/null 2>&1 && echo y; \
rm -f "$$TMP"')

0 comments on commit ecafda6

Please sign in to comment.