forked from hugegreenbug/libgestures
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
226 lines (190 loc) · 6.39 KB
/
Makefile
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
OBJDIR = obj
SRC=$(shell readlink -f .)
# Objects for libgestures
SO_OBJECTS=\
$(OBJDIR)/accel_filter_interpreter.o \
$(OBJDIR)/activity_log.o \
$(OBJDIR)/box_filter_interpreter.o \
$(OBJDIR)/click_wiggle_filter_interpreter.o \
$(OBJDIR)/file_util.o \
$(OBJDIR)/filter_interpreter.o \
$(OBJDIR)/finger_merge_filter_interpreter.o \
$(OBJDIR)/finger_metrics.o \
$(OBJDIR)/fling_stop_filter_interpreter.o \
$(OBJDIR)/gestures.o \
$(OBJDIR)/iir_filter_interpreter.o \
$(OBJDIR)/immediate_interpreter.o \
$(OBJDIR)/integral_gesture_filter_interpreter.o \
$(OBJDIR)/interpreter.o \
$(OBJDIR)/logging_filter_interpreter.o \
$(OBJDIR)/lookahead_filter_interpreter.o \
$(OBJDIR)/metrics_filter_interpreter.o \
$(OBJDIR)/mouse_interpreter.o \
$(OBJDIR)/multitouch_mouse_interpreter.o \
$(OBJDIR)/non_linearity_filter_interpreter.o \
$(OBJDIR)/palm_classifying_filter_interpreter.o \
$(OBJDIR)/prop_registry.o \
$(OBJDIR)/scaling_filter_interpreter.o \
$(OBJDIR)/cr48_profile_sensor_filter_interpreter.o \
$(OBJDIR)/sensor_jump_filter_interpreter.o \
$(OBJDIR)/split_correcting_filter_interpreter.o \
$(OBJDIR)/stationary_wiggle_filter_interpreter.o \
$(OBJDIR)/string_util.o \
$(OBJDIR)/stuck_button_inhibitor_filter_interpreter.o \
$(OBJDIR)/t5r2_correcting_filter_interpreter.o \
$(OBJDIR)/trace_marker.o \
$(OBJDIR)/tracer.o \
$(OBJDIR)/trend_classifying_filter_interpreter.o \
$(OBJDIR)/util.o \
$(OBJDIR)/log.o
# Objects for unittests
TEST_OBJECTS=\
$(OBJDIR)/accel_filter_interpreter_unittest.o \
$(OBJDIR)/activity_log_unittest.o \
$(OBJDIR)/activity_replay_unittest.o \
$(OBJDIR)/box_filter_interpreter_unittest.o \
$(OBJDIR)/click_wiggle_filter_interpreter_unittest.o \
$(OBJDIR)/command_line.o \
$(OBJDIR)/fling_stop_filter_interpreter_unittest.o \
$(OBJDIR)/gestures_unittest.o \
$(OBJDIR)/iir_filter_interpreter_unittest.o \
$(OBJDIR)/immediate_interpreter_unittest.o \
$(OBJDIR)/integral_gesture_filter_interpreter_unittest.o \
$(OBJDIR)/interpreter_unittest.o \
$(OBJDIR)/list_unittest.o \
$(OBJDIR)/logging_filter_interpreter_unittest.o \
$(OBJDIR)/lookahead_filter_interpreter_unittest.o \
$(OBJDIR)/non_linearity_filter_interpreter_unittest.o \
$(OBJDIR)/map_unittest.o \
$(OBJDIR)/mouse_interpreter_unittest.o \
$(OBJDIR)/multitouch_mouse_interpreter_unittest.o \
$(OBJDIR)/palm_classifying_filter_interpreter_unittest.o \
$(OBJDIR)/prop_registry_unittest.o \
$(OBJDIR)/scaling_filter_interpreter_unittest.o \
$(OBJDIR)/cr48_profile_sensor_filter_interpreter_unittest.o \
$(OBJDIR)/sensor_jump_filter_interpreter_unittest.o \
$(OBJDIR)/set_unittest.o \
$(OBJDIR)/split_correcting_filter_interpreter_unittest.o \
$(OBJDIR)/stuck_button_inhibitor_filter_interpreter_unittest.o \
$(OBJDIR)/t5r2_correcting_filter_interpreter_unittest.o \
$(OBJDIR)/trace_marker_unittest.o \
$(OBJDIR)/tracer_unittest.o \
$(OBJDIR)/unittest_util.o \
$(OBJDIR)/util_unittest.o \
$(OBJDIR)/vector_unittest.o
# Objects that are neither unittests nor SO objects
MISC_OBJECTS=\
$(OBJDIR)/activity_replay.o \
TEST_MAIN=\
$(OBJDIR)/test_main.o
TEST_EXE=test
SONAME=$(OBJDIR)/libgestures.so.0
ALL_OBJECTS=\
$(TEST_OBJECTS) \
$(TEST_MAIN) \
$(SO_OBJECTS) \
$(MISC_OBJECTS)
ALL_OBJECT_FILES=\
$(SO_OBJECTS) \
$(MISC_OBJECTS) \
$(TEST_OBJECTS) \
$(TEST_MAIN)
DEPDIR = .deps
DESTDIR = /
CXXFLAGS+=\
-std=gnu++11 \
-fno-exceptions \
-fno-strict-aliasing \
-fPIC \
-Wall \
-Wclobbered \
-Wempty-body \
-Werror \
-Wignored-qualifiers \
-Wmissing-field-initializers \
-Wmissing-format-attribute \
-Wmissing-noreturn \
-Wsign-compare \
-Wtype-limits \
-D__STDC_FORMAT_MACROS=1 \
-D_FILE_OFFSET_BITS=64 \
-DGESTURES_INTERNAL=1 \
-Iinclude \
`pkg-config --cflags glib-2.0`
LID_TOUCHPAD_HELPER=lid_touchpad_helper
# Local compilation needs these flags, esp for code coverage testing
ifeq (g++,$(CXX))
CXXFLAGS+=\
-O2 -fomit-frame-pointer \
-DVCSID="\"2.1.13\""
#LINK_FLAGS+=-lgcov
else
CXXFLAGS+=\
-DXLOGGING
endif
PKG_CONFIG ?= pkg-config
PC_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PC_DEPS))
PC_LIBS := $(shell $(PKG_CONFIG) --libs $(PC_DEPS))
CXXFLAGS += $(PC_CFLAGS) -I$(SYSROOT)/usr/include/jsoncpp
LINK_FLAGS += $(PC_LIBS) -ljsoncpp
LINK_FLAGS+=\
-lpthread \
-lrt
TEST_LINK_FLAGS=\
-lgcov \
-lglib-2.0 \
-lgtest
all: $(SONAME)
lid_touchpad_helper_all:
$(MAKE) -C $(LID_TOUCHPAD_HELPER)
$(SONAME): $(SO_OBJECTS)
$(CXX) -shared -o $@ $(SO_OBJECTS) -Wl,-z,defs,-h$(SONAME:$(OBJDIR)/%=%) \
$(LINK_FLAGS)
$(TEST_EXE): $(ALL_OBJECTS)
$(CXX) -o $@ $(CXXFLAGS) $(ALL_OBJECTS) $(LINK_FLAGS) $(TEST_LINK_FLAGS)
$(OBJDIR)/%.o : src/%.cc
mkdir -p $(OBJDIR) $(DEPDIR) || true
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -c -o $@ $<
@mv $(@:$.o=$.d) $(DEPDIR)
LIBDIR = /usr/lib
lid_touchpad_helper_install:
$(MAKE) -C $(LID_TOUCHPAD_HELPER) install
install: $(SONAME)
install -D -m 0755 $(SONAME) \
$(DESTDIR)$(LIBDIR)/$(SONAME:$(OBJDIR)/%=%)
ln -sf $(SONAME:$(OBJDIR)/%=%) \
$(DESTDIR)$(LIBDIR)/$(SONAME:$(OBJDIR)/%.0=%)
install -D -m 0644 libgestures.pc \
$(DESTDIR)$(LIBDIR)/pkgconfig/libgestures.pc
install -D -m 0644 \
include/gestures/include/gestures.h $(DESTDIR)/usr/include/gestures/gestures.h
clean:
$(MAKE) -C $(LID_TOUCHPAD_HELPER) clean
rm -rf $(OBJDIR) $(DEPDIR) $(TEST_EXE) html app.info app.info.orig
setup-in-place:
sudo emerge -v1 dev-libs/jsoncpp
mkdir -p $(SRC)/in-place/gestures || true
ln -sf $(SRC)/include/gestures.h $(SRC)/in-place/gestures/gestures.h
ln -sf $(SRC)/$(SONAME) $(SRC)/in-place/$(SONAME:$(OBJDIR)/%.0=%)
ln -sf $(SRC)/$(SONAME) $(SRC)/in-place/$(SONAME:$(OBJDIR)/%=%)
in-place: CXXFLAGS+=-DGESTURES_LARGE_LOGGING_BUFFER
in-place: $(SONAME)
clean-in-place: clean
# Unittest coverage
LCOV_EXE=/usr/bin/lcov
$(LCOV_EXE):
sudo emerge -DNuv1 dev-util/lcov
cov: $(TEST_EXE) $(LCOV_EXE)
lcov -d . --zerocounters
./$(TEST_EXE)
lcov --directory . --capture --output-file $(OBJDIR)/app.info
sed -i.orig 's|/obj/src/|/src/|g' $(OBJDIR)/app.info
sed -i.orig 's|/gestures/gestures/|/gestures/|g' $(OBJDIR)/app.info
genhtml --no-function-coverage -o html $(OBJDIR)/app.info || \
genhtml -o html $(OBJDIR)/app.info
./tools/local_coverage_rate.sh $(OBJDIR)/app.info
.PHONY : clean cov all lid_touchpad_helper_all lid_touchpad_helper_install
-include $(ALL_OBJECT_FILES:$(OBJDIR)/%.o=$(DEPDIR)/%.d)