Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 1 | |
Ingo Molnar | 3ae069c | 2013-09-30 13:37:10 +0200 | [diff] [blame] | 2 | FILES= \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 3 | test-all \ |
| 4 | test-backtrace \ |
Ingo Molnar | 78e9d65 | 2013-09-30 14:11:46 +0200 | [diff] [blame] | 5 | test-bionic \ |
Ingo Molnar | 8295d4e | 2013-10-07 10:35:39 +0200 | [diff] [blame] | 6 | test-dwarf \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 7 | test-fortify-source \ |
| 8 | test-glibc \ |
Ingo Molnar | 7ef9e05 | 2013-09-30 15:01:56 +0200 | [diff] [blame] | 9 | test-gtk2 \ |
Ingo Molnar | c7a79e9 | 2013-09-30 15:08:30 +0200 | [diff] [blame] | 10 | test-gtk2-infobar \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 11 | test-hello \ |
| 12 | test-libaudit \ |
| 13 | test-libbfd \ |
Ingo Molnar | 1c47661 | 2013-10-02 15:15:09 +0200 | [diff] [blame] | 14 | test-liberty \ |
| 15 | test-liberty-z \ |
| 16 | test-cplus-demangle \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 17 | test-libelf \ |
| 18 | test-libelf-getphdrnum \ |
| 19 | test-libelf-mmap \ |
| 20 | test-libnuma \ |
Ingo Molnar | 7181a67 | 2013-09-30 15:15:36 +0200 | [diff] [blame] | 21 | test-libperl \ |
Ingo Molnar | 9734163 | 2013-09-30 15:18:37 +0200 | [diff] [blame] | 22 | test-libpython \ |
Ingo Molnar | 95d061c | 2013-09-30 15:40:04 +0200 | [diff] [blame] | 23 | test-libpython-version \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 24 | test-libslang \ |
| 25 | test-libunwind \ |
Linus Torvalds | f47671e | 2013-11-14 08:51:29 +0900 | [diff] [blame] | 26 | test-libunwind-debug-frame \ |
Ingo Molnar | 34ef216 | 2013-09-30 16:46:49 +0200 | [diff] [blame] | 27 | test-on-exit \ |
Ingo Molnar | f1138ec | 2013-10-02 09:54:43 +0200 | [diff] [blame] | 28 | test-stackprotector-all \ |
David Ahern | 87419c9 | 2013-10-29 10:43:16 -0600 | [diff] [blame] | 29 | test-stackprotector \ |
| 30 | test-timerfd |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 31 | |
Ingo Molnar | 8b6eb56 | 2013-09-30 13:51:28 +0200 | [diff] [blame] | 32 | CC := $(CC) -MD |
| 33 | |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 34 | all: $(FILES) |
| 35 | |
Adrian Hunter | 28e962b | 2013-11-01 15:51:31 +0200 | [diff] [blame] | 36 | BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 37 | |
| 38 | ############################### |
| 39 | |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 40 | test-all: |
Adrian Hunter | 8a0c4c2 | 2013-11-01 15:51:32 +0200 | [diff] [blame] | 41 | $(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 |
Ingo Molnar | baa9c30 | 2013-10-01 14:14:31 +0200 | [diff] [blame] | 42 | |
Ingo Molnar | 8b6eb56 | 2013-09-30 13:51:28 +0200 | [diff] [blame] | 43 | test-hello: |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 44 | $(BUILD) |
| 45 | |
Ingo Molnar | 90ac542 | 2013-09-30 13:48:44 +0200 | [diff] [blame] | 46 | test-stackprotector-all: |
| 47 | $(BUILD) -Werror -fstack-protector-all |
| 48 | |
Ingo Molnar | 430be5a | 2013-10-07 09:47:00 +0200 | [diff] [blame] | 49 | test-stackprotector: |
Ingo Molnar | 046fa7a | 2013-10-10 09:06:21 +0200 | [diff] [blame] | 50 | $(BUILD) -Werror -fstack-protector -Wstack-protector |
Ingo Molnar | 430be5a | 2013-10-07 09:47:00 +0200 | [diff] [blame] | 51 | |
Ingo Molnar | 1ea6f99 | 2013-10-07 09:38:28 +0200 | [diff] [blame] | 52 | test-fortify-source: |
| 53 | $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2 |
| 54 | |
Ingo Molnar | 78e9d65 | 2013-09-30 14:11:46 +0200 | [diff] [blame] | 55 | test-bionic: |
| 56 | $(BUILD) |
| 57 | |
Ingo Molnar | 8f7f800 | 2013-09-30 14:20:25 +0200 | [diff] [blame] | 58 | test-libelf: |
| 59 | $(BUILD) -lelf |
| 60 | |
Ingo Molnar | e12762c | 2013-10-07 10:34:20 +0200 | [diff] [blame] | 61 | test-glibc: |
| 62 | $(BUILD) |
| 63 | |
Ingo Molnar | 8295d4e | 2013-10-07 10:35:39 +0200 | [diff] [blame] | 64 | test-dwarf: |
| 65 | $(BUILD) -ldw |
| 66 | |
Ingo Molnar | 8869b17 | 2013-09-30 15:02:28 +0200 | [diff] [blame] | 67 | test-libelf-mmap: |
| 68 | $(BUILD) -lelf |
| 69 | |
Ingo Molnar | b7bcef6 | 2013-09-30 14:35:27 +0200 | [diff] [blame] | 70 | test-libelf-getphdrnum: |
| 71 | $(BUILD) -lelf |
| 72 | |
Ingo Molnar | 3ae069c | 2013-09-30 13:37:10 +0200 | [diff] [blame] | 73 | test-libnuma: |
| 74 | $(BUILD) -lnuma |
| 75 | |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 76 | test-libunwind: |
Adrian Hunter | 8a0c4c2 | 2013-11-01 15:51:32 +0200 | [diff] [blame] | 77 | $(BUILD) $(LIBUNWIND_LIBS) -lelf |
Ingo Molnar | 058f952 | 2013-09-30 14:45:44 +0200 | [diff] [blame] | 78 | |
Ingo Molnar | e310718 | 2013-11-14 08:25:24 +0100 | [diff] [blame] | 79 | test-libunwind-debug-frame: |
| 80 | $(BUILD) $(LIBUNWIND_LIBS) -lelf |
| 81 | |
Ingo Molnar | d795a65 | 2013-09-30 14:55:31 +0200 | [diff] [blame] | 82 | test-libaudit: |
| 83 | $(BUILD) -laudit |
| 84 | |
Ingo Molnar | b9498b5 | 2013-09-30 14:57:54 +0200 | [diff] [blame] | 85 | test-libslang: |
| 86 | $(BUILD) -I/usr/include/slang -lslang |
| 87 | |
Ingo Molnar | 7ef9e05 | 2013-09-30 15:01:56 +0200 | [diff] [blame] | 88 | test-gtk2: |
| 89 | $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) |
| 90 | |
Ingo Molnar | c7a79e9 | 2013-09-30 15:08:30 +0200 | [diff] [blame] | 91 | test-gtk2-infobar: |
| 92 | $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) |
| 93 | |
Ingo Molnar | 7181a67 | 2013-09-30 15:15:36 +0200 | [diff] [blame] | 94 | grep-libs = $(filter -l%,$(1)) |
| 95 | strip-libs = $(filter-out -l%,$(1)) |
| 96 | |
| 97 | PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) |
| 98 | PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) |
| 99 | PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) |
| 100 | PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` |
| 101 | FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) |
| 102 | |
| 103 | test-libperl: |
| 104 | $(BUILD) $(FLAGS_PERL_EMBED) |
| 105 | |
Ingo Molnar | 9734163 | 2013-09-30 15:18:37 +0200 | [diff] [blame] | 106 | override PYTHON := python |
| 107 | override PYTHON_CONFIG := python-config |
| 108 | |
| 109 | escape-for-shell-sq = $(subst ','\'',$(1)) |
| 110 | shell-sq = '$(escape-for-shell-sq)' |
| 111 | |
| 112 | PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG)) |
| 113 | |
| 114 | PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) |
| 115 | PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) |
| 116 | PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) |
| 117 | PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) |
| 118 | FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) |
| 119 | |
| 120 | test-libpython: |
| 121 | $(BUILD) $(FLAGS_PYTHON_EMBED) |
| 122 | |
Ingo Molnar | 95d061c | 2013-09-30 15:40:04 +0200 | [diff] [blame] | 123 | test-libpython-version: |
| 124 | $(BUILD) $(FLAGS_PYTHON_EMBED) |
| 125 | |
Ingo Molnar | 3b7646e | 2013-09-30 15:53:31 +0200 | [diff] [blame] | 126 | test-libbfd: |
Ingo Molnar | 0dc0974 | 2013-10-10 08:47:01 +0200 | [diff] [blame] | 127 | $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl |
Ingo Molnar | 3b7646e | 2013-09-30 15:53:31 +0200 | [diff] [blame] | 128 | |
Ingo Molnar | 1c47661 | 2013-10-02 15:15:09 +0200 | [diff] [blame] | 129 | test-liberty: |
Ingo Molnar | 0dc0974 | 2013-10-10 08:47:01 +0200 | [diff] [blame] | 130 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty |
Ingo Molnar | 1c47661 | 2013-10-02 15:15:09 +0200 | [diff] [blame] | 131 | |
| 132 | test-liberty-z: |
Ingo Molnar | 0dc0974 | 2013-10-10 08:47:01 +0200 | [diff] [blame] | 133 | $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz |
Ingo Molnar | 1c47661 | 2013-10-02 15:15:09 +0200 | [diff] [blame] | 134 | |
| 135 | test-cplus-demangle: |
| 136 | $(BUILD) -liberty |
| 137 | |
Ingo Molnar | 34ef216 | 2013-09-30 16:46:49 +0200 | [diff] [blame] | 138 | test-on-exit: |
| 139 | $(BUILD) |
| 140 | |
Ingo Molnar | 4cc9117 | 2013-09-30 16:49:38 +0200 | [diff] [blame] | 141 | test-backtrace: |
| 142 | $(BUILD) |
| 143 | |
David Ahern | 87419c9 | 2013-10-29 10:43:16 -0600 | [diff] [blame] | 144 | test-timerfd: |
| 145 | $(BUILD) |
| 146 | |
Ingo Molnar | 231486a | 2013-10-10 09:10:59 +0200 | [diff] [blame] | 147 | -include *.d |
Ingo Molnar | 8b6eb56 | 2013-09-30 13:51:28 +0200 | [diff] [blame] | 148 | |
Ingo Molnar | b6aa997 | 2013-09-30 10:08:24 +0200 | [diff] [blame] | 149 | ############################### |
| 150 | |
| 151 | clean: |
Ingo Molnar | 8b6eb56 | 2013-09-30 13:51:28 +0200 | [diff] [blame] | 152 | rm -f $(FILES) *.d |