perf tools: Fix libunwind build and feature detection for 32-bit build
[firefly-linux-kernel-4.4.55.git] / tools / perf / config / feature-checks / Makefile
index 4b855e0ccd0b74ccee2f261346308be2f4214224..d37d58d273fec8b440f2e172021a03279aa1502c 100644 (file)
@@ -1,39 +1,42 @@
 
 FILES=                                 \
-       test-hello                      \
-       test-stackprotector-all         \
-       test-stackprotector             \
-       test-volatile-register-var      \
-       test-fortify-source             \
+       test-all                        \
+       test-backtrace                  \
        test-bionic                     \
-       test-libelf                     \
-       test-glibc                      \
        test-dwarf                      \
-       test-libelf-mmap                \
-       test-libelf-getphdrnum          \
-       test-libunwind                  \
-       test-libaudit                   \
-       test-libslang                   \
+       test-fortify-source             \
+       test-glibc                      \
        test-gtk2                       \
        test-gtk2-infobar               \
+       test-hello                      \
+       test-libaudit                   \
+       test-libbfd                     \
+       test-liberty                    \
+       test-liberty-z                  \
+       test-cplus-demangle             \
+       test-libelf                     \
+       test-libelf-getphdrnum          \
+       test-libelf-mmap                \
+       test-libnuma                    \
        test-libperl                    \
        test-libpython                  \
        test-libpython-version          \
-       test-libbfd                     \
+       test-libslang                   \
+       test-libunwind                  \
        test-on-exit                    \
-       test-backtrace                  \
-       test-libnuma
+       test-stackprotector-all         \
+       test-stackprotector
 
 CC := $(CC) -MD
 
 all: $(FILES)
 
-BUILD = $(CC) -o $(OUTPUT)$@ $@.c
+BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c
 
 ###############################
 
 test-all:
-       $(BUILD) -Werror -fstack-protector -fstack-protector-all -Wvolatile-register-var -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lunwind -lunwind-x86_64 -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl
+       $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl
 
 test-hello:
        $(BUILD)
@@ -42,10 +45,7 @@ test-stackprotector-all:
        $(BUILD) -Werror -fstack-protector-all
 
 test-stackprotector:
-       $(BUILD) -Werror -fstack-protector
-
-test-volatile-register-var:
-       $(BUILD) -Werror -Wvolatile-register-var
+       $(BUILD) -Werror -fstack-protector -Wstack-protector
 
 test-fortify-source:
        $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2
@@ -72,7 +72,7 @@ test-libnuma:
        $(BUILD) -lnuma
 
 test-libunwind:
-       $(BUILD) -lunwind -lunwind-x86_64 -lelf
+       $(BUILD) $(LIBUNWIND_LIBS) -lelf
 
 test-libaudit:
        $(BUILD) -laudit
@@ -119,7 +119,16 @@ test-libpython-version:
        $(BUILD) $(FLAGS_PYTHON_EMBED)
 
 test-libbfd:
-       $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl
+       $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl
+
+test-liberty:
+       $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
+
+test-liberty-z:
+       $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
+
+test-cplus-demangle:
+       $(BUILD) -liberty
 
 test-on-exit:
        $(BUILD)
@@ -127,7 +136,7 @@ test-on-exit:
 test-backtrace:
        $(BUILD)
 
--include *.d */*.d
+-include *.d
 
 ###############################