4 has = $(shell which $1 2>/dev/null)
6 # standard single make variable specified
7 make_clean_all := clean all
8 make_python_perf_so := python/perf.so
10 make_no_libperl := NO_LIBPERL=1
11 make_no_libpython := NO_LIBPYTHON=1
12 make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
13 make_no_newt := NO_NEWT=1
14 make_no_slang := NO_SLANG=1
15 make_no_gtk2 := NO_GTK2=1
16 make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
17 make_no_demangle := NO_DEMANGLE=1
18 make_no_libelf := NO_LIBELF=1
19 make_no_libunwind := NO_LIBUNWIND=1
20 make_no_backtrace := NO_BACKTRACE=1
21 make_no_libnuma := NO_LIBNUMA=1
22 make_no_libaudit := NO_LIBAUDIT=1
23 make_no_libbionic := NO_LIBBIONIC=1
29 make_util_map_o := util/map.o
30 make_install := install
31 make_install_bin := install-bin
32 make_install_doc := install-doc
33 make_install_man := install-man
34 make_install_html := install-html
35 make_install_info := install-info
36 make_install_pdf := install-pdf
38 # all the NO_* variable combined
39 make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
40 make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
41 make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
43 # $(run) contains all available tests
46 run += make_python_perf_so
48 run += make_no_libperl
49 run += make_no_libpython
50 run += make_no_scripts
55 run += make_no_demangle
57 run += make_no_libunwind
58 run += make_no_backtrace
59 run += make_no_libnuma
60 run += make_no_libaudit
61 run += make_no_libbionic
65 run += make_util_map_o
67 run += make_install_bin
68 # FIXME 'install-*' commented out till they're fixed
69 # run += make_install_doc
70 # run += make_install_man
71 # run += make_install_html
72 # run += make_install_info
73 # run += make_install_pdf
76 ifneq ($(call has,ctags),)
79 ifneq ($(call has,cscope),)
83 # $(run_O) contains same portion of $(run) tests with '_O' attached
84 # to distinguish O=... tests
85 run_O := $(addsuffix _O,$(run))
87 # disable some tests for O=...
88 run_O := $(filter-out make_python_perf_so_O,$(run_O))
90 # define test for each compile as 'test_NAME' variable
91 # with the test itself as a value
92 test_make_tags = test -f tags
93 test_make_cscope = test -f cscope.out
95 test_make_tags_O := $(test_make_tags)
96 test_make_cscope_O := $(test_make_cscope)
99 test_make_help := $(test_ok)
100 test_make_doc := $(test_ok)
101 test_make_help_O := $(test_ok)
102 test_make_doc_O := $(test_ok)
104 test_make_python_perf_so := test -f $(PERF)/python/perf.so
106 test_make_perf_o := test -f $(PERF)/perf.o
107 test_make_util_map_o := test -f $(PERF)/util/map.o
109 define test_dest_files
110 for file in $(1); do \
111 if [ ! -x $$TMP_DEST/$$file ]; then \
112 echo " failed to find: $$file"; \
117 installed_files_bin := bin/perf
118 installed_files_bin += etc/bash_completion.d/perf
119 installed_files_bin += libexec/perf-core/perf-archive
121 installed_files_plugins := lib64/traceevent/plugins/plugin_cfg80211.so
122 installed_files_plugins += lib64/traceevent/plugins/plugin_scsi.so
123 installed_files_plugins += lib64/traceevent/plugins/plugin_xen.so
124 installed_files_plugins += lib64/traceevent/plugins/plugin_function.so
125 installed_files_plugins += lib64/traceevent/plugins/plugin_sched_switch.so
126 installed_files_plugins += lib64/traceevent/plugins/plugin_mac80211.so
127 installed_files_plugins += lib64/traceevent/plugins/plugin_kvm.so
128 installed_files_plugins += lib64/traceevent/plugins/plugin_kmem.so
129 installed_files_plugins += lib64/traceevent/plugins/plugin_hrtimer.so
130 installed_files_plugins += lib64/traceevent/plugins/plugin_jbd2.so
132 installed_files_all := $(installed_files_bin)
133 installed_files_all += $(installed_files_plugins)
135 test_make_install := $(call test_dest_files,$(installed_files_all))
136 test_make_install_O := $(call test_dest_files,$(installed_files_all))
137 test_make_install_bin := $(call test_dest_files,$(installed_files_bin))
138 test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin))
140 # FIXME nothing gets installed
141 test_make_install_man := test -f $$TMP_DEST/share/man/man1/perf.1
142 test_make_install_man_O := $(test_make_install_man)
144 # FIXME nothing gets installed
145 test_make_install_doc := $(test_ok)
146 test_make_install_doc_O := $(test_ok)
148 # FIXME nothing gets installed
149 test_make_install_html := $(test_ok)
150 test_make_install_html_O := $(test_ok)
152 # FIXME nothing gets installed
153 test_make_install_info := $(test_ok)
154 test_make_install_info_O := $(test_ok)
156 # FIXME nothing gets installed
157 test_make_install_pdf := $(test_ok)
158 test_make_install_pdf_O := $(test_ok)
161 #test_make_python_perf_so_O := test -f $$TMP/tools/perf/python/perf.so
162 #test_make_perf_o_O := test -f $$TMP/tools/perf/perf.o
163 #test_make_util_map_o_O := test -f $$TMP/tools/perf/util/map.o
165 test_make_perf_o_O := true
166 test_make_util_map_o_O := true
168 test_default = test -x $(PERF)/perf
169 test = $(if $(test_$1),$(test_$1),$(test_default))
171 test_default_O = test -x $$TMP_O/perf
172 test_O = $(if $(test_$1),$(test_$1),$(test_default_O))
177 d := $(info run $(run))
178 d := $(info run_O $(run_O))
181 MAKEFLAGS := --no-print-directory
183 clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null)
187 @TMP_DEST=$$(mktemp -d); \
188 cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \
189 echo "- $@: $$cmd" && echo $$cmd > $@ && \
190 ( eval $$cmd ) >> $@ 2>&1; \
191 echo " test: $(call test,$@)" >> $@ 2>&1; \
198 @TMP_O=$$(mktemp -d); \
199 TMP_DEST=$$(mktemp -d); \
200 cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
201 echo "- $@: $$cmd" && echo $$cmd > $@ && \
202 ( eval $$cmd ) >> $@ 2>&1 && \
203 echo " test: $(call test_O,$@)" >> $@ 2>&1; \
204 $(call test_O,$@) && \
215 .PHONY: all $(run) $(run_O) clean