18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ciTESTS = test-cpumap test-threadmap test-evlist test-evsel
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciTESTS_SO := $(addsuffix -so,$(TESTS))
68c2ecf20Sopenharmony_ciTESTS_A  := $(addsuffix -a,$(TESTS))
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci# Set compile option CFLAGS
98c2ecf20Sopenharmony_ciifdef EXTRA_CFLAGS
108c2ecf20Sopenharmony_ci  CFLAGS := $(EXTRA_CFLAGS)
118c2ecf20Sopenharmony_cielse
128c2ecf20Sopenharmony_ci  CFLAGS := -g -Wall
138c2ecf20Sopenharmony_ciendif
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciall:
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciinclude $(srctree)/tools/scripts/Makefile.include
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciINCLUDE = -I$(srctree)/tools/lib/perf/include -I$(srctree)/tools/include -I$(srctree)/tools/lib
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci$(TESTS_A): FORCE
228c2ecf20Sopenharmony_ci	$(QUIET_LINK)$(CC) $(INCLUDE) $(CFLAGS) -o $@ $(subst -a,.c,$@) ../libperf.a $(LIBAPI)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci$(TESTS_SO): FORCE
258c2ecf20Sopenharmony_ci	$(QUIET_LINK)$(CC) $(INCLUDE) $(CFLAGS) -L.. -o $@ $(subst -so,.c,$@) $(LIBAPI) -lperf
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciall: $(TESTS_A) $(TESTS_SO)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cirun:
308c2ecf20Sopenharmony_ci	@echo "running static:"
318c2ecf20Sopenharmony_ci	@for i in $(TESTS_A); do ./$$i; done
328c2ecf20Sopenharmony_ci	@echo "running dynamic:"
338c2ecf20Sopenharmony_ci	@for i in $(TESTS_SO); do LD_LIBRARY_PATH=../ ./$$i; done
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciclean:
368c2ecf20Sopenharmony_ci	$(call QUIET_CLEAN, tests)$(RM) $(TESTS_A) $(TESTS_SO)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci.PHONY: all clean FORCE
39