2017-11-01 15:07:57 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2016-12-04 21:42:53 +01:00
|
|
|
FILES= \
|
|
|
|
|
test-all.bin \
|
|
|
|
|
test-backtrace.bin \
|
|
|
|
|
test-bionic.bin \
|
|
|
|
|
test-dwarf.bin \
|
|
|
|
|
test-dwarf_getlocations.bin \
|
|
|
|
|
test-fortify-source.bin \
|
|
|
|
|
test-sync-compare-and-swap.bin \
|
2018-11-19 16:56:22 -03:00
|
|
|
test-get_current_dir_name.bin \
|
2016-12-04 21:42:53 +01:00
|
|
|
test-glibc.bin \
|
|
|
|
|
test-gtk2.bin \
|
|
|
|
|
test-gtk2-infobar.bin \
|
|
|
|
|
test-hello.bin \
|
|
|
|
|
test-libaudit.bin \
|
|
|
|
|
test-libbfd.bin \
|
2017-12-27 19:16:29 +00:00
|
|
|
test-disassembler-four-args.bin \
|
2018-07-10 14:43:05 -07:00
|
|
|
test-reallocarray.bin \
|
2016-12-04 21:42:53 +01:00
|
|
|
test-liberty.bin \
|
|
|
|
|
test-liberty-z.bin \
|
|
|
|
|
test-cplus-demangle.bin \
|
|
|
|
|
test-libelf.bin \
|
|
|
|
|
test-libelf-getphdrnum.bin \
|
|
|
|
|
test-libelf-gelf_getnote.bin \
|
|
|
|
|
test-libelf-getshdrstrndx.bin \
|
|
|
|
|
test-libelf-mmap.bin \
|
|
|
|
|
test-libnuma.bin \
|
|
|
|
|
test-numa_num_possible_cpus.bin \
|
|
|
|
|
test-libperl.bin \
|
|
|
|
|
test-libpython.bin \
|
|
|
|
|
test-libpython-version.bin \
|
|
|
|
|
test-libslang.bin \
|
|
|
|
|
test-libcrypto.bin \
|
|
|
|
|
test-libunwind.bin \
|
|
|
|
|
test-libunwind-debug-frame.bin \
|
|
|
|
|
test-libunwind-x86.bin \
|
|
|
|
|
test-libunwind-x86_64.bin \
|
|
|
|
|
test-libunwind-arm.bin \
|
|
|
|
|
test-libunwind-aarch64.bin \
|
|
|
|
|
test-libunwind-debug-frame-arm.bin \
|
|
|
|
|
test-libunwind-debug-frame-aarch64.bin \
|
|
|
|
|
test-pthread-attr-setaffinity-np.bin \
|
2017-12-05 10:14:42 -03:00
|
|
|
test-pthread-barrier.bin \
|
2016-12-04 21:42:53 +01:00
|
|
|
test-stackprotector-all.bin \
|
|
|
|
|
test-timerfd.bin \
|
|
|
|
|
test-libdw-dwarf-unwind.bin \
|
|
|
|
|
test-libbabeltrace.bin \
|
|
|
|
|
test-compile-32.bin \
|
|
|
|
|
test-compile-x32.bin \
|
|
|
|
|
test-zlib.bin \
|
|
|
|
|
test-lzma.bin \
|
|
|
|
|
test-bpf.bin \
|
|
|
|
|
test-get_cpuid.bin \
|
|
|
|
|
test-sdt.bin \
|
|
|
|
|
test-cxx.bin \
|
2017-03-02 12:55:49 -03:00
|
|
|
test-jvmti.bin \
|
2017-07-18 17:15:29 -03:00
|
|
|
test-sched_getcpu.bin \
|
2018-01-17 10:52:10 -07:00
|
|
|
test-setns.bin \
|
2018-03-07 16:50:19 +01:00
|
|
|
test-libopencsd.bin \
|
|
|
|
|
test-clang.bin \
|
|
|
|
|
test-llvm.bin \
|
|
|
|
|
test-llvm-version.bin
|
2013-09-30 10:08:24 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
FILES := $(addprefix $(OUTPUT),$(FILES))
|
|
|
|
|
|
2017-04-11 23:49:14 -07:00
|
|
|
CC ?= $(CROSS_COMPILE)gcc
|
|
|
|
|
CXX ?= $(CROSS_COMPILE)g++
|
|
|
|
|
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
|
2016-11-26 07:03:31 +00:00
|
|
|
LLVM_CONFIG ?= llvm-config
|
2013-09-30 13:51:28 +02:00
|
|
|
|
2013-09-30 10:08:24 +02:00
|
|
|
all: $(FILES)
|
|
|
|
|
|
2017-04-11 23:49:14 -07:00
|
|
|
__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
|
2015-12-15 09:39:32 -06:00
|
|
|
BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
|
2013-09-30 10:08:24 +02:00
|
|
|
|
2017-04-11 23:49:14 -07:00
|
|
|
__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
|
2016-09-26 07:26:56 +00:00
|
|
|
BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
|
|
|
|
|
|
2013-09-30 10:08:24 +02:00
|
|
|
###############################
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-all.bin:
|
2015-03-04 11:35:47 +01:00
|
|
|
$(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
|
2013-10-01 14:14:31 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-hello.bin:
|
2013-09-30 10:08:24 +02:00
|
|
|
$(BUILD)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
|
2015-02-28 10:16:27 +01:00
|
|
|
$(BUILD) -D_GNU_SOURCE -lpthread
|
2015-01-13 19:13:24 +05:30
|
|
|
|
2017-12-05 10:14:42 -03:00
|
|
|
$(OUTPUT)test-pthread-barrier.bin:
|
|
|
|
|
$(BUILD) -lpthread
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-stackprotector-all.bin:
|
2015-02-28 10:16:27 +01:00
|
|
|
$(BUILD) -fstack-protector-all
|
2013-09-30 13:48:44 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-fortify-source.bin:
|
2015-02-28 10:16:27 +01:00
|
|
|
$(BUILD) -O2 -D_FORTIFY_SOURCE=2
|
2013-10-07 09:38:28 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-bionic.bin:
|
2013-09-30 14:11:46 +02:00
|
|
|
$(BUILD)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libelf.bin:
|
2013-09-30 14:20:25 +02:00
|
|
|
$(BUILD) -lelf
|
|
|
|
|
|
2018-11-19 16:56:22 -03:00
|
|
|
$(OUTPUT)test-get_current_dir_name.bin:
|
|
|
|
|
$(BUILD)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-glibc.bin:
|
2013-10-07 10:34:20 +02:00
|
|
|
$(BUILD)
|
|
|
|
|
|
2017-03-02 12:55:49 -03:00
|
|
|
$(OUTPUT)test-sched_getcpu.bin:
|
|
|
|
|
$(BUILD)
|
|
|
|
|
|
2017-07-18 17:15:29 -03:00
|
|
|
$(OUTPUT)test-setns.bin:
|
|
|
|
|
$(BUILD)
|
|
|
|
|
|
2018-01-17 10:52:10 -07:00
|
|
|
$(OUTPUT)test-libopencsd.bin:
|
|
|
|
|
$(BUILD) # -lopencsd_c_api -lopencsd provided by
|
|
|
|
|
# $(FEATURE_CHECK_LDFLAGS-libopencsd)
|
|
|
|
|
|
2015-08-12 15:48:37 -07:00
|
|
|
DWARFLIBS := -ldw
|
|
|
|
|
ifeq ($(findstring -static,${LDFLAGS}),-static)
|
|
|
|
|
DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
|
|
|
|
|
endif
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-dwarf.bin:
|
2015-08-12 15:48:37 -07:00
|
|
|
$(BUILD) $(DWARFLIBS)
|
2013-10-07 10:35:39 +02:00
|
|
|
|
2016-04-05 11:33:41 -03:00
|
|
|
$(OUTPUT)test-dwarf_getlocations.bin:
|
|
|
|
|
$(BUILD) $(DWARFLIBS)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libelf-mmap.bin:
|
2013-09-30 15:02:28 +02:00
|
|
|
$(BUILD) -lelf
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libelf-getphdrnum.bin:
|
2013-09-30 14:35:27 +02:00
|
|
|
$(BUILD) -lelf
|
|
|
|
|
|
2016-07-12 12:19:09 -03:00
|
|
|
$(OUTPUT)test-libelf-gelf_getnote.bin:
|
|
|
|
|
$(BUILD) -lelf
|
|
|
|
|
|
2016-07-04 19:35:47 -03:00
|
|
|
$(OUTPUT)test-libelf-getshdrstrndx.bin:
|
|
|
|
|
$(BUILD) -lelf
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libnuma.bin:
|
2013-09-30 13:37:10 +02:00
|
|
|
$(BUILD) -lnuma
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-numa_num_possible_cpus.bin:
|
2015-09-17 12:20:28 -03:00
|
|
|
$(BUILD) -lnuma
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libunwind.bin:
|
2013-12-10 13:24:04 +01:00
|
|
|
$(BUILD) -lelf
|
2013-09-30 14:45:44 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libunwind-debug-frame.bin:
|
2013-12-10 13:24:04 +01:00
|
|
|
$(BUILD) -lelf
|
2016-05-10 07:40:31 +00:00
|
|
|
$(OUTPUT)test-libunwind-x86.bin:
|
|
|
|
|
$(BUILD) -lelf -lunwind-x86
|
|
|
|
|
|
|
|
|
|
$(OUTPUT)test-libunwind-x86_64.bin:
|
|
|
|
|
$(BUILD) -lelf -lunwind-x86_64
|
|
|
|
|
|
|
|
|
|
$(OUTPUT)test-libunwind-arm.bin:
|
|
|
|
|
$(BUILD) -lelf -lunwind-arm
|
|
|
|
|
|
|
|
|
|
$(OUTPUT)test-libunwind-aarch64.bin:
|
|
|
|
|
$(BUILD) -lelf -lunwind-aarch64
|
|
|
|
|
|
2016-05-10 07:40:32 +00:00
|
|
|
$(OUTPUT)test-libunwind-debug-frame-arm.bin:
|
|
|
|
|
$(BUILD) -lelf -lunwind-arm
|
|
|
|
|
|
|
|
|
|
$(OUTPUT)test-libunwind-debug-frame-aarch64.bin:
|
|
|
|
|
$(BUILD) -lelf -lunwind-aarch64
|
2013-11-14 08:25:24 +01:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libaudit.bin:
|
2013-09-30 14:55:31 +02:00
|
|
|
$(BUILD) -laudit
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libslang.bin:
|
2013-09-30 14:57:54 +02:00
|
|
|
$(BUILD) -I/usr/include/slang -lslang
|
|
|
|
|
|
2015-11-30 10:02:21 +01:00
|
|
|
$(OUTPUT)test-libcrypto.bin:
|
|
|
|
|
$(BUILD) -lcrypto
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-gtk2.bin:
|
2014-01-15 10:44:08 +00:00
|
|
|
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
|
2013-09-30 15:01:56 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-gtk2-infobar.bin:
|
2014-01-15 10:44:08 +00:00
|
|
|
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
|
2013-09-30 15:08:30 +02:00
|
|
|
|
2013-09-30 15:15:36 +02:00
|
|
|
grep-libs = $(filter -l%,$(1))
|
|
|
|
|
strip-libs = $(filter-out -l%,$(1))
|
|
|
|
|
|
|
|
|
|
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
|
|
|
|
|
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
|
|
|
|
|
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
|
|
|
|
|
PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
|
|
|
|
|
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libperl.bin:
|
2013-09-30 15:15:36 +02:00
|
|
|
$(BUILD) $(FLAGS_PERL_EMBED)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libpython.bin:
|
2017-04-11 23:49:13 -07:00
|
|
|
$(BUILD) $(FLAGS_PYTHON_EMBED)
|
2013-09-30 15:18:37 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libpython-version.bin:
|
2014-07-29 15:57:19 +09:00
|
|
|
$(BUILD)
|
2013-09-30 15:40:04 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libbfd.bin:
|
2014-01-11 11:42:51 -08:00
|
|
|
$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
|
2013-09-30 15:53:31 +02:00
|
|
|
|
2017-12-27 19:16:29 +00:00
|
|
|
$(OUTPUT)test-disassembler-four-args.bin:
|
2018-01-16 15:51:47 -08:00
|
|
|
$(BUILD) -DPACKAGE='"perf"' -lbfd -lopcodes
|
2017-12-27 19:16:29 +00:00
|
|
|
|
2018-07-10 14:43:05 -07:00
|
|
|
$(OUTPUT)test-reallocarray.bin:
|
|
|
|
|
$(BUILD)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-liberty.bin:
|
|
|
|
|
$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty
|
2013-10-02 15:15:09 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-liberty-z.bin:
|
|
|
|
|
$(CC) $(CFLAGS) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE='"perf"' $(LDFLAGS) -lbfd -ldl -liberty -lz
|
2013-10-02 15:15:09 +02:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-cplus-demangle.bin:
|
2013-10-02 15:15:09 +02:00
|
|
|
$(BUILD) -liberty
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-backtrace.bin:
|
2013-09-30 16:49:38 +02:00
|
|
|
$(BUILD)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-timerfd.bin:
|
2013-10-29 10:43:16 -06:00
|
|
|
$(BUILD)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libdw-dwarf-unwind.bin:
|
2015-02-20 23:16:58 +01:00
|
|
|
$(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-libbabeltrace.bin:
|
2015-02-20 23:16:58 +01:00
|
|
|
$(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
|
2014-02-19 16:52:56 +01:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-sync-compare-and-swap.bin:
|
2015-02-28 10:16:27 +01:00
|
|
|
$(BUILD)
|
2014-07-14 13:02:53 +03:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-compile-32.bin:
|
|
|
|
|
$(CC) -m32 -o $@ test-compile.c
|
2014-10-23 18:16:03 -03:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-compile-x32.bin:
|
|
|
|
|
$(CC) -mx32 -o $@ test-compile.c
|
2014-10-23 18:16:03 -03:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-zlib.bin:
|
2014-10-31 16:51:38 +09:00
|
|
|
$(BUILD) -lz
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-lzma.bin:
|
2015-03-04 11:35:47 +01:00
|
|
|
$(BUILD) -llzma
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-get_cpuid.bin:
|
2015-09-17 12:54:30 -03:00
|
|
|
$(BUILD)
|
|
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
$(OUTPUT)test-bpf.bin:
|
2015-07-01 02:13:51 +00:00
|
|
|
$(BUILD)
|
|
|
|
|
|
2016-07-12 19:05:56 +09:00
|
|
|
$(OUTPUT)test-sdt.bin:
|
|
|
|
|
$(BUILD)
|
|
|
|
|
|
2016-09-26 07:26:56 +00:00
|
|
|
$(OUTPUT)test-cxx.bin:
|
|
|
|
|
$(BUILDXX) -std=gnu++11
|
|
|
|
|
|
2016-11-02 14:35:48 +01:00
|
|
|
$(OUTPUT)test-jvmti.bin:
|
|
|
|
|
$(BUILD)
|
|
|
|
|
|
2016-11-26 07:03:31 +00:00
|
|
|
$(OUTPUT)test-llvm.bin:
|
2016-12-06 07:22:30 +00:00
|
|
|
$(BUILDXX) -std=gnu++11 \
|
2016-11-26 07:03:31 +00:00
|
|
|
-I$(shell $(LLVM_CONFIG) --includedir) \
|
|
|
|
|
-L$(shell $(LLVM_CONFIG) --libdir) \
|
|
|
|
|
$(shell $(LLVM_CONFIG) --libs Core BPF) \
|
2018-03-07 16:50:20 +01:00
|
|
|
$(shell $(LLVM_CONFIG) --system-libs) \
|
|
|
|
|
> $(@:.bin=.make.output) 2>&1
|
2016-11-26 07:03:31 +00:00
|
|
|
|
2016-12-06 07:22:30 +00:00
|
|
|
$(OUTPUT)test-llvm-version.bin:
|
|
|
|
|
$(BUILDXX) -std=gnu++11 \
|
2018-03-07 16:50:20 +01:00
|
|
|
-I$(shell $(LLVM_CONFIG) --includedir) \
|
|
|
|
|
> $(@:.bin=.make.output) 2>&1
|
2016-12-06 07:22:30 +00:00
|
|
|
|
2016-11-26 07:03:32 +00:00
|
|
|
$(OUTPUT)test-clang.bin:
|
2016-12-06 07:22:30 +00:00
|
|
|
$(BUILDXX) -std=gnu++11 \
|
2016-11-26 07:03:32 +00:00
|
|
|
-I$(shell $(LLVM_CONFIG) --includedir) \
|
|
|
|
|
-L$(shell $(LLVM_CONFIG) --libdir) \
|
|
|
|
|
-Wl,--start-group -lclangBasic -lclangDriver \
|
|
|
|
|
-lclangFrontend -lclangEdit -lclangLex \
|
|
|
|
|
-lclangAST -Wl,--end-group \
|
|
|
|
|
$(shell $(LLVM_CONFIG) --libs Core option) \
|
2018-03-07 16:50:20 +01:00
|
|
|
$(shell $(LLVM_CONFIG) --system-libs) \
|
|
|
|
|
> $(@:.bin=.make.output) 2>&1
|
2016-11-26 07:03:32 +00:00
|
|
|
|
2015-12-15 09:39:32 -06:00
|
|
|
-include $(OUTPUT)*.d
|
2013-09-30 13:51:28 +02:00
|
|
|
|
2013-09-30 10:08:24 +02:00
|
|
|
###############################
|
|
|
|
|
|
|
|
|
|
clean:
|
2015-12-15 09:39:32 -06:00
|
|
|
rm -f $(FILES) $(OUTPUT)*.d $(FILES:.bin=.make.output)
|