aboutsummaryrefslogtreecommitdiff
path: root/devel/android-tools-simpleperf/files/Makefile
blob: e813d5a1a44be00ba39596e2852a26b0e67a7158 (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# $FreeBSD$

PROG_CXX=simpleperf
MAN=
BINDIR?=/usr/bin

SRCS+=	callchain.cpp
SRCS+=	cmd_dumprecord.cpp
SRCS+=	cmd_help.cpp
SRCS+=	cmd_report.cpp
SRCS+=	command.cpp
SRCS+=	dso.cpp
SRCS+=	event_attr.cpp
SRCS+=	event_type.cpp
SRCS+=	main.cpp
SRCS+=	perf_regs.cpp
SRCS+=	read_apk.cpp
SRCS+=	read_elf.cpp
SRCS+=	record.cpp
SRCS+=	record_file_reader.cpp
SRCS+=	sample_tree.cpp
SRCS+=	thread_tree.cpp
SRCS+=	utils.cpp

TEST_SRCS+=	cmd_report_test.cpp
TEST_SRCS+=	command_test.cpp
TEST_SRCS+=	gtest_main.cpp
TEST_SRCS+=	read_apk_test.cpp
TEST_SRCS+=	read_elf_test.cpp
TEST_SRCS+=	record_test.cpp
TEST_SRCS+=	sample_tree_test.cpp

.PATH: ${.CURDIR}/nonlinux_support
SRCS+=	nonlinux_support.cpp

# required by simpleperf
.PATH: ${.CURDIR}/../base
SRCS+=	file.cpp
SRCS+=	logging.cpp
SRCS+=	stringprintf.cpp
SRCS+=	strings.cpp
TEST_SRCS+= file_test.cpp
TEST_SRCS+= logging_test.cpp
TEST_SRCS+= stringprintf_test.cpp
TEST_SRCS+= strings_test.cpp
TEST_SRCS+= test_utils.cpp

# required by base
.PATH:	${.CURDIR}/../liblog
SRCS+=	config_write.c
SRCS+=	fake_log_device.c
SRCS+=	fake_writer.c
SRCS+=	logger_lock.c
SRCS+=	logger_name.c
SRCS+=	logger_write.c
CPPFLAGS.config_write.c+=	-DFAKE_LOG_DEVICE=1

# required by libziparchive
.PATH: ${.CURDIR}/../libutils
SRCS+=	FileMap.cpp

# required by simpleperf
.PATH:	${.CURDIR}/../libziparchive
SRCS+=	zip_archive.cc

CPPFLAGS+=	-D_WITH_GETLINE
CPPFLAGS+=	-DUSE_BIONIC_UAPI_HEADERS
CPPFLAGS+=	-Doff64_t=off_t
CPPFLAGS+=	-Dftruncate64=ftruncate
CPPFLAGS+=	-Dlseek64=lseek
CPPFLAGS+=	-Dmmap64=mmap
CPPFLAGS+=	-Dpread64=pread
CPPFLAGS+=	-I${.CURDIR}
CPPFLAGS+=	-I${.CURDIR}/nonlinux_support/include
CPPFLAGS+=	-I${.CURDIR}/../include
CPPFLAGS+=	-I${.CURDIR}/../base/include
CPPFLAGS+=	-I${.CURDIR}/../bionic/libc/kernel
CPPFLAGS+=	$$(${LLVM_CONFIG} --cppflags)
CPPFLAGS+=	${CPPFLAGS.${.IMPSRC:T}}
CXXFLAGS+=	-std=gnu++11

.ifndef COMPILE.c
CFLAGS+=	${CPPFLAGS}
CXXFLAGS+=	${CPPFLAGS}
.endif

TEST_CPPFLAGS+=	$$(${PKG_CONFIG} gtest --cflags)
.for f in ${TEST_SRCS}
CPPFLAGS.${f}+=	${TEST_CPPFLAGS}
.endfor

LDADD!=		${LLVM_CONFIG} --system-libs --libs --ldflags --link-static
LDADD+=		-lz \-lpthread
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223191#c3
LDADD:=		${LDADD:S,-l/usr/lib/libexecinfo.so,-lexecinfo,}
TEST_LDADD+=	$$(${PKG_CONFIG} gtest --libs)

TEST_OBJS+=	${TEST_SRCS:R:S/$/.o/}
CLEANFILES+=	${PROG}_test ${TEST_OBJS}

LLVM_CONFIG?=	llvm-config
PKG_CONFIG?=	pkg-config

.include <bsd.prog.mk>

test: ${PROG}_test
	@for f in ${.ALLSRC}; do ./$$f -t ${.CURDIR}/testdata; done

${PROG}_test: ${OBJS:Nmain.o} ${TEST_OBJS}
	${CXX} ${CPPFLAGS} ${CXXFLAGS} ${LDFLAGS} -o $@ $> ${LDADD} ${TEST_LDADD}