Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Makefile: Remove various and sundry cruft

This commit squashes several commits that remove:

unnecessary uname calls
`sh -c'
BUILT_INS and QUIET_BUILT_IN

They have no effect, and the `fixup-builtins' and `check-builtins.sh'
scripts don't even exist.

RUNTIME_PREFIX

It's currently never anything but unset, and it's apparently
only meaningful when Microsoft Windows is the operating system
(according to the source for git).

TEST_PROGRAMS
EXTRA_PROGRAMS
unused SHELL_PATH_SQ portions
unused test for V=2
useless exports

Only when `V' is undefined (that is, only when the value of `V'
is empty) is `export V' performed, which just has the effect of
placing the empty-valued variable `V' in the environment.

The only other script to make use of `V' is `Documentation/Makefile',
which only checks whether `V' is undefined (that is, whether the value
of `V' is empty); hence, the `export V' has no effect whatsoever.

Similarly, `export QUIET_GEN' is useless because it will only have
a non-empty value when `V' has an empty-value, and when `V' has
an empty-value, `QUIET_GEN' is always explicitly set in every
script in which it is used.

`DESTDIR' is only ever defined by the user via the environment
or the command line, both of which are automatically exported
to sub-make processes. Furthermore, no non-make sub-scripts
make use of `DESTDIR' as an environment variable.

No other scripts use `perfexec_instdir'.

unused QUIET_SUBDIR{0,1}
TAR and RPMBUILD
PTHREAD_LIBS
Maintainer's dist rules and commands
distclean target
Test suite coverage testing
PRINT_DIR and NO_SUBDIR
`configure' target
NO_CURL
@@PERF_VERSION@@ substitution

Without the sed command, all of the rule's commands can be reduced
to a single line that copies a file and sets the permissions properly
in the process.

`make test' echo line
template_instdir
PERF-BUILD-OPTIONS
double-colon rules

The use of double-colon rules seems misguided or vestigial git.

Essentially hard-coded $(SCRIPTS) expansion

Signed-off-by: Michael Witten <mfwitten@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Michael Witten and committed by
Arnaldo Carvalho de Melo
a3d1ee10 0a54fb63

+10 -223
-1
tools/perf/.gitignore
··· 1 - PERF-BUILD-OPTIONS 2 1 PERF-CFLAGS 3 2 PERF-GUI-VARS 4 3 PERF-VERSION-FILE
+10 -203
tools/perf/Makefile
··· 3 3 endif 4 4 5 5 # The default target of this Makefile is... 6 - all:: 6 + all: 7 7 8 8 ifneq ($(OUTPUT),) 9 9 # check that the output directory actually exists ··· 11 11 $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) 12 12 endif 13 13 14 - # Define V=1 to have a more verbose compile. 15 - # Define V=2 to have an even more verbose compile. 14 + # Define V to have a more verbose compile. 16 15 # 17 16 # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8 18 17 # ··· 27 28 @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) 28 29 -include $(OUTPUT)PERF-VERSION-FILE 29 30 30 - uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') 31 - uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') 32 - uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') 33 - uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') 34 - uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') 35 - uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') 31 + uname_M := $(shell uname -m 2>/dev/null || echo not) 36 32 37 33 ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ 38 34 -e s/arm.*/arm/ -e s/sa110/arm/ \ ··· 45 51 ARCH_CFLAGS := -DARCH_X86_64 46 52 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S 47 53 endif 48 - 49 - # CFLAGS and LDFLAGS are for the users to override from the command line. 50 54 51 55 # 52 56 # Include saner warnings here, which can catch bugs: ··· 123 131 AR = $(CROSS_COMPILE)ar 124 132 RM = rm -f 125 133 MKDIR = mkdir 126 - TAR = tar 127 134 FIND = find 128 135 INSTALL = install 129 - RPMBUILD = rpmbuild 130 - PTHREAD_LIBS = -lpthread 131 136 132 137 # sparse is architecture-neutral, which means that we need to tell it 133 138 # explicitly what architecture to check for. Fix this up for yours.. 134 139 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ 135 - 136 - ifeq ($(V), 2) 137 - QUIET_STDERR = ">/dev/null" 138 - else 139 - QUIET_STDERR = ">/dev/null 2>&1" 140 - endif 141 140 142 141 -include feature-tests.mak 143 142 ··· 154 171 155 172 # Guard against environment variables 156 173 BUILTIN_OBJS = 157 - BUILT_INS = 158 174 LIB_H = 159 175 LIB_OBJS = 160 176 PYRF_OBJS = 161 177 SCRIPT_SH = 162 - TEST_PROGRAMS = 163 178 164 179 SCRIPT_SH += perf-archive.sh 165 180 ··· 173 192 174 193 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) 175 194 176 - # Empty... 177 - EXTRA_PROGRAMS = 178 - 179 - # ... and all the rest that could be moved out of bindir to perfexecdir 180 - PROGRAMS += $(EXTRA_PROGRAMS) 181 - 182 195 # 183 196 # Single 'perf' binary right now: 184 197 # 185 198 PROGRAMS += $(OUTPUT)perf 186 199 187 200 LANG_BINDINGS = 188 - 189 - # List built-in command $C whose implementation cmd_$C() is not in 190 - # builtin-$C.o but is linked in as part of some other command. 191 - # 192 201 193 202 # what 'all' will build and 'install' will install, in perfexecdir 194 203 ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) ··· 536 565 endif 537 566 endif 538 567 539 - ifdef RUNTIME_PREFIX 540 - COMPAT_CFLAGS += -DRUNTIME_PREFIX 541 - endif 542 - 543 - QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir 544 - QUIET_SUBDIR1 = 545 - 546 - ifneq ($(findstring $(MAKEFLAGS),w),w) 547 - PRINT_DIR = --no-print-directory 548 - else # "make -w" 549 - NO_SUBDIR = : 550 - endif 551 - 552 568 ifneq ($(findstring $(MAKEFLAGS),s),s) 553 569 ifndef V 554 570 QUIET_CC = @echo ' ' CC $@; 555 571 QUIET_AR = @echo ' ' AR $@; 556 572 QUIET_LINK = @echo ' ' LINK $@; 557 573 QUIET_MKDIR = @echo ' ' MKDIR $@; 558 - QUIET_BUILT_IN = @echo ' ' BUILTIN $@; 559 574 QUIET_GEN = @echo ' ' GEN $@; 560 - QUIET_SUBDIR0 = +@subdir= 561 - QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ 562 - $(MAKE) $(PRINT_DIR) -C $$subdir 563 - export V 564 - export QUIET_GEN 565 - export QUIET_BUILT_IN 566 575 endif 567 576 endif 568 577 ··· 572 621 ALL_CFLAGS += $(ARCH_CFLAGS) 573 622 ALL_LDFLAGS += $(BASIC_LDFLAGS) 574 623 575 - export TAR INSTALL DESTDIR SHELL_PATH 624 + export INSTALL SHELL_PATH 576 625 577 626 578 627 ### Build rules 579 628 580 629 SHELL = $(SHELL_PATH) 581 630 582 - all:: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(BUILT_INS) $(OTHER_PROGRAMS) $(OUTPUT)PERF-BUILD-OPTIONS 583 - 584 - all:: 631 + all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) 585 632 586 633 please_set_SHELL_PATH_to_a_more_modern_shell: 587 634 @$$(:) ··· 610 661 '-DPERF_MAN_PATH="$(mandir_SQ)"' \ 611 662 '-DPERF_INFO_PATH="$(infodir_SQ)"' $< 612 663 613 - $(BUILT_INS): $(OUTPUT)perf$X 614 - $(QUIET_BUILT_IN)$(RM) $@ && \ 615 - ln perf$X $@ 2>/dev/null || \ 616 - ln -s perf$X $@ 2>/dev/null || \ 617 - cp perf$X $@ 618 - 619 664 $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt 620 665 621 666 $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) 622 667 $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ 623 668 624 - $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh 625 - $(QUIET_GEN)$(RM) $(OUTPUT)$@ $(OUTPUT)$@+ && \ 626 - sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ 627 - -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ 628 - -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ 629 - -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ 630 - $@.sh > $(OUTPUT)$@+ && \ 631 - chmod +x $(OUTPUT)$@+ && \ 632 - mv $(OUTPUT)$@+ $(OUTPUT)$@ 633 - 634 - configure: configure.ac 635 - $(QUIET_GEN)$(RM) $@ $<+ && \ 636 - sed -e 's/@@PERF_VERSION@@/$(PERF_VERSION)/g' \ 637 - $< > $<+ && \ 638 - autoconf -o $@ $<+ && \ 639 - $(RM) $<+ 669 + $(SCRIPTS) : % : %.sh 670 + $(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@' 640 671 641 672 # These can record PERF_VERSION 642 673 $(OUTPUT)perf.o perf.spec \ 643 - $(patsubst %.sh,%,$(SCRIPT_SH)) \ 674 + $(SCRIPTS) \ 644 675 : $(OUTPUT)PERF-VERSION-FILE 645 676 646 677 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS ··· 755 826 echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \ 756 827 fi 757 828 758 - # We need to apply sq twice, once to protect from the shell 759 - # that runs $(OUTPUT)PERF-BUILD-OPTIONS, and then again to protect it 760 - # and the first level quoting from the shell that runs "echo". 761 - $(OUTPUT)PERF-BUILD-OPTIONS: .FORCE-PERF-BUILD-OPTIONS 762 - @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@ 763 - @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@ 764 - @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@ 765 - 766 829 ### Testing rules 767 - 768 - # 769 - # None right now: 770 - # 771 - # TEST_PROGRAMS += test-something$X 772 - 773 - all:: $(TEST_PROGRAMS) 774 830 775 831 # GNU make supports exporting all variables by "export" without parameters. 776 832 # However, the environment gets quite big, and some programs have problems ··· 769 855 sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ 770 856 done; \ 771 857 else \ 772 - echo 2>&1 "Did you mean 'make test'?"; \ 773 858 exit 1; \ 774 859 fi 775 860 776 - remove-dashes: 777 - ./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS) 778 - 779 861 ### Installation rules 780 - 781 - ifneq ($(filter /%,$(firstword $(template_dir))),) 782 - template_instdir = $(template_dir) 783 - else 784 - template_instdir = $(prefix)/$(template_dir) 785 - endif 786 - export template_instdir 787 862 788 863 ifneq ($(filter /%,$(firstword $(perfexecdir))),) 789 864 perfexec_instdir = $(perfexecdir) ··· 780 877 perfexec_instdir = $(prefix)/$(perfexecdir) 781 878 endif 782 879 perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) 783 - export perfexec_instdir 784 880 785 881 install: all 786 882 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' ··· 795 893 $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' 796 894 $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' 797 895 $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' 798 - 799 - ifdef BUILT_INS 800 - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 801 - $(INSTALL) $(BUILT_INS) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)' 802 - ifneq (,$X) 803 - $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) $(OUTPUT)perf$X)), $(RM) '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/$p';) 804 - endif 805 - endif 806 896 807 897 install-doc: 808 898 $(MAKE) -C Documentation install ··· 820 926 quick-install-html: 821 927 $(MAKE) -C Documentation quick-install-html 822 928 823 - 824 - ### Maintainer's dist rules 825 - # 826 - # None right now 827 - # 828 - # 829 - # perf.spec: perf.spec.in 830 - # sed -e 's/@@VERSION@@/$(PERF_VERSION)/g' < $< > $@+ 831 - # mv $@+ $@ 832 - # 833 - # PERF_TARNAME=perf-$(PERF_VERSION) 834 - # dist: perf.spec perf-archive$(X) configure 835 - # ./perf-archive --format=tar \ 836 - # --prefix=$(PERF_TARNAME)/ HEAD^{tree} > $(PERF_TARNAME).tar 837 - # @mkdir -p $(PERF_TARNAME) 838 - # @cp perf.spec configure $(PERF_TARNAME) 839 - # @echo $(PERF_VERSION) > $(PERF_TARNAME)/version 840 - # $(TAR) rf $(PERF_TARNAME).tar \ 841 - # $(PERF_TARNAME)/perf.spec \ 842 - # $(PERF_TARNAME)/configure \ 843 - # $(PERF_TARNAME)/version 844 - # @$(RM) -r $(PERF_TARNAME) 845 - # gzip -f -9 $(PERF_TARNAME).tar 846 - # 847 - # htmldocs = perf-htmldocs-$(PERF_VERSION) 848 - # manpages = perf-manpages-$(PERF_VERSION) 849 - # dist-doc: 850 - # $(RM) -r .doc-tmp-dir 851 - # mkdir .doc-tmp-dir 852 - # $(MAKE) -C Documentation WEBDOC_DEST=../.doc-tmp-dir install-webdoc 853 - # cd .doc-tmp-dir && $(TAR) cf ../$(htmldocs).tar . 854 - # gzip -n -9 -f $(htmldocs).tar 855 - # : 856 - # $(RM) -r .doc-tmp-dir 857 - # mkdir -p .doc-tmp-dir/man1 .doc-tmp-dir/man5 .doc-tmp-dir/man7 858 - # $(MAKE) -C Documentation DESTDIR=./ \ 859 - # man1dir=../.doc-tmp-dir/man1 \ 860 - # man5dir=../.doc-tmp-dir/man5 \ 861 - # man7dir=../.doc-tmp-dir/man7 \ 862 - # install 863 - # cd .doc-tmp-dir && $(TAR) cf ../$(manpages).tar . 864 - # gzip -n -9 -f $(manpages).tar 865 - # $(RM) -r .doc-tmp-dir 866 - # 867 - # rpm: dist 868 - # $(RPMBUILD) -ta $(PERF_TARNAME).tar.gz 869 - 870 929 ### Cleaning rules 871 - 872 - distclean: clean 873 - # $(RM) configure 874 930 875 931 clean: 876 932 $(RM) $(OUTPUT){*.o,*/*.o,*/*/*.o,*/*/*/*.o,$(LIB_FILE),perf-archive} 877 - $(RM) $(ALL_PROGRAMS) $(BUILT_INS) perf 878 - $(RM) $(TEST_PROGRAMS) 933 + $(RM) $(ALL_PROGRAMS) perf 879 934 $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* 880 - $(RM) -r $(PERF_TARNAME) .doc-tmp-dir 881 - $(RM) $(PERF_TARNAME).tar.gz perf-core_$(PERF_VERSION)-*.tar.gz 882 - $(RM) $(htmldocs).tar.gz $(manpages).tar.gz 883 935 $(MAKE) -C Documentation/ clean 884 - $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-BUILD-OPTIONS 936 + $(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS 885 937 @python util/setup.py clean --build-lib='$(OUTPUT)python' \ 886 938 --build-temp='$(OUTPUT)python/temp' 887 939 888 940 .PHONY: all install clean strip 889 941 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell 890 942 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS 891 - .PHONY: .FORCE-PERF-BUILD-OPTIONS 892 - 893 - ### Make sure built-ins do not have dups and listed in perf.c 894 - # 895 - check-builtins:: 896 - ./check-builtins.sh 897 - 898 - ### Test suite coverage testing 899 - # 900 - # None right now 901 - # 902 - # .PHONY: coverage coverage-clean coverage-build coverage-report 903 - # 904 - # coverage: 905 - # $(MAKE) coverage-build 906 - # $(MAKE) coverage-report 907 - # 908 - # coverage-clean: 909 - # rm -f *.gcda *.gcno 910 - # 911 - # COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs 912 - # COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov 913 - # 914 - # coverage-build: coverage-clean 915 - # $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all 916 - # $(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \ 917 - # -j1 test 918 - # 919 - # coverage-report: 920 - # gcov -b *.c */*.c 921 - # grep '^function.*called 0 ' *.c.gcov */*.c.gcov \ 922 - # | sed -e 's/\([^:]*\)\.gcov: *function \([^ ]*\) called.*/\1: \2/' \ 923 - # | tee coverage-untested-functions
-19
tools/perf/util/exec_cmd.c
··· 11 11 12 12 const char *system_path(const char *path) 13 13 { 14 - #ifdef RUNTIME_PREFIX 15 - static const char *prefix; 16 - #else 17 14 static const char *prefix = PREFIX; 18 - #endif 19 15 struct strbuf d = STRBUF_INIT; 20 16 21 17 if (is_absolute_path(path)) 22 18 return path; 23 - 24 - #ifdef RUNTIME_PREFIX 25 - assert(argv0_path); 26 - assert(is_absolute_path(argv0_path)); 27 - 28 - if (!prefix && 29 - !(prefix = strip_path_suffix(argv0_path, PERF_EXEC_PATH)) && 30 - !(prefix = strip_path_suffix(argv0_path, BINDIR)) && 31 - !(prefix = strip_path_suffix(argv0_path, "perf"))) { 32 - prefix = PREFIX; 33 - fprintf(stderr, "RUNTIME_PREFIX requested, " 34 - "but prefix computation failed. " 35 - "Using static fallback '%s'.\n", prefix); 36 - } 37 - #endif 38 19 39 20 strbuf_addf(&d, "%s/%s", prefix, path); 40 21 path = strbuf_detach(&d, NULL);