• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
2
3TESTS = test-cpumap test-threadmap test-evlist test-evsel
4
5TESTS_SO := $(addsuffix -so,$(TESTS))
6TESTS_A  := $(addsuffix -a,$(TESTS))
7
8# Set compile option CFLAGS
9ifdef EXTRA_CFLAGS
10  CFLAGS := $(EXTRA_CFLAGS)
11else
12  CFLAGS := -g -Wall
13endif
14
15all:
16
17include $(srctree)/tools/scripts/Makefile.include
18
19INCLUDE = -I$(srctree)/tools/lib/perf/include -I$(srctree)/tools/include -I$(srctree)/tools/lib
20
21$(TESTS_A): FORCE
22	$(QUIET_LINK)$(CC) $(INCLUDE) $(CFLAGS) -o $@ $(subst -a,.c,$@) ../libperf.a $(LIBAPI)
23
24$(TESTS_SO): FORCE
25	$(QUIET_LINK)$(CC) $(INCLUDE) $(CFLAGS) -L.. -o $@ $(subst -so,.c,$@) $(LIBAPI) -lperf
26
27all: $(TESTS_A) $(TESTS_SO)
28
29run:
30	@echo "running static:"
31	@for i in $(TESTS_A); do ./$$i; done
32	@echo "running dynamic:"
33	@for i in $(TESTS_SO); do LD_LIBRARY_PATH=../ ./$$i; done
34
35clean:
36	$(call QUIET_CLEAN, tests)$(RM) $(TESTS_A) $(TESTS_SO)
37
38.PHONY: all clean FORCE
39