1 2FILES= \ 3 test-all.bin \ 4 test-backtrace.bin \ 5 test-bionic.bin \ 6 test-dwarf.bin \ 7 test-fortify-source.bin \ 8 test-sync-compare-and-swap.bin \ 9 test-glibc.bin \ 10 test-gtk2.bin \ 11 test-gtk2-infobar.bin \ 12 test-hello.bin \ 13 test-libaudit.bin \ 14 test-libbfd.bin \ 15 test-liberty.bin \ 16 test-liberty-z.bin \ 17 test-cplus-demangle.bin \ 18 test-libelf.bin \ 19 test-libelf-getphdrnum.bin \ 20 test-libelf-mmap.bin \ 21 test-libnuma.bin \ 22 test-libperl.bin \ 23 test-libpython.bin \ 24 test-libpython-version.bin \ 25 test-libslang.bin \ 26 test-libunwind.bin \ 27 test-libunwind-debug-frame.bin \ 28 test-pthread-attr-setaffinity-np.bin \ 29 test-stackprotector-all.bin \ 30 test-timerfd.bin \ 31 test-libdw-dwarf-unwind.bin \ 32 test-libbabeltrace.bin \ 33 test-compile-32.bin \ 34 test-compile-x32.bin \ 35 test-zlib.bin \ 36 test-lzma.bin 37 38CC := $(CROSS_COMPILE)gcc -MD 39PKG_CONFIG := $(CROSS_COMPILE)pkg-config 40 41all: $(FILES) 42 43__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS) 44 BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1 45 46############################### 47 48test-all.bin: 49 $(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -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 -lz -llzma 50 51test-hello.bin: 52 $(BUILD) 53 54test-pthread-attr-setaffinity-np.bin: 55 $(BUILD) -D_GNU_SOURCE -lpthread 56 57test-stackprotector-all.bin: 58 $(BUILD) -fstack-protector-all 59 60test-fortify-source.bin: 61 $(BUILD) -O2 -D_FORTIFY_SOURCE=2 62 63test-bionic.bin: 64 $(BUILD) 65 66test-libelf.bin: 67 $(BUILD) -lelf 68 69test-glibc.bin: 70 $(BUILD) 71 72test-dwarf.bin: 73 $(BUILD) -ldw 74 75test-libelf-mmap.bin: 76 $(BUILD) -lelf 77 78test-libelf-getphdrnum.bin: 79 $(BUILD) -lelf 80 81test-libnuma.bin: 82 $(BUILD) -lnuma 83 84test-libunwind.bin: 85 $(BUILD) -lelf 86 87test-libunwind-debug-frame.bin: 88 $(BUILD) -lelf 89 90test-libaudit.bin: 91 $(BUILD) -laudit 92 93test-libslang.bin: 94 $(BUILD) -I/usr/include/slang -lslang 95 96test-gtk2.bin: 97 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) 98 99test-gtk2-infobar.bin: 100 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) 101 102grep-libs = $(filter -l%,$(1)) 103strip-libs = $(filter-out -l%,$(1)) 104 105PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) 106PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) 107PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) 108PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` 109FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) 110 111test-libperl.bin: 112 $(BUILD) $(FLAGS_PERL_EMBED) 113 114test-libpython.bin: 115 $(BUILD) 116 117test-libpython-version.bin: 118 $(BUILD) 119 120test-libbfd.bin: 121 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl 122 123test-liberty.bin: 124 $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty 125 126test-liberty-z.bin: 127 $(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz 128 129test-cplus-demangle.bin: 130 $(BUILD) -liberty 131 132test-backtrace.bin: 133 $(BUILD) 134 135test-timerfd.bin: 136 $(BUILD) 137 138test-libdw-dwarf-unwind.bin: 139 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind) 140 141test-libbabeltrace.bin: 142 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace) 143 144test-sync-compare-and-swap.bin: 145 $(BUILD) 146 147test-compile-32.bin: 148 $(CC) -m32 -o $(OUTPUT)$@ test-compile.c 149 150test-compile-x32.bin: 151 $(CC) -mx32 -o $(OUTPUT)$@ test-compile.c 152 153test-zlib.bin: 154 $(BUILD) -lz 155 156test-lzma.bin: 157 $(BUILD) -llzma 158 159-include *.d 160 161############################### 162 163clean: 164 rm -f $(FILES) *.d $(FILES:.bin=.make.output) 165