summaryrefslogtreecommitdiff
path: root/tools/perf/lib/tests/Makefile
blob: 1ee4e9ba848b6a88eaf1d1967cee1afc85611541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)

TESTS = test-cpumap test-threadmap test-evlist test-evsel

TESTS_SO := $(addsuffix -so,$(TESTS))
TESTS_A  := $(addsuffix -a,$(TESTS))

# Set compile option CFLAGS
ifdef EXTRA_CFLAGS
  CFLAGS := $(EXTRA_CFLAGS)
else
  CFLAGS := -g -Wall
endif

all:

include $(srctree)/tools/scripts/Makefile.include

INCLUDE = -I$(srctree)/tools/perf/lib/include -I$(srctree)/tools/include

$(TESTS_A): FORCE
	$(QUIET_LINK)$(CC) $(INCLUDE) $(CFLAGS) -o $@ $(subst -a,.c,$@) ../libperf.a

$(TESTS_SO): FORCE
	$(QUIET_LINK)$(CC) $(INCLUDE) $(CFLAGS) -L.. -o $@ $(subst -so,.c,$@) -lperf

all: $(TESTS_A) $(TESTS_SO)

run:
	@echo "running static:"
	@for i in $(TESTS_A); do ./$$i; done
	@echo "running dynamic:"
	@for i in $(TESTS_SO); do LD_LIBRARY_PATH=../ ./$$i; done

clean:
	$(call QUIET_CLEAN, tests)$(RM) $(TESTS_A) $(TESTS_SO)

.PHONY: all clean FORCE