This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 278
/
Makefile
451 lines (354 loc) · 17.1 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
$(shell mkdir -p build/test build/test src/lib/osx/build)
pwd=$(shell pwd)
uname=$(shell uname)
architecture=$(shell uname -m)
timestamp=$(shell date "+%Y-%m-%d-%H-%M-%S")
rootdir=$(shell pwd)
pocodir=third_party/poco
openssldir=third_party/openssl
jsoncppdir=third_party/jsoncpp/dist
pocoversion=$(shell cat third_party/poco/libversion)
macosdir=src/ui/osx
GTEST_ROOT=third_party/googletest-read-only
source_dirs=src/*.cc src/*.h src/test/*.cc src/test/*.h \
src/ui/linux/TogglDesktop/aboutdialog.h src/ui/linux/TogglDesktop/aboutdialog.cpp \
src/ui/linux/TogglDesktop/autocompleteview.h src/ui/linux/TogglDesktop/autocompleteview.cpp \
src/ui/linux/TogglDesktop/clickablelabel.h src/ui/linux/TogglDesktop/clickablelabel.cpp \
src/ui/linux/TogglDesktop/errorviewcontroller.h src/ui/linux/TogglDesktop/errorviewcontroller.cpp \
src/ui/linux/TogglDesktop/feedbackdialog.h src/ui/linux/TogglDesktop/feedbackdialog.cpp \
src/ui/linux/TogglDesktop/genericview.h src/ui/linux/TogglDesktop/genericview.cpp \
src/ui/linux/TogglDesktop/loginwidget.h src/ui/linux/TogglDesktop/loginwidget.cpp \
src/ui/linux/TogglDesktop/main.cpp \
src/ui/linux/TogglDesktop/mainwindowcontroller.h src/ui/linux/TogglDesktop/mainwindowcontroller.cpp \
src/ui/linux/TogglDesktop/preferencesdialog.h src/ui/linux/TogglDesktop/preferencesdialog.cpp \
src/ui/linux/TogglDesktop/settingsview.h src/ui/linux/TogglDesktop/settingsview.cpp \
src/ui/linux/TogglDesktop/singleapplication.h src/ui/linux/TogglDesktop/singleapplication.cpp \
src/ui/linux/TogglDesktop/timeentrycellwidget.h src/ui/linux/TogglDesktop/timeentrycellwidget.cpp \
src/ui/linux/TogglDesktop/timeentryeditorwidget.h src/ui/linux/TogglDesktop/timeentryeditorwidget.cpp \
src/ui/linux/TogglDesktop/timeentrylistwidget.h src/ui/linux/TogglDesktop/timeentrylistwidget.cpp \
src/ui/linux/TogglDesktop/timeentryview.h src/ui/linux/TogglDesktop/timeentryview.cpp \
src/ui/linux/TogglDesktop/timerwidget.h src/ui/linux/TogglDesktop/timerwidget.cpp \
src/ui/linux/TogglDesktop/toggl.h src/ui/linux/TogglDesktop/toggl.cpp
xcodebuild_command=xcodebuild \
-scheme TogglDesktop \
-workspace src/ui/osx/TogglDesktop.xcworkspace \
-configuration Debug
xcodebuild_command_release=xcodebuild \
-scheme TogglDesktop \
-workspace src/ui/osx/TogglDesktop.xcworkspace \
-configuration Release
ifeq ($(uname), Linux)
executable=./build/src/ui/linux/TogglDesktop/TogglDesktop
else
executable=$(shell $(xcodebuild_command) \
-showBuildSettings \
| grep -w 'BUILT_PRODUCTS_DIR' \
| cut -d'=' -f 2)/TogglDesktop.app/Contents/MacOS/TogglDesktop
endif
executable_release=$(shell $(xcodebuild_command_release) \
-showBuildSettings \
| grep -w 'BUILT_PRODUCTS_DIR' \
| cut -d'=' -f 2)/TogglDesktop.app/Contents/MacOS/TogglDesktop
pocolib=$(pocodir)/lib/Darwin/x86_64/
osname=mac
pococflags = \
-I$(pocodir)/Foundation/include \
-I$(pocodir)/Util/include \
-I$(pocodir)/Data/include \
-I$(pocodir)/Data/SQLite/include \
-I$(pocodir)/Crypto/include \
-I$(pocodir)/Net/include \
-I$(pocodir)/NetSSL_OpenSSL/include
pocolibs = -L$(pocolib)
pococonfigure = --cflags=-fPIC --sqlite-thread-safe=1
pocolibs += \
-lPocoDataSQLite \
-lPocoData \
-lPocoNet \
-lPocoNetSSL \
-lPocoCrypto \
-lPocoUtil \
-lPocoXML \
-lPocoJSON \
-lPocoFoundation
opensslincdirname = include
opensslcflags = -I$(openssldir)/$(opensslincdirname)
openssllibs = -L$(openssldir)
opensslconfigure = --include-path=$(pwd)/$(openssldir)/$(opensslincdirname) --library-path=$(pwd)/$(openssldir)
cflags=-g -Wall -Wextra -Wno-deprecated -Wno-unused-parameter -Wunreachable-code -DLUA_USE_MACOSX \
-mmacosx-version-min=10.11 \
$(pococflags) $(opensslcflags) \
-I$(GTEST_ROOT)/include \
-I$(GTEST_ROOT) \
-I$(jsoncppdir) \
-Ithird_party/lua/install/include \
-DNDEBUG
libs=-framework Carbon \
$(pocolibs) \
-lpthread \
$(openssllibs) \
-lssl \
-lcrypto \
-Lthird_party/lua/install/lib \
-llua \
-ldl
cxx=g++ -fprofile-arcs -ftest-coverage -std=gnu++0x
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
default: fmt app
else
default:
$(error this platform is not supported by Makefile.)
endif
csapi: generate_cs_api fmt
generate_cs_api:
go run src/script/generate_cs_api.go
clean: clean_ui clean_lib clean_test
rm -rf build coverage
clean_lib:
rm -rf src/lib/osx/build
clean_ui:
rm -rf src/ui/osx/TogglDesktop/build third_party/TFDatePicker/TFDatePicker/build TogglDesktop*.dmg TogglDesktop*.tar.gz
clean_test:
rm -rf test/*
mkdir -p test
lint:
./third_party/cpplint/cpplint.py $(source_dirs)
cppclean:
./third_party/cppclean/cppclean -q --include-path=src/lib/include --include-path=third_party/poco/Crypto/include --include-path=third_party/poco/Net/include --include-path=third_party/poco/NetSSL_OpenSSL/include --include-path=third_party/poco/Foundation/include --include-path=third_party/poco/Util/include --include-path=third_party/poco/Data/include --include-path=third_party/poco/Data/SQLite/include --include-path=third_party/poco/Data/SQLite/src --include-path=third_party/lua/install/include src/*.*
qa: lint fmt cppclean test
fmt: fmt_lib fmt_ui
ifeq ($(uname), Linux)
app:
mkdir -p build && cd build && cmake .. && make
else
app: init_cocoapods lib ui
endif
app_release: lib_release ui_release
lib:
xcodebuild -project src/lib/osx/TogglDesktopLibrary.xcodeproj -configuration Debug
lib_release:
xcodebuild -project src/lib/osx/TogglDesktopLibrary.xcodeproj -configuration Release build
ui:
$(xcodebuild_command)
ui_release:
$(xcodebuild_command_release)
clean-bugsnag-qt:
rm -rf third_party/bugsnag-qt/build && \
cd third_party/bugsnag-qt && $(QMAKE) && make clean
bugsnag-qt: clean-bugsnag-qt
cd third_party/bugsnag-qt && $(QMAKE) && make
run: app
$(executable)
run_release: app_release
$(executable_release)
clean_deps:
cd $(pocodir) && (make clean || true)
rm -rf $(pocodir)/**/.dep
cd $(openssldir) && (make clean || true)
deps: clean_deps openssl poco lua
init_cocoapods:
cd $(macosdir) && bundle install && bundle exec pod install && cd $(rootdir)
lua:
cd third_party/lua && make macosx && make local
openssl:
cd $(openssldir) && ./config -fPIC no-shared no-dso && ./Configure darwin64-x86_64-cc && make $(LEGACYMACOSSDK)
poco:
cd $(pocodir) && \
./configure --config=Darwin64-clang-libc++ --omit=Data/ODBC,Data/MySQL,Zip,JSON,MongoDB,PageCompiler,PageCompiler/File2Page,CppUnit --no-tests --no-samples \
$(pococonfigure) \
$(opensslconfigure) \
&& \
make clean && \
make $(LEGACYMACOSSDK)
third_party/google-astyle/build/google-astyle:
cd third_party/google-astyle && mkdir -p build && g++ *.cpp -o build/google-astyle
fmt_lib: third_party/google-astyle/build/google-astyle
third_party/google-astyle/build/google-astyle -n $(source_dirs)
fmt_ui:
./third_party/Xcode-formatter/CodeFormatter/scripts/formatAllSources.sh src/ui/osx/TogglDesktop
third_party/google-astyle/build/google-astyle -n src/ui/windows/TogglDesktop/TogglDesktop/TogglApi.cs
build/jsoncpp.o: $(jsoncppdir)/jsoncpp.cpp
$(cxx) $(cflags) -c $(jsoncppdir)/jsoncpp.cpp -o build/jsoncpp.o
build/proxy.o: src/proxy.cc
$(cxx) $(cflags) -c src/proxy.cc -o build/proxy.o
build/netconf.o: src/netconf.cc
$(cxx) $(cflags) -c src/netconf.cc -o build/netconf.o
build/https_client.o: src/https_client.cc
$(cxx) $(cflags) -c src/https_client.cc -o build/https_client.o
build/websocket_client.o: src/websocket_client.cc
$(cxx) $(cflags) -c src/websocket_client.cc -o build/websocket_client.o
build/base_model.o: src/base_model.cc
$(cxx) $(cflags) -c src/base_model.cc -o build/base_model.o
build/user.o: src/user.cc
$(cxx) $(cflags) -c src/user.cc -o build/user.o
build/workspace.o: src/workspace.cc
$(cxx) $(cflags) -c src/workspace.cc -o build/workspace.o
build/client.o: src/client.cc
$(cxx) $(cflags) -c src/client.cc -o build/client.o
build/project.o: src/project.cc
$(cxx) $(cflags) -c src/project.cc -o build/project.o
build/task.o: src/task.cc
$(cxx) $(cflags) -c src/task.cc -o build/task.o
build/obm_action.o: src/obm_action.cc
$(cxx) $(cflags) -c src/obm_action.cc -o build/obm_action.o
build/help_article.o: src/help_article.cc
$(cxx) $(cflags) -c src/help_article.cc -o build/help_article.o
build/time_entry.o: src/time_entry.cc
$(cxx) $(cflags) -c src/time_entry.cc -o build/time_entry.o
build/tag.o: src/tag.cc
$(cxx) $(cflags) -c src/tag.cc -o build/tag.o
build/related_data.o: src/related_data.cc
$(cxx) $(cflags) -c src/related_data.cc -o build/related_data.o
build/batch_update_result.o: src/batch_update_result.cc
$(cxx) $(cflags) -c src/batch_update_result.cc -o build/batch_update_result.o
build/formatter.o: src/formatter.cc
$(cxx) $(cflags) -c src/formatter.cc -o build/formatter.o
build/model_change.o: src/model_change.cc
$(cxx) $(cflags) -c src/model_change.cc -o build/model_change.o
build/migrations.o: src/migrations.cc
$(cxx) $(cflags) -c src/migrations.cc -o build/migrations.o
build/database.o: src/database.cc
$(cxx) $(cflags) -c src/database.cc -o build/database.o
build/feedback.o: src/feedback.cc
$(cxx) $(cflags) -c src/feedback.cc -o build/feedback.o
build/gui.o: src/gui.cc
$(cxx) $(cflags) -c src/gui.cc -o build/gui.o
build/error.o: src/error.cc
$(cxx) $(cflags) -c src/error.cc -o build/error.o
build/idle.o: src/idle.cc
$(cxx) $(cflags) -c src/idle.cc -o build/idle.o
build/analytics.o: src/analytics.cc
$(cxx) $(cflags) -c src/analytics.cc -o build/analytics.o
build/urls.o: src/urls.cc
$(cxx) $(cflags) -c src/urls.cc -o build/urls.o
build/timeline_event.o: src/timeline_event.cc
$(cxx) $(cflags) -c src/timeline_event.cc -o build/timeline_event.o
build/context.o: src/context.cc
$(cxx) $(cflags) -c src/context.cc -o build/context.o
build/rectangle.o: src/rectangle.cc
$(cxx) $(cflags) -c src/rectangle.cc -o build/rectangle.o
build/settings.o: src/settings.cc
$(cxx) $(cflags) -c src/settings.cc -o build/settings.o
build/autotracker.o: src/autotracker.cc
$(cxx) $(cflags) -c src/autotracker.cc -o build/autotracker.o
build/toggl_api_private.o: src/toggl_api_private.cc
$(cxx) $(cflags) -c src/toggl_api_private.cc -o build/toggl_api_private.o
build/toggl_api.o: src/toggl_api.cc
$(cxx) $(cflags) -c src/toggl_api.cc -o build/toggl_api.o
build/test/test_data.o: src/test/test_data.cc
$(cxx) $(cflags) -c src/test/test_data.cc -o build/test/test_data.o
build/test/toggl_api_test.o: src/test/toggl_api_test.cc
$(cxx) $(cflags) -c src/test/toggl_api_test.cc -o build/test/toggl_api_test.o
build/test/app_test.o: src/test/app_test.cc
$(cxx) $(cflags) -c src/test/app_test.cc -o build/test/app_test.o
build/get_focused_window_$(osname).o: src/get_focused_window_$(osname).cc
$(cxx) $(cflags) -c src/get_focused_window_$(osname).cc -o build/get_focused_window_$(osname).o
build/timeline_uploader.o: src/timeline_uploader.cc
$(cxx) $(cflags) -c src/timeline_uploader.cc -o build/timeline_uploader.o
build/window_change_recorder.o: src/window_change_recorder.cc
$(cxx) $(cflags) -c src/window_change_recorder.cc -o build/window_change_recorder.o
build/color_convert.o: src/color_convert.cc
$(cxx) $(cflags) -c src/color_convert.cc -o build/color_convert.o
build/test/gtest-all.o: $(GTEST_ROOT)/src/gtest-all.cc
$(cxx) $(cflags) -c $(GTEST_ROOT)/src/gtest-all.cc -o build/test/gtest-all.o
build/onboarding_service.o: src/onboarding_service.cpp
$(cxx) $(cflags) -c src/onboarding_service.cpp -o build/onboarding_service.o
build/alpha_features.o: src/alpha_features.cpp
$(cxx) $(cflags) -c src/alpha_features.cpp -o build/alpha_features.o
objects: build/jsoncpp.o \
build/related_data.o \
build/proxy.o \
build/netconf.o \
build/https_client.o \
build/websocket_client.o \
build/base_model.o \
build/user.o \
build/workspace.o \
build/client.o \
build/project.o \
build/task.o \
build/obm_action.o \
build/help_article.o \
build/time_entry.o \
build/tag.o \
build/batch_update_result.o \
build/formatter.o \
build/model_change.o \
build/database.o \
build/feedback.o \
build/error.o \
build/gui.o \
build/idle.o \
build/analytics.o \
build/autotracker.o \
build/settings.o \
build/urls.o \
build/timeline_event.o \
build/migrations.o \
build/context.o \
build/rectangle.o \
build/toggl_api_private.o \
build/toggl_api.o \
build/get_focused_window_$(osname).o \
build/timeline_uploader.o \
build/color_convert.o \
build/window_change_recorder.o \
build/onboarding_service.o \
build/alpha_features.o
test_objects: build/test/gtest-all.o \
build/test/test_data.o \
build/test/app_test.o \
build/test/toggl_api_test.o
uitest: clean_test
$(executable) \
--script-path $(pwd)/src/test/uitest.lua \
--log-path $(pwd)/test/uitest.log \
--db-path $(pwd)/test/uitest.db
toggl_test: clean_test objects test_objects
mkdir -p test
$(cxx) -coverage -o test/toggl_test build/*.o build/test/*.o $(libs)
test_lib: lua toggl_test
cp src/ssl/cacert.pem test/.
cp -r $(pocolib)/* test/.
cp $(openssldir)/libssl.1.1.dylib test/.
cp $(openssldir)/libcrypto.1.1.dylib test/.
install_name_tool -change /usr/local/lib/libPocoCrypto.$(pocoversion).dylib @loader_path/libPocoCrypto.$(pocoversion).dylib test/libPocoNetSSL.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoCrypto.$(pocoversion).dylib @loader_path/libPocoCrypto.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoData.$(pocoversion).dylib @loader_path/libPocoData.$(pocoversion).dylib test/libPocoDataSQLite.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoData.$(pocoversion).dylib @loader_path/libPocoData.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoData.$(pocoversion).dylib @loader_path/libPocoData.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoDataSQLite.$(pocoversion).dylib @loader_path/libPocoDataSQLite.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/libPocoCrypto.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/libPocoData.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/libPocoDataSQLite.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/libPocoNet.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/libPocoNetSSL.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/libPocoUtil.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/libPocoXML.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoFoundation.$(pocoversion).dylib @loader_path/libPocoFoundation.$(pocoversion).dylib test/libPocoJSON.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoJSON.$(pocoversion).dylib @loader_path/libPocoJSON.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoNet.$(pocoversion).dylib @loader_path/libPocoNet.$(pocoversion).dylib test/libPocoNetSSL.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoNet.$(pocoversion).dylib @loader_path/libPocoNet.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoNetSSL.$(pocoversion).dylib @loader_path/libPocoNetSSL.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoUtil.$(pocoversion).dylib @loader_path/libPocoUtil.$(pocoversion).dylib test/libPocoNetSSL.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoUtil.$(pocoversion).dylib @loader_path/libPocoUtil.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoXML.$(pocoversion).dylib @loader_path/libPocoXML.$(pocoversion).dylib test/toggl_test
install_name_tool -change /usr/local/lib/libPocoXML.$(pocoversion).dylib @loader_path/libPocoXML.$(pocoversion).dylib test/libPocoUtil.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libPocoJSON.$(pocoversion).dylib @loader_path/libPocoJSON.$(pocoversion).dylib test/libPocoUtil.$(pocoversion).dylib
install_name_tool -change /usr/local/lib/libssl.1.1.dylib @loader_path/libssl.1.1.dylib test/toggl_test
install_name_tool -change /usr/local/lib/libcrypto.1.1.dylib @loader_path/libcrypto.1.1.dylib test/toggl_test
cd test && ./toggl_test --gtest_shuffle
test: test_lib
lcov: test
lcov -q -d . -c -o app.info
genhtml -q -o coverage app.info
coverage: lcov
@echo "open coverage/index.html to view coverage report"
loco:
xcodebuild -exportLocalizations -localizationPath src/ui/osx/localization -project src/ui/osx/TogglDesktop/TogglDesktop.xcodeproj -exportLanguage et
package:
./src/ui/linux/package.sh
authors:
git log --all --format='%aN <%cE>' | sort -u > AUTHORS