1FILES= \ 2 test-all.bin \ 3 test-backtrace.bin \ 4 test-bionic.bin \ 5 test-dwarf.bin \ 6 test-dwarf_getlocations.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-numa_num_possible_cpus.bin \ 23 test-libperl.bin \ 24 test-libpython.bin \ 25 test-libpython-version.bin \ 26 test-libslang.bin \ 27 test-libcrypto.bin \ 28 test-libunwind.bin \ 29 test-libunwind-debug-frame.bin \ 30 test-libunwind-x86.bin \ 31 test-libunwind-x86_64.bin \ 32 test-libunwind-arm.bin \ 33 test-libunwind-aarch64.bin \ 34 test-libunwind-debug-frame-arm.bin \ 35 test-libunwind-debug-frame-aarch64.bin \ 36 test-pthread-attr-setaffinity-np.bin \ 37 test-stackprotector-all.bin \ 38 test-timerfd.bin \ 39 test-libdw-dwarf-unwind.bin \ 40 test-libbabeltrace.bin \ 41 test-compile-32.bin \ 42 test-compile-x32.bin \ 43 test-zlib.bin \ 44 test-lzma.bin \ 45 test-bpf.bin \ 46 test-get_cpuid.bin 47 48FILES := $(addprefix $(OUTPUT),$(FILES)) 49 50CC := $(CROSS_COMPILE)gcc -MD 51PKG_CONFIG := $(CROSS_COMPILE)pkg-config 52 53all: $(FILES) 54 55__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS) 56 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1 57 58############################### 59 60$(OUTPUT)test-all.bin: 61 $(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 62 63$(OUTPUT)test-hello.bin: 64 $(BUILD) 65 66$(OUTPUT)test-pthread-attr-setaffinity-np.bin: 67 $(BUILD) -D_GNU_SOURCE -lpthread 68 69$(OUTPUT)test-stackprotector-all.bin: 70 $(BUILD) -fstack-protector-all 71 72$(OUTPUT)test-fortify-source.bin: 73 $(BUILD) -O2 -D_FORTIFY_SOURCE=2 74 75$(OUTPUT)test-bionic.bin: 76 $(BUILD) 77 78$(OUTPUT)test-libelf.bin: 79 $(BUILD) -lelf 80 81$(OUTPUT)test-glibc.bin: 82 $(BUILD) 83 84DWARFLIBS := -ldw 85ifeq ($(findstring -static,${LDFLAGS}),-static) 86DWARFLIBS += -lelf -lebl -lz -llzma -lbz2 87endif 88 89$(OUTPUT)test-dwarf.bin: 90 $(BUILD) $(DWARFLIBS) 91 92$(OUTPUT)test-dwarf_getlocations.bin: 93 $(BUILD) $(DWARFLIBS) 94 95$(OUTPUT)test-libelf-mmap.bin: 96 $(BUILD) -lelf 97 98$(OUTPUT)test-libelf-getphdrnum.bin: 99 $(BUILD) -lelf 100 101$(OUTPUT)test-libnuma.bin: 102 $(BUILD) -lnuma 103 104$(OUTPUT)test-numa_num_possible_cpus.bin: 105 $(BUILD) -lnuma 106 107$(OUTPUT)test-libunwind.bin: 108 $(BUILD) -lelf 109 110$(OUTPUT)test-libunwind-debug-frame.bin: 111 $(BUILD) -lelf 112$(OUTPUT)test-libunwind-x86.bin: 113 $(BUILD) -lelf -lunwind-x86 114 115$(OUTPUT)test-libunwind-x86_64.bin: 116 $(BUILD) -lelf -lunwind-x86_64 117 118$(OUTPUT)test-libunwind-arm.bin: 119 $(BUILD) -lelf -lunwind-arm 120 121$(OUTPUT)test-libunwind-aarch64.bin: 122 $(BUILD) -lelf -lunwind-aarch64 123 124$(OUTPUT)test-libunwind-debug-frame-arm.bin: 125 $(BUILD) -lelf -lunwind-arm 126 127$(OUTPUT)test-libunwind-debug-frame-aarch64.bin: 128 $(BUILD) -lelf -lunwind-aarch64 129 130$(OUTPUT)test-libaudit.bin: 131 $(BUILD) -laudit 132 133$(OUTPUT)test-libslang.bin: 134 $(BUILD) -I/usr/include/slang -lslang 135 136$(OUTPUT)test-libcrypto.bin: 137 $(BUILD) -lcrypto 138 139$(OUTPUT)test-gtk2.bin: 140 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) 141 142$(OUTPUT)test-gtk2-infobar.bin: 143 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) 144 145grep-libs = $(filter -l%,$(1)) 146strip-libs = $(filter-out -l%,$(1)) 147 148PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) 149PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) 150PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) 151PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` 152FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) 153 154$(OUTPUT)test-libperl.bin: 155 $(BUILD) $(FLAGS_PERL_EMBED) 156 157$(OUTPUT)test-libpython.bin: 158 $(BUILD) 159 160$(OUTPUT)test-libpython-version.bin: 161 $(BUILD) 162 163$(OUTPUT)test-libbfd.bin: 164 $(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl 165 166$(OUTPUT)test-liberty.bin: 167 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty 168 169$(OUTPUT)test-liberty-z.bin: 170 $(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz 171 172$(OUTPUT)test-cplus-demangle.bin: 173 $(BUILD) -liberty 174 175$(OUTPUT)test-backtrace.bin: 176 $(BUILD) 177 178$(OUTPUT)test-timerfd.bin: 179 $(BUILD) 180 181$(OUTPUT)test-libdw-dwarf-unwind.bin: 182 $(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind) 183 184$(OUTPUT)test-libbabeltrace.bin: 185 $(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace) 186 187$(OUTPUT)test-sync-compare-and-swap.bin: 188 $(BUILD) 189 190$(OUTPUT)test-compile-32.bin: 191 $(CC) -m32 -o $@ test-compile.c 192 193$(OUTPUT)test-compile-x32.bin: 194 $(CC) -mx32 -o $@ test-compile.c 195 196$(OUTPUT)test-zlib.bin: 197 $(BUILD) -lz 198 199$(OUTPUT)test-lzma.bin: 200 $(BUILD) -llzma 201 202$(OUTPUT)test-get_cpuid.bin: 203 $(BUILD) 204 205$(OUTPUT)test-bpf.bin: 206 $(BUILD) 207 208-include $(OUTPUT)*.d 209 210############################### 211 212clean: 213 rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output) 214