1-
21FILES = \
32 test-all.bin \
43 test-backtrace.bin \
@@ -38,76 +37,78 @@ FILES= \
3837 test-bpf.bin \
3938 test-get_cpuid.bin
4039
40+ FILES := $(addprefix $(OUTPUT ) ,$(FILES ) )
41+
4142CC := $(CROSS_COMPILE ) gcc -MD
4243PKG_CONFIG := $(CROSS_COMPILE ) pkg-config
4344
4445all : $(FILES )
4546
46- __BUILD = $(CC ) $(CFLAGS ) -Wall -Werror -o $( OUTPUT ) $ @ $(patsubst % .bin,% .c,$@ ) $(LDFLAGS )
47- BUILD = $(__BUILD ) > $(OUTPUT )$( @:.bin=.make.output ) 2>&1
47+ __BUILD = $(CC ) $(CFLAGS ) -Wall -Werror -o $@ $(patsubst % .bin,% .c,$( @F ) ) $(LDFLAGS )
48+ BUILD = $(__BUILD ) > $(@:.bin=.make.output ) 2>&1
4849
4950# ##############################
5051
51- test-all.bin :
52+ $( OUTPUT ) test-all.bin :
5253 $(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
5354
54- test-hello.bin :
55+ $( OUTPUT ) test-hello.bin :
5556 $(BUILD )
5657
57- test-pthread-attr-setaffinity-np.bin :
58+ $( OUTPUT ) test-pthread-attr-setaffinity-np.bin :
5859 $(BUILD ) -D_GNU_SOURCE -lpthread
5960
60- test-stackprotector-all.bin :
61+ $( OUTPUT ) test-stackprotector-all.bin :
6162 $(BUILD ) -fstack-protector-all
6263
63- test-fortify-source.bin :
64+ $( OUTPUT ) test-fortify-source.bin :
6465 $(BUILD ) -O2 -D_FORTIFY_SOURCE=2
6566
66- test-bionic.bin :
67+ $( OUTPUT ) test-bionic.bin :
6768 $(BUILD )
6869
69- test-libelf.bin :
70+ $( OUTPUT ) test-libelf.bin :
7071 $(BUILD ) -lelf
7172
72- test-glibc.bin :
73+ $( OUTPUT ) test-glibc.bin :
7374 $(BUILD )
7475
7576DWARFLIBS := -ldw
7677ifeq ($(findstring -static,${LDFLAGS}) ,-static)
7778DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
7879endif
7980
80- test-dwarf.bin :
81+ $( OUTPUT ) test-dwarf.bin :
8182 $(BUILD ) $(DWARFLIBS )
8283
83- test-libelf-mmap.bin :
84+ $( OUTPUT ) test-libelf-mmap.bin :
8485 $(BUILD ) -lelf
8586
86- test-libelf-getphdrnum.bin :
87+ $( OUTPUT ) test-libelf-getphdrnum.bin :
8788 $(BUILD ) -lelf
8889
89- test-libnuma.bin :
90+ $( OUTPUT ) test-libnuma.bin :
9091 $(BUILD ) -lnuma
9192
92- test-numa_num_possible_cpus.bin :
93+ $( OUTPUT ) test-numa_num_possible_cpus.bin :
9394 $(BUILD ) -lnuma
9495
95- test-libunwind.bin :
96+ $( OUTPUT ) test-libunwind.bin :
9697 $(BUILD ) -lelf
9798
98- test-libunwind-debug-frame.bin :
99+ $( OUTPUT ) test-libunwind-debug-frame.bin :
99100 $(BUILD ) -lelf
100101
101- test-libaudit.bin :
102+ $( OUTPUT ) test-libaudit.bin :
102103 $(BUILD ) -laudit
103104
104- test-libslang.bin :
105+ $( OUTPUT ) test-libslang.bin :
105106 $(BUILD ) -I/usr/include/slang -lslang
106107
107- test-gtk2.bin :
108+ $( OUTPUT ) test-gtk2.bin :
108109 $(BUILD ) $(shell $(PKG_CONFIG ) --libs --cflags gtk+-2.0 2>/dev/null)
109110
110- test-gtk2-infobar.bin :
111+ $( OUTPUT ) test-gtk2-infobar.bin :
111112 $(BUILD ) $(shell $(PKG_CONFIG ) --libs --cflags gtk+-2.0 2>/dev/null)
112113
113114grep-libs = $(filter -l% ,$(1 ) )
@@ -119,63 +120,63 @@ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
119120PERL_EMBED_CCOPTS = ` perl -MExtUtils::Embed -e ccopts 2> /dev/null `
120121FLAGS_PERL_EMBED =$(PERL_EMBED_CCOPTS ) $(PERL_EMBED_LDOPTS )
121122
122- test-libperl.bin :
123+ $( OUTPUT ) test-libperl.bin :
123124 $(BUILD ) $(FLAGS_PERL_EMBED )
124125
125- test-libpython.bin :
126+ $( OUTPUT ) test-libpython.bin :
126127 $(BUILD )
127128
128- test-libpython-version.bin :
129+ $( OUTPUT ) test-libpython-version.bin :
129130 $(BUILD )
130131
131- test-libbfd.bin :
132+ $( OUTPUT ) test-libbfd.bin :
132133 $(BUILD ) -DPACKAGE=' "perf"' -lbfd -lz -liberty -ldl
133134
134- test-liberty.bin :
135- $(CC ) $(CFLAGS ) -Wall -Werror -o $( OUTPUT ) $ @ test-libbfd.c -DPACKAGE=' "perf"' $(LDFLAGS ) -lbfd -ldl -liberty
135+ $( OUTPUT ) test-liberty.bin :
136+ $(CC ) $(CFLAGS ) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE=' "perf"' $(LDFLAGS ) -lbfd -ldl -liberty
136137
137- test-liberty-z.bin :
138- $(CC ) $(CFLAGS ) -Wall -Werror -o $( OUTPUT ) $ @ test-libbfd.c -DPACKAGE=' "perf"' $(LDFLAGS ) -lbfd -ldl -liberty -lz
138+ $( OUTPUT ) test-liberty-z.bin :
139+ $(CC ) $(CFLAGS ) -Wall -Werror -o $@ test-libbfd.c -DPACKAGE=' "perf"' $(LDFLAGS ) -lbfd -ldl -liberty -lz
139140
140- test-cplus-demangle.bin :
141+ $( OUTPUT ) test-cplus-demangle.bin :
141142 $(BUILD ) -liberty
142143
143- test-backtrace.bin :
144+ $( OUTPUT ) test-backtrace.bin :
144145 $(BUILD )
145146
146- test-timerfd.bin :
147+ $( OUTPUT ) test-timerfd.bin :
147148 $(BUILD )
148149
149- test-libdw-dwarf-unwind.bin :
150+ $( OUTPUT ) test-libdw-dwarf-unwind.bin :
150151 $(BUILD ) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
151152
152- test-libbabeltrace.bin :
153+ $( OUTPUT ) test-libbabeltrace.bin :
153154 $(BUILD ) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
154155
155- test-sync-compare-and-swap.bin :
156+ $( OUTPUT ) test-sync-compare-and-swap.bin :
156157 $(BUILD )
157158
158- test-compile-32.bin :
159- $(CC ) -m32 -o $( OUTPUT ) $ @ test-compile.c
159+ $( OUTPUT ) test-compile-32.bin :
160+ $(CC ) -m32 -o $@ test-compile.c
160161
161- test-compile-x32.bin :
162- $(CC ) -mx32 -o $( OUTPUT ) $ @ test-compile.c
162+ $( OUTPUT ) test-compile-x32.bin :
163+ $(CC ) -mx32 -o $@ test-compile.c
163164
164- test-zlib.bin :
165+ $( OUTPUT ) test-zlib.bin :
165166 $(BUILD ) -lz
166167
167- test-lzma.bin :
168+ $( OUTPUT ) test-lzma.bin :
168169 $(BUILD ) -llzma
169170
170- test-get_cpuid.bin :
171+ $( OUTPUT ) test-get_cpuid.bin :
171172 $(BUILD )
172173
173- test-bpf.bin :
174+ $( OUTPUT ) test-bpf.bin :
174175 $(BUILD )
175176
176- -include *.d
177+ -include $( OUTPUT ) *.d
177178
178179# ##############################
179180
180181clean :
181- rm -f $(FILES ) * .d $(FILES:.bin=.make.output )
182+ rm -f $(FILES ) $( OUTPUT ) * .d $(FILES:.bin=.make.output )
0 commit comments