Makefile 3.6 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
	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	\
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 36
	test-zlib.bin			\
	test-lzma.bin
37

M
Mark Rutland 已提交
38 39
CC := $(CROSS_COMPILE)gcc -MD
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
40

41 42
all: $(FILES)

43 44
__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
  BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
45 46 47

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

48
test-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

51
test-hello.bin:
52 53
	$(BUILD)

54
test-pthread-attr-setaffinity-np.bin:
55
	$(BUILD) -D_GNU_SOURCE -lpthread
56

57
test-stackprotector-all.bin:
58
	$(BUILD) -fstack-protector-all
59

60
test-fortify-source.bin:
61
	$(BUILD) -O2 -D_FORTIFY_SOURCE=2
62

63
test-bionic.bin:
64 65
	$(BUILD)

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

69
test-glibc.bin:
70 71
	$(BUILD)

72
test-dwarf.bin:
73 74
	$(BUILD) -ldw

75
test-libelf-mmap.bin:
76 77
	$(BUILD) -lelf

78
test-libelf-getphdrnum.bin:
79 80
	$(BUILD) -lelf

81
test-libnuma.bin:
82 83
	$(BUILD) -lnuma

84
test-libunwind.bin:
85
	$(BUILD) -lelf
86

87
test-libunwind-debug-frame.bin:
88
	$(BUILD) -lelf
89

90
test-libaudit.bin:
91 92
	$(BUILD) -laudit

93
test-libslang.bin:
94 95
	$(BUILD) -I/usr/include/slang -lslang

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

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

102 103 104 105 106 107 108 109 110
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)

111
test-libperl.bin:
112 113
	$(BUILD) $(FLAGS_PERL_EMBED)

114
test-libpython.bin:
115
	$(BUILD)
116

117
test-libpython-version.bin:
118
	$(BUILD)
119

120
test-libbfd.bin:
121
	$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
122

123
test-liberty.bin:
124
	$(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
125

126
test-liberty-z.bin:
127
	$(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
128

129
test-cplus-demangle.bin:
130 131
	$(BUILD) -liberty

132
test-backtrace.bin:
133 134
	$(BUILD)

135
test-timerfd.bin:
136 137
	$(BUILD)

138
test-libdw-dwarf-unwind.bin:
139 140 141 142
	$(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)

test-libbabeltrace.bin:
	$(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
143

144
test-sync-compare-and-swap.bin:
145
	$(BUILD)
146

147 148 149 150 151 152
test-compile-32.bin:
	$(CC) -m32 -o $(OUTPUT)$@ test-compile.c

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

153 154 155
test-zlib.bin:
	$(BUILD) -lz

156 157 158
test-lzma.bin:
	$(BUILD) -llzma

159
-include *.d
160

161 162 163
###############################

clean:
164
	rm -f $(FILES) *.d $(FILES:.bin=.make.output)