-
Notifications
You must be signed in to change notification settings - Fork 478
/
Copy pathMakefile.check
92 lines (77 loc) · 3.15 KB
/
Makefile.check
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
ifeq ($(wildcard $(objdir)/check-deps/clock_without_librt),)
LDFLAGS_libmcount.so += -lrt
endif
ifneq ($(wildcard $(objdir)/check-deps/cc_has_mfentry),)
export HAVE_CC_MFENTRY = 1
endif
ifneq ($(wildcard $(objdir)/check-deps/cxa_demangle),)
COMMON_CFLAGS += -DHAVE_CXA_DEMANGLE
COMMON_LDFLAGS += -lstdc++
endif
ifneq ($(wildcard $(objdir)/check-deps/cc_has_mgeneral_regs_only),)
LIB_CFLAGS += -mgeneral-regs-only
else ifneq ($(wildcard $(objdir)/check-deps/cc_has_mno_sse2),)
LIB_CFLAGS += -mno-sse -mno-sse2
endif
ifneq ($(wildcard $(objdir)/check-deps/have_libpython3),)
# libpython3 provides an embed version of pkg-config file since python3.8
ifeq ($(shell pkg-config python3-embed --exists 2> /dev/null; echo $$?), 0)
EMBED := -embed
endif
COMMON_CFLAGS += -DHAVE_LIBPYTHON3
COMMON_CFLAGS += $(shell pkg-config python3$(EMBED) --cflags)
COMMON_CFLAGS += -DLIBPYTHON_VERSION=$(shell pkg-config python3$(EMBED) --modversion)
PYTHON_LDFLAGS = $(shell pkg-config python3$(EMBED) --libs)
else ifneq ($(wildcard $(objdir)/check-deps/have_libpython2.7),)
COMMON_CFLAGS += -DHAVE_LIBPYTHON2
COMMON_CFLAGS += -I/usr/include/python2.7
COMMON_CFLAGS += -DLIBPYTHON_VERSION="2.7"
PYTHON_LDFLAGS = -lpython2.7
endif
ifneq ($(wildcard $(objdir)/check-deps/have_libluajit),)
COMMON_CFLAGS += -DHAVE_LIBLUAJIT
COMMON_CFLAGS += $(shell pkg-config --cflags luajit)
endif
ifneq ($(wildcard $(objdir)/check-deps/perf_clockid),)
COMMON_CFLAGS += -DHAVE_PERF_CLOCKID
endif
ifneq ($(wildcard $(objdir)/check-deps/perf_context_switch),)
COMMON_CFLAGS += -DHAVE_PERF_CTXSW
endif
ifneq ($(wildcard $(objdir)/check-deps/arm_has_hardfp),)
COMMON_CFLAGS += -DHAVE_ARM_HARDFP
endif
ifneq ($(wildcard $(objdir)/check-deps/have_libncurses),)
COMMON_CFLAGS += -DHAVE_LIBNCURSES $(shell pkg-config --cflags ncursesw)
UFTRACE_LDFLAGS += $(shell pkg-config --libs ncursesw)
TEST_LDFLAGS += $(shell pkg-config --libs ncursesw)
endif
ifneq ($(wildcard $(objdir)/check-deps/have_libelf),)
COMMON_CFLAGS += -DHAVE_LIBELF
COMMON_LDFLAGS += -lelf
endif
ifneq ($(wildcard $(objdir)/check-deps/have_libdw),)
COMMON_CFLAGS += -DHAVE_LIBDW
COMMON_CFLAGS += $(shell pkg-config --cflags libdw 2> /dev/null)
COMMON_LDFLAGS += $(shell pkg-config --libs libdw 2> /dev/null || echo "-ldw")
endif
ifneq ($(wildcard $(objdir)/check-deps/have_libunwind),)
ifeq ($(DEBUG), 1)
COMMON_CFLAGS += -DHAVE_LIBUNWIND
COMMON_CFLAGS += $(shell pkg-config --cflags libunwind 2> /dev/null)
COMMON_LDFLAGS += $(shell pkg-config --libs libunwind 2> /dev/null)
endif
endif
ifneq ($(wildcard $(objdir)/check-deps/have_libcapstone),)
COMMON_CFLAGS += -DHAVE_LIBCAPSTONE
COMMON_CFLAGS += $(shell pkg-config --cflags capstone 2> /dev/null)
COMMON_LDFLAGS += $(shell pkg-config --libs capstone 2> /dev/null)
endif
ifneq ($(wildcard $(objdir)/check-deps/cc_has_minline_all_stringops),)
LIB_CFLAGS += -minline-all-stringops
endif
ifneq ($(wildcard $(objdir)/check-deps/have_libtraceevent),)
COMMON_CFLAGS += -DHAVE_LIBTRACEEVENT
COMMON_CFLAGS += $(shell pkg-config --cflags libtraceevent 2> /dev/null)
COMMON_LDFLAGS += $(shell pkg-config --libs libtraceevent 2> /dev/null)
endif