• Arnaldo Carvalho de Melo's avatar
    perf build: Address stray '\' before # that is warned about since grep 3.8 · b27778ed
    Arnaldo Carvalho de Melo authored
    To address this grep 3.8 warning:
    
      grep: warning: stray \ before #
    
    We needed to remove the '' around the grep expression and keep the \
    before # so that it is escaped by the $(shell grep ...) and thus doesn't
    get to grep.
    
    We need that \ before the #, otherwise we get this:
    
      Makefile.perf:364: *** unterminated call to function 'shell': missing ')'.  Stop.
    
    As everything after the # will be considered a comment.
    
    Removing the single quotes needs some more escaping so that _some_ of
    the escaped chars gets to grep, like the '\|' that becomes '\\\|´.
    
    Running on debian:10, where there is no libtraceevent-devel available,
    we get:
    
      Makefile.perf:367: *** PYTHON_EXT_SRCS= util/python.c ../lib/ctype.c util/cap.c util/evlist.c util/evsel.c util/evsel_fprintf.c util/perf_event_attr_fprintf.c util/cpumap.c util/memswap.c util/mmap.c util/namespaces.c ../lib/bitmap.c ../lib/find_bit.c ../lib/list_sort.c ../lib/hweight.c ../lib/string.c ../lib/vsprintf.c util/thread_map.c util/util.c util/cgroup.c util/parse-branch-options.c util/rblist.c util/counts.c util/print_binary.c util/strlist.c ../lib/rbtree.c util/string.c util/symbol_fprintf.c util/units.c util/affinity.c util/rwsem.c util/hashmap.c util/perf_regs.c util/fncache.c util/perf-regs-arch/perf_regs_aarch64.c util/perf-regs-arch/perf_regs_arm.c util/perf-regs-arch/perf_regs_csky.c util/perf-regs-arch/perf_regs_loongarch.c util/perf-regs-arch/perf_regs_mips.c util/perf-regs-arch/perf_regs_powerpc.c util/perf-regs-arch/perf_regs_riscv.c util/perf-regs-arch/perf_regs_s390.c util/perf-regs-arch/perf_regs_x86.c.  Stop.
      make[1]: *** [Makefile.perf:242: sub-make] Error 2
    
    I.e. both the comments and the util/trace-event.c were removed.
    
    When using:
    
    msg := $(error PYTHON_EXT_SRCS=$(PYTHON_EXT_SRCS))
    
    While on the more recent fedora:38, with the new grep and make packages
    and libtraceevent-devel installed:
    
      Makefile.perf:367: *** PYTHON_EXT_SRCS= util/python.c ../lib/ctype.c util/cap.c util/evlist.c util/evsel.c util/evsel_fprintf.c util/perf_event_attr_fprintf.c util/cpumap.c util/memswap.c util/mmap.c util/namespaces.c ../lib/bitmap.c ../lib/find_bit.c ../lib/list_sort.c ../lib/hweight.c ../lib/string.c ../lib/vsprintf.c util/thread_map.c util/util.c util/cgroup.c util/parse-branch-options.c util/rblist.c util/counts.c util/print_binary.c util/strlist.c util/trace-event.c ../lib/rbtree.c util/string.c util/symbol_fprintf.c util/units.c util/affinity.c util/rwsem.c util/hashmap.c util/perf_regs.c util/fncache.c util/perf-regs-arch/perf_regs_aarch64.c util/perf-regs-arch/perf_regs_arm.c util/perf-regs-arch/perf_regs_csky.c util/perf-regs-arch/perf_regs_loongarch.c util/perf-regs-arch/perf_regs_mips.c util/perf-regs-arch/perf_regs_powerpc.c util/perf-regs-arch/perf_regs_riscv.c util/perf-regs-arch/perf_regs_s390.c util/perf-regs-arch/perf_regs_x86.c.  Stop.
      make[1]: *** [Makefile.perf:242: sub-make] Error 2
      make: *** [Makefile:113: install-bin] Error 2
      make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'
      $
    
    I.e. only the comments were removed.
    
    If we build it on the same fedora:38 system, but using NO_LIBTRACEEVENT=1
    
      $ make NO_LIBTRACEEVENT=1 CORESIGHT=1 O=/tmp/build/$(basename $PWD) -C tools/perf install-bin
      Makefile.perf:367: *** PYTHON_EXT_SRCS= util/python.c ../lib/ctype.c util/cap.c util/evlist.c util/evsel.c util/evsel_fprintf.c util/perf_event_attr_fprintf.c util/cpumap.c util/memswap.c util/mmap.c util/namespaces.c ../lib/bitmap.c ../lib/find_bit.c ../lib/list_sort.c ../lib/hweight.c ../lib/string.c ../lib/vsprintf.c util/thread_map.c util/util.c util/cgroup.c util/parse-branch-options.c util/rblist.c util/counts.c util/print_binary.c util/strlist.c ../lib/rbtree.c util/string.c util/symbol_fprintf.c util/units.c util/affinity.c util/rwsem.c util/hashmap.c util/perf_regs.c util/fncache.c util/perf-regs-arch/perf_regs_aarch64.c util/perf-regs-arch/perf_regs_arm.c util/perf-regs-arch/perf_regs_csky.c util/perf-regs-arch/perf_regs_loongarch.c util/perf-regs-arch/perf_regs_mips.c util/perf-regs-arch/perf_regs_powerpc.c util/perf-regs-arch/perf_regs_riscv.c util/perf-regs-arch/perf_regs_s390.c util/perf-regs-arch/perf_regs_x86.c.  Stop.
      make[1]: *** [Makefile.perf:242: sub-make] Error 2
      make: *** [Makefile:113: install-bin] Error 2
      make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'
      $
    
    Both comments and the util/trace-event.c file removed.
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Acked-by: default avatarIan Rogers <irogers@google.com>
    Link: https://lore.kernel.org/r/ZTj6mfM9UqY2DggC@kernel.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    b27778ed
Makefile.perf 41.6 KB