diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 41abb90df50..4f1fa77c1fe 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -5,6 +5,12 @@ endif | |||
5 | # The default target of this Makefile is... | 5 | # The default target of this Makefile is... |
6 | all:: | 6 | all:: |
7 | 7 | ||
8 | ifneq ($(OUTPUT),) | ||
9 | # check that the output directory actually exists | ||
10 | OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) | ||
11 | $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) | ||
12 | endif | ||
13 | |||
8 | # Define V=1 to have a more verbose compile. | 14 | # Define V=1 to have a more verbose compile. |
9 | # Define V=2 to have an even more verbose compile. | 15 | # Define V=2 to have an even more verbose compile. |
10 | # | 16 | # |
@@ -157,10 +163,6 @@ all:: | |||
157 | # | 163 | # |
158 | # Define NO_DWARF if you do not want debug-info analysis feature at all. | 164 | # Define NO_DWARF if you do not want debug-info analysis feature at all. |
159 | 165 | ||
160 | $(shell sh -c 'mkdir -p $(OUTPUT)scripts/{perl,python}/Perf-Trace-Util/' 2> /dev/null) | ||
161 | $(shell sh -c 'mkdir -p $(OUTPUT)util/{ui/browsers,scripting-engines}/' 2> /dev/null) | ||
162 | $(shell sh -c 'mkdir $(OUTPUT)bench' 2> /dev/null) | ||
163 | |||
164 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE | 166 | $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE |
165 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) | 167 | @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) |
166 | -include $(OUTPUT)PERF-VERSION-FILE | 168 | -include $(OUTPUT)PERF-VERSION-FILE |
@@ -186,8 +188,6 @@ ifeq ($(ARCH),x86_64) | |||
186 | ARCH := x86 | 188 | ARCH := x86 |
187 | endif | 189 | endif |
188 | 190 | ||
189 | $(shell sh -c 'mkdir -p $(OUTPUT)arch/$(ARCH)/util/' 2> /dev/null) | ||
190 | |||
191 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 191 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
192 | 192 | ||
193 | # | 193 | # |
@@ -268,6 +268,7 @@ export prefix bindir sharedir sysconfdir | |||
268 | CC = $(CROSS_COMPILE)gcc | 268 | CC = $(CROSS_COMPILE)gcc |
269 | AR = $(CROSS_COMPILE)ar | 269 | AR = $(CROSS_COMPILE)ar |
270 | RM = rm -f | 270 | RM = rm -f |
271 | MKDIR = mkdir | ||
271 | TAR = tar | 272 | TAR = tar |
272 | FIND = find | 273 | FIND = find |
273 | INSTALL = install | 274 | INSTALL = install |
@@ -838,6 +839,7 @@ ifndef V | |||
838 | QUIET_CC = @echo ' ' CC $@; | 839 | QUIET_CC = @echo ' ' CC $@; |
839 | QUIET_AR = @echo ' ' AR $@; | 840 | QUIET_AR = @echo ' ' AR $@; |
840 | QUIET_LINK = @echo ' ' LINK $@; | 841 | QUIET_LINK = @echo ' ' LINK $@; |
842 | QUIET_MKDIR = @echo ' ' MKDIR $@; | ||
841 | QUIET_BUILT_IN = @echo ' ' BUILTIN $@; | 843 | QUIET_BUILT_IN = @echo ' ' BUILTIN $@; |
842 | QUIET_GEN = @echo ' ' GEN $@; | 844 | QUIET_GEN = @echo ' ' GEN $@; |
843 | QUIET_SUBDIR0 = +@subdir= | 845 | QUIET_SUBDIR0 = +@subdir= |
@@ -935,15 +937,15 @@ $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) | |||
935 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ | 937 | $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ |
936 | 938 | ||
937 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh | 939 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh |
938 | $(QUIET_GEN)$(RM) $@ $@+ && \ | 940 | $(QUIET_GEN)$(RM) $(OUTPUT)$@ $(OUTPUT)$@+ && \ |
939 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ | 941 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ |
940 | -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ | 942 | -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ |
941 | -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ | 943 | -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ |
942 | -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ | 944 | -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ |
943 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ | 945 | -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ |
944 | $@.sh >$@+ && \ | 946 | $@.sh > $(OUTPUT)$@+ && \ |
945 | chmod +x $@+ && \ | 947 | chmod +x $(OUTPUT)$@+ && \ |
946 | mv $@+ $(OUTPUT)$@ | 948 | mv $(OUTPUT)$@+ $(OUTPUT)$@ |
947 | 949 | ||
948 | configure: configure.ac | 950 | configure: configure.ac |
949 | $(QUIET_GEN)$(RM) $@ $<+ && \ | 951 | $(QUIET_GEN)$(RM) $@ $<+ && \ |
@@ -1012,6 +1014,14 @@ $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) | |||
1012 | $(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) | 1014 | $(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h) |
1013 | builtin-revert.o wt-status.o: wt-status.h | 1015 | builtin-revert.o wt-status.o: wt-status.h |
1014 | 1016 | ||
1017 | # we compile into subdirectories. if the target directory is not the source directory, they might not exists. So | ||
1018 | # we depend the various files onto their directories. | ||
1019 | DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h | ||
1020 | $(DIRECTORY_DEPS): $(sort $(dir $(DIRECTORY_DEPS))) | ||
1021 | # In the second step, we make a rule to actually create these directories | ||
1022 | $(sort $(dir $(DIRECTORY_DEPS))): | ||
1023 | $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null | ||
1024 | |||
1015 | $(LIB_FILE): $(LIB_OBJS) | 1025 | $(LIB_FILE): $(LIB_OBJS) |
1016 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) | 1026 | $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) |
1017 | 1027 | ||