Makefile 3.1 KB
Newer Older
1

2
FILES=					\
3 4 5 6 7
	test-all.bin			\
	test-backtrace.bin		\
	test-bionic.bin			\
	test-dwarf.bin			\
	test-fortify-source.bin		\
8
	test-sync-compare-and-swap.bin	\
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
	test-glibc.bin			\
	test-gtk2.bin			\
	test-gtk2-infobar.bin		\
	test-hello.bin			\
	test-libaudit.bin		\
	test-libbfd.bin			\
	test-liberty.bin		\
	test-liberty-z.bin		\
	test-cplus-demangle.bin		\
	test-libelf.bin			\
	test-libelf-getphdrnum.bin	\
	test-libelf-mmap.bin		\
	test-libnuma.bin		\
	test-libperl.bin		\
	test-libpython.bin		\
	test-libpython-version.bin	\
	test-libslang.bin		\
	test-libunwind.bin		\
	test-libunwind-debug-frame.bin	\
	test-stackprotector-all.bin	\
29
	test-timerfd.bin		\
30 31 32
	test-libdw-dwarf-unwind.bin	\
	test-compile-32.bin		\
	test-compile-x32.bin
33

M
Mark Rutland 已提交
34 35
CC := $(CROSS_COMPILE)gcc -MD
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
36

37 38
all: $(FILES)

39
BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
40 41 42

###############################

43
test-all.bin:
M
Mark Rutland 已提交
44
	$(BUILD) -Werror -fstack-protector-all -O2 -Werror -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
45

46
test-hello.bin:
47 48
	$(BUILD)

49
test-stackprotector-all.bin:
50 51
	$(BUILD) -Werror -fstack-protector-all

52
test-fortify-source.bin:
53 54
	$(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2

55
test-bionic.bin:
56 57
	$(BUILD)

58
test-libelf.bin:
59 60
	$(BUILD) -lelf

61
test-glibc.bin:
62 63
	$(BUILD)

64
test-dwarf.bin:
65 66
	$(BUILD) -ldw

67
test-libelf-mmap.bin:
68 69
	$(BUILD) -lelf

70
test-libelf-getphdrnum.bin:
71 72
	$(BUILD) -lelf

73
test-libnuma.bin:
74 75
	$(BUILD) -lnuma

76
test-libunwind.bin:
77
	$(BUILD) -lelf
78

79
test-libunwind-debug-frame.bin:
80
	$(BUILD) -lelf
81

82
test-libaudit.bin:
83 84
	$(BUILD) -laudit

85
test-libslang.bin:
86 87
	$(BUILD) -I/usr/include/slang -lslang

88
test-gtk2.bin:
M
Mark Rutland 已提交
89
	$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
90

91
test-gtk2-infobar.bin:
M
Mark Rutland 已提交
92
	$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
93

94 95 96 97 98 99 100 101 102
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)

103
test-libperl.bin:
104 105
	$(BUILD) $(FLAGS_PERL_EMBED)

106
test-libpython.bin:
107
	$(BUILD)
108

109
test-libpython-version.bin:
110
	$(BUILD)
111

112
test-libbfd.bin:
113
	$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
114

115
test-liberty.bin:
116
	$(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
117

118
test-liberty-z.bin:
119
	$(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
120

121
test-cplus-demangle.bin:
122 123
	$(BUILD) -liberty

124
test-backtrace.bin:
125 126
	$(BUILD)

127
test-timerfd.bin:
128 129
	$(BUILD)

130 131 132
test-libdw-dwarf-unwind.bin:
	$(BUILD)

133 134 135
test-sync-compare-and-swap.bin:
	$(BUILD) -Werror

136 137 138 139 140 141
test-compile-32.bin:
	$(CC) -m32 -o $(OUTPUT)$@ test-compile.c

test-compile-x32.bin:
	$(CC) -mx32 -o $(OUTPUT)$@ test-compile.c

142
-include *.d
143

144 145 146
###############################

clean:
147
	rm -f $(FILES) *.d