232 lines · 6.9 KB · Text
RawDownload
PERF := .MK   := Makefile include config/Makefile.arch # FIXME looks like x86 is the only arch running tests ;-)# we need some IS_(32/64) flag to make this genericifeq ($(ARCH)$(IS_64_BIT), x861)lib = lib64elselib = libendif has = $(shell which $1 2>/dev/null) # standard single make variable specifiedmake_clean_all      := clean allmake_python_perf_so := python/perf.somake_debug          := DEBUG=1make_no_libperl     := NO_LIBPERL=1make_no_libpython   := NO_LIBPYTHON=1make_no_scripts     := NO_LIBPYTHON=1 NO_LIBPERL=1make_no_newt        := NO_NEWT=1make_no_slang       := NO_SLANG=1make_no_gtk2        := NO_GTK2=1make_no_ui          := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1make_no_demangle    := NO_DEMANGLE=1make_no_libelf      := NO_LIBELF=1make_no_libunwind   := NO_LIBUNWIND=1make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1make_no_backtrace   := NO_BACKTRACE=1make_no_libnuma     := NO_LIBNUMA=1make_no_libaudit    := NO_LIBAUDIT=1make_no_libbionic   := NO_LIBBIONIC=1make_tags           := tagsmake_cscope         := cscopemake_help           := helpmake_doc            := docmake_perf_o           := perf.omake_util_map_o       := util/map.omake_util_pmu_bison_o := util/pmu-bison.omake_install        := installmake_install_bin    := install-binmake_install_doc    := install-docmake_install_man    := install-manmake_install_html   := install-htmlmake_install_info   := install-infomake_install_pdf    := install-pdfmake_static         := LDFLAGS=-static # all the NO_* variable combinedmake_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1make_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1make_minimal        += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1make_minimal        += NO_LIBDW_DWARF_UNWIND=1 # $(run) contains all available testsrun := make_purerun += make_clean_allrun += make_python_perf_sorun += make_debugrun += make_no_libperlrun += make_no_libpythonrun += make_no_scriptsrun += make_no_newtrun += make_no_slangrun += make_no_gtk2run += make_no_uirun += make_no_demanglerun += make_no_libelfrun += make_no_libunwindrun += make_no_libdw_dwarf_unwindrun += make_no_backtracerun += make_no_libnumarun += make_no_libauditrun += make_no_libbionicrun += make_helprun += make_docrun += make_perf_orun += make_util_map_orun += make_util_pmu_bison_orun += make_installrun += make_install_bin# FIXME 'install-*' commented out till they're fixed# run += make_install_doc# run += make_install_man# run += make_install_html# run += make_install_info# run += make_install_pdfrun += make_minimalrun += make_static ifneq ($(call has,ctags),)run += make_tagsendififneq ($(call has,cscope),)run += make_cscopeendif # $(run_O) contains same portion of $(run) tests with '_O' attached# to distinguish O=... testsrun_O := $(addsuffix _O,$(run)) # disable some tests for O=...run_O := $(filter-out make_python_perf_so_O,$(run_O)) # define test for each compile as 'test_NAME' variable# with the test itself as a valuetest_make_tags   = test -f tagstest_make_cscope = test -f cscope.out test_make_tags_O   := $(test_make_tags)test_make_cscope_O := $(test_make_cscope) test_ok          := truetest_make_help   := $(test_ok)test_make_doc    := $(test_ok)test_make_help_O := $(test_ok)test_make_doc_O  := $(test_ok) test_make_python_perf_so := test -f $(PERF)/python/perf.so test_make_perf_o           := test -f $(PERF)/perf.otest_make_util_map_o       := test -f $(PERF)/util/map.otest_make_util_pmu_bison_o := test -f $(PERF)/util/pmu-bison.o define test_dest_files  for file in $(1); do				\    if [ ! -x $$TMP_DEST/$$file ]; then		\      echo "  failed to find: $$file";		\    fi						\  doneendef installed_files_bin := bin/perfinstalled_files_bin += etc/bash_completion.d/perfinstalled_files_bin += libexec/perf-core/perf-archive installed_files_plugins := $(lib)/traceevent/plugins/plugin_cfg80211.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_scsi.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_xen.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_function.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_sched_switch.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_mac80211.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_kvm.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_kmem.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_hrtimer.soinstalled_files_plugins += $(lib)/traceevent/plugins/plugin_jbd2.so installed_files_all := $(installed_files_bin)installed_files_all += $(installed_files_plugins) test_make_install       := $(call test_dest_files,$(installed_files_all))test_make_install_O     := $(call test_dest_files,$(installed_files_all))test_make_install_bin   := $(call test_dest_files,$(installed_files_bin))test_make_install_bin_O := $(call test_dest_files,$(installed_files_bin)) # FIXME nothing gets installedtest_make_install_man    := test -f $$TMP_DEST/share/man/man1/perf.1test_make_install_man_O  := $(test_make_install_man) # FIXME nothing gets installedtest_make_install_doc    := $(test_ok)test_make_install_doc_O  := $(test_ok) # FIXME nothing gets installedtest_make_install_html   := $(test_ok)test_make_install_html_O := $(test_ok) # FIXME nothing gets installedtest_make_install_info   := $(test_ok)test_make_install_info_O := $(test_ok) # FIXME nothing gets installedtest_make_install_pdf    := $(test_ok)test_make_install_pdf_O  := $(test_ok) test_make_python_perf_so_O    := test -f $$TMP_O/python/perf.sotest_make_perf_o_O            := test -f $$TMP_O/perf.otest_make_util_map_o_O        := test -f $$TMP_O/util/map.otest_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o test_default = test -x $(PERF)/perftest = $(if $(test_$1),$(test_$1),$(test_default)) test_default_O = test -x $$TMP_O/perftest_O = $(if $(test_$1),$(test_$1),$(test_default_O)) all: ifdef DEBUGd := $(info run   $(run))d := $(info run_O $(run_O))endif MAKEFLAGS := --no-print-directory clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) $(run):	$(call clean)	@TMP_DEST=$$(mktemp -d); \	cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \	echo "- $@: $$cmd" && echo $$cmd > $@ && \	( eval $$cmd ) >> $@ 2>&1; \	echo "  test: $(call test,$@)" >> $@ 2>&1; \	$(call test,$@) && \	rm -rf $@ $$TMP_DEST || (cat $@ ; false) $(run_O):	$(call clean)	@TMP_O=$$(mktemp -d); \	TMP_DEST=$$(mktemp -d); \	cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \	echo "- $@: $$cmd" && echo $$cmd > $@ && \	( eval $$cmd ) >> $@ 2>&1 && \	echo "  test: $(call test_O,$@)" >> $@ 2>&1; \	$(call test_O,$@) && \	rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false) tarpkg:	@cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \	echo "- $@: $$cmd" && echo $$cmd > $@ && \	( eval $$cmd ) >> $@ 2>&1 all: $(run) $(run_O) tarpkg	@echo OK out: $(run_O)	@echo OK .PHONY: all $(run) $(run_O) tarpkg clean