1# Copyright (c) 2013-2016 The Bitcoin Core developers
2# Distributed under the MIT software license, see the accompanying
3# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5bin_PROGRAMS += qt/bitcoin-qt
6
7if BUILD_BITCOIN_GUI
8  bin_PROGRAMS += bitcoin-gui
9endif
10
11EXTRA_LIBRARIES += qt/libbitcoinqt.a
12
13# bitcoin qt core #
14include Makefile.qt_locale.include
15
16QT_FORMS_UI = \
17  qt/forms/addressbookpage.ui \
18  qt/forms/askpassphrasedialog.ui \
19  qt/forms/coincontroldialog.ui \
20  qt/forms/createwalletdialog.ui \
21  qt/forms/editaddressdialog.ui \
22  qt/forms/helpmessagedialog.ui \
23  qt/forms/intro.ui \
24  qt/forms/modaloverlay.ui \
25  qt/forms/openuridialog.ui \
26  qt/forms/optionsdialog.ui \
27  qt/forms/overviewpage.ui \
28  qt/forms/psbtoperationsdialog.ui \
29  qt/forms/receivecoinsdialog.ui \
30  qt/forms/receiverequestdialog.ui \
31  qt/forms/debugwindow.ui \
32  qt/forms/sendcoinsdialog.ui \
33  qt/forms/sendcoinsentry.ui \
34  qt/forms/signverifymessagedialog.ui \
35  qt/forms/transactiondescdialog.ui
36
37QT_MOC_CPP = \
38  qt/moc_addressbookpage.cpp \
39  qt/moc_addresstablemodel.cpp \
40  qt/moc_askpassphrasedialog.cpp \
41  qt/moc_createwalletdialog.cpp \
42  qt/moc_bantablemodel.cpp \
43  qt/moc_bitcoinaddressvalidator.cpp \
44  qt/moc_bitcoinamountfield.cpp \
45  qt/moc_bitcoin.cpp \
46  qt/moc_bitcoingui.cpp \
47  qt/moc_bitcoinunits.cpp \
48  qt/moc_clientmodel.cpp \
49  qt/moc_coincontroldialog.cpp \
50  qt/moc_coincontroltreewidget.cpp \
51  qt/moc_csvmodelwriter.cpp \
52  qt/moc_editaddressdialog.cpp \
53  qt/moc_guiutil.cpp \
54  qt/moc_intro.cpp \
55  qt/moc_macdockiconhandler.cpp \
56  qt/moc_macnotificationhandler.cpp \
57  qt/moc_modaloverlay.cpp \
58  qt/moc_notificator.cpp \
59  qt/moc_openuridialog.cpp \
60  qt/moc_optionsdialog.cpp \
61  qt/moc_optionsmodel.cpp \
62  qt/moc_overviewpage.cpp \
63  qt/moc_peertablemodel.cpp \
64  qt/moc_peertablesortproxy.cpp \
65  qt/moc_paymentserver.cpp \
66  qt/moc_psbtoperationsdialog.cpp \
67  qt/moc_qrimagewidget.cpp \
68  qt/moc_qvalidatedlineedit.cpp \
69  qt/moc_qvaluecombobox.cpp \
70  qt/moc_receivecoinsdialog.cpp \
71  qt/moc_receiverequestdialog.cpp \
72  qt/moc_recentrequeststablemodel.cpp \
73  qt/moc_rpcconsole.cpp \
74  qt/moc_sendcoinsdialog.cpp \
75  qt/moc_sendcoinsentry.cpp \
76  qt/moc_signverifymessagedialog.cpp \
77  qt/moc_splashscreen.cpp \
78  qt/moc_trafficgraphwidget.cpp \
79  qt/moc_transactiondesc.cpp \
80  qt/moc_transactiondescdialog.cpp \
81  qt/moc_transactionfilterproxy.cpp \
82  qt/moc_transactionoverviewwidget.cpp \
83  qt/moc_transactiontablemodel.cpp \
84  qt/moc_transactionview.cpp \
85  qt/moc_utilitydialog.cpp \
86  qt/moc_walletcontroller.cpp \
87  qt/moc_walletframe.cpp \
88  qt/moc_walletmodel.cpp \
89  qt/moc_walletview.cpp
90
91BITCOIN_MM = \
92  qt/macdockiconhandler.mm \
93  qt/macnotificationhandler.mm \
94  qt/macos_appnap.mm
95
96QT_MOC = \
97  qt/bitcoinamountfield.moc \
98  qt/intro.moc \
99  qt/overviewpage.moc \
100  qt/rpcconsole.moc
101
102QT_QRC_CPP = qt/qrc_bitcoin.cpp
103QT_QRC = qt/bitcoin.qrc
104QT_QRC_LOCALE_CPP = qt/qrc_bitcoin_locale.cpp
105QT_QRC_LOCALE = qt/bitcoin_locale.qrc
106
107BITCOIN_QT_H = \
108  qt/addressbookpage.h \
109  qt/addresstablemodel.h \
110  qt/askpassphrasedialog.h \
111  qt/bantablemodel.h \
112  qt/bitcoinaddressvalidator.h \
113  qt/bitcoinamountfield.h \
114  qt/bitcoin.h \
115  qt/bitcoingui.h \
116  qt/bitcoinunits.h \
117  qt/clientmodel.h \
118  qt/coincontroldialog.h \
119  qt/coincontroltreewidget.h \
120  qt/createwalletdialog.h \
121  qt/csvmodelwriter.h \
122  qt/editaddressdialog.h \
123  qt/guiconstants.h \
124  qt/guiutil.h \
125  qt/intro.h \
126  qt/macdockiconhandler.h \
127  qt/macnotificationhandler.h \
128  qt/macos_appnap.h \
129  qt/modaloverlay.h \
130  qt/networkstyle.h \
131  qt/notificator.h \
132  qt/openuridialog.h \
133  qt/optionsdialog.h \
134  qt/optionsmodel.h \
135  qt/overviewpage.h \
136  qt/paymentserver.h \
137  qt/peertablemodel.h \
138  qt/peertablesortproxy.h \
139  qt/platformstyle.h \
140  qt/psbtoperationsdialog.h \
141  qt/qrimagewidget.h \
142  qt/qvalidatedlineedit.h \
143  qt/qvaluecombobox.h \
144  qt/receivecoinsdialog.h \
145  qt/receiverequestdialog.h \
146  qt/recentrequeststablemodel.h \
147  qt/rpcconsole.h \
148  qt/sendcoinsdialog.h \
149  qt/sendcoinsentry.h \
150  qt/sendcoinsrecipient.h \
151  qt/signverifymessagedialog.h \
152  qt/splashscreen.h \
153  qt/trafficgraphwidget.h \
154  qt/transactiondesc.h \
155  qt/transactiondescdialog.h \
156  qt/transactionfilterproxy.h \
157  qt/transactionoverviewwidget.h \
158  qt/transactionrecord.h \
159  qt/transactiontablemodel.h \
160  qt/transactionview.h \
161  qt/utilitydialog.h \
162  qt/walletcontroller.h \
163  qt/walletframe.h \
164  qt/walletmodel.h \
165  qt/walletmodeltransaction.h \
166  qt/walletview.h \
167  qt/winshutdownmonitor.h
168
169RES_FONTS = \
170  qt/res/fonts/RobotoMono-Bold.ttf
171
172RES_ICONS = \
173  qt/res/icons/add.png \
174  qt/res/icons/address-book.png \
175  qt/res/icons/bitcoin.ico \
176  qt/res/icons/bitcoin_testnet.ico \
177  qt/res/icons/bitcoin.png \
178  qt/res/icons/chevron.png \
179  qt/res/icons/clock1.png \
180  qt/res/icons/clock2.png \
181  qt/res/icons/clock3.png \
182  qt/res/icons/clock4.png \
183  qt/res/icons/clock5.png \
184  qt/res/icons/connect0.png \
185  qt/res/icons/connect1.png \
186  qt/res/icons/connect2.png \
187  qt/res/icons/connect3.png \
188  qt/res/icons/connect4.png \
189  qt/res/icons/edit.png \
190  qt/res/icons/editcopy.png \
191  qt/res/icons/editpaste.png \
192  qt/res/icons/export.png \
193  qt/res/icons/eye.png \
194  qt/res/icons/eye_minus.png \
195  qt/res/icons/eye_plus.png \
196  qt/res/icons/fontbigger.png \
197  qt/res/icons/fontsmaller.png \
198  qt/res/icons/hd_disabled.png \
199  qt/res/icons/hd_enabled.png \
200  qt/res/icons/history.png \
201  qt/res/icons/lock_closed.png \
202  qt/res/icons/lock_open.png \
203  qt/res/icons/network_disabled.png \
204  qt/res/icons/overview.png \
205  qt/res/icons/proxy.png \
206  qt/res/icons/receive.png \
207  qt/res/icons/remove.png \
208  qt/res/icons/send.png \
209  qt/res/icons/synced.png \
210  qt/res/icons/transaction0.png \
211  qt/res/icons/transaction2.png \
212  qt/res/icons/transaction_abandoned.png \
213  qt/res/icons/transaction_conflicted.png \
214  qt/res/icons/tx_inout.png \
215  qt/res/icons/tx_input.png \
216  qt/res/icons/tx_output.png \
217  qt/res/icons/tx_mined.png \
218  qt/res/icons/warning.png
219
220BITCOIN_QT_BASE_CPP = \
221  qt/bantablemodel.cpp \
222  qt/bitcoin.cpp \
223  qt/bitcoinaddressvalidator.cpp \
224  qt/bitcoinamountfield.cpp \
225  qt/bitcoingui.cpp \
226  qt/bitcoinunits.cpp \
227  qt/clientmodel.cpp \
228  qt/csvmodelwriter.cpp \
229  qt/guiutil.cpp \
230  qt/intro.cpp \
231  qt/modaloverlay.cpp \
232  qt/networkstyle.cpp \
233  qt/notificator.cpp \
234  qt/optionsdialog.cpp \
235  qt/optionsmodel.cpp \
236  qt/peertablemodel.cpp \
237  qt/peertablesortproxy.cpp \
238  qt/platformstyle.cpp \
239  qt/qvalidatedlineedit.cpp \
240  qt/qvaluecombobox.cpp \
241  qt/rpcconsole.cpp \
242  qt/splashscreen.cpp \
243  qt/trafficgraphwidget.cpp \
244  qt/utilitydialog.cpp
245
246BITCOIN_QT_WINDOWS_CPP = qt/winshutdownmonitor.cpp
247
248BITCOIN_QT_WALLET_CPP = \
249  qt/addressbookpage.cpp \
250  qt/addresstablemodel.cpp \
251  qt/askpassphrasedialog.cpp \
252  qt/coincontroldialog.cpp \
253  qt/coincontroltreewidget.cpp \
254  qt/createwalletdialog.cpp \
255  qt/editaddressdialog.cpp \
256  qt/openuridialog.cpp \
257  qt/overviewpage.cpp \
258  qt/paymentserver.cpp \
259  qt/psbtoperationsdialog.cpp \
260  qt/qrimagewidget.cpp \
261  qt/receivecoinsdialog.cpp \
262  qt/receiverequestdialog.cpp \
263  qt/recentrequeststablemodel.cpp \
264  qt/sendcoinsdialog.cpp \
265  qt/sendcoinsentry.cpp \
266  qt/signverifymessagedialog.cpp \
267  qt/transactiondesc.cpp \
268  qt/transactiondescdialog.cpp \
269  qt/transactionfilterproxy.cpp \
270  qt/transactionrecord.cpp \
271  qt/transactiontablemodel.cpp \
272  qt/transactionview.cpp \
273  qt/walletcontroller.cpp \
274  qt/walletframe.cpp \
275  qt/walletmodel.cpp \
276  qt/walletmodeltransaction.cpp \
277  qt/walletview.cpp
278
279BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
280if TARGET_WINDOWS
281BITCOIN_QT_CPP += $(BITCOIN_QT_WINDOWS_CPP)
282endif
283if ENABLE_WALLET
284BITCOIN_QT_CPP += $(BITCOIN_QT_WALLET_CPP)
285endif # ENABLE_WALLET
286
287RES_ANIMATION = $(wildcard $(srcdir)/qt/res/animation/spinner-*.png)
288
289BITCOIN_RC = qt/res/bitcoin-qt-res.rc
290
291BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER
292
293qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
294  $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS)
295qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
296qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS)
297
298qt_libbitcoinqt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \
299  $(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(RES_FONTS) $(RES_ICONS) $(RES_ANIMATION)
300if TARGET_DARWIN
301  qt_libbitcoinqt_a_SOURCES += $(BITCOIN_MM)
302endif
303
304nodist_qt_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP)
305
306# forms/foo.h -> forms/ui_foo.h
307QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:.ui=.h))))
308
309# Most files will depend on the forms and moc files as includes. Generate them
310# before anything else.
311$(QT_MOC): $(QT_FORMS_H)
312$(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) $(bitcoin_gui_OBJECTS) : | $(QT_MOC)
313
314# bitcoin-qt and bitcoin-gui binaries #
315bitcoin_qt_cppflags = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
316  $(QT_INCLUDES) $(QR_CFLAGS)
317bitcoin_qt_cxxflags = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
318
319bitcoin_qt_sources = qt/main.cpp
320if TARGET_WINDOWS
321  bitcoin_qt_sources += $(BITCOIN_RC)
322endif
323bitcoin_qt_ldadd = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER)
324if ENABLE_WALLET
325bitcoin_qt_ldadd += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET)
326endif
327if ENABLE_ZMQ
328bitcoin_qt_ldadd += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
329endif
330bitcoin_qt_ldadd += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
331  $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(NATPMP_LIBS) $(LIBSECP256K1) \
332  $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(SQLITE_LIBS)
333bitcoin_qt_ldflags = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
334bitcoin_qt_libtoolflags = $(AM_LIBTOOLFLAGS) --tag CXX
335
336qt_bitcoin_qt_CPPFLAGS = $(bitcoin_qt_cppflags)
337qt_bitcoin_qt_CXXFLAGS = $(bitcoin_qt_cxxflags)
338qt_bitcoin_qt_SOURCES = $(bitcoin_qt_sources)
339qt_bitcoin_qt_LDADD = $(bitcoin_qt_ldadd)
340qt_bitcoin_qt_LDFLAGS = $(bitcoin_qt_ldflags)
341qt_bitcoin_qt_LIBTOOLFLAGS = $(bitcoin_qt_libtoolflags)
342
343bitcoin_gui_CPPFLAGS = $(bitcoin_qt_cppflags)
344bitcoin_gui_CXXFLAGS = $(bitcoin_qt_cxxflags)
345bitcoin_gui_SOURCES = $(bitcoin_qt_sources)
346bitcoin_gui_LDADD = $(bitcoin_qt_ldadd)
347bitcoin_gui_LDFLAGS = $(bitcoin_qt_ldflags)
348bitcoin_gui_LIBTOOLFLAGS = $(bitcoin_qt_libtoolflags)
349
350#locale/foo.ts -> locale/foo.qm
351QT_QM=$(QT_TS:.ts=.qm)
352
353SECONDARY: $(QT_QM)
354
355$(srcdir)/qt/bitcoinstrings.cpp: FORCE
356	@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
357	$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) COPYRIGHT_HOLDERS="$(COPYRIGHT_HOLDERS)" $(PYTHON) ../share/qt/extract_strings_qt.py $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES) $(libbitcoin_common_a_SOURCES) $(libbitcoin_zmq_a_SOURCES) $(libbitcoin_consensus_a_SOURCES) $(libbitcoin_util_a_SOURCES)
358
359translate: $(srcdir)/qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_BASE_CPP) qt/bitcoin.cpp $(BITCOIN_QT_WINDOWS_CPP) $(BITCOIN_QT_WALLET_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
360	@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
361	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) -no-obsolete -I $(srcdir) -locations relative $^ -ts $(srcdir)/qt/locale/bitcoin_en.ts
362	@test -n $(LCONVERT) || echo "lconvert is required for updating translations"
363	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LCONVERT) -o $(srcdir)/qt/locale/bitcoin_en.xlf -i $(srcdir)/qt/locale/bitcoin_en.ts
364
365$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
366	@test -f $(RCC)
367	@cp -f $< $(@D)/temp_$(<F)
368	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin_locale --format-version 1 $(@D)/temp_$(<F) > $@
369	@rm $(@D)/temp_$(<F)
370
371$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_FONTS) $(RES_ICONS) $(RES_ANIMATION)
372	@test -f $(RCC)
373	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin --format-version 1 $< > $@
374
375CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc
376
377CLEANFILES += $(CLEAN_QT)
378
379bitcoin_qt_clean: FORCE
380	rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) qt/bitcoin-qt$(EXEEXT) $(LIBBITCOINQT)
381
382bitcoin_qt : qt/bitcoin-qt$(EXEEXT)
383
384APK_LIB_DIR = qt/android/libs/$(ANDROID_ARCH)
385QT_BASE_VERSION = $(lastword $(shell $(MOC) --version))
386QT_BASE_PATH = $(shell find ../depends/sources/ -maxdepth 1 -type f -regex ".*qtbase.*$(QT_BASE_VERSION)\.tar.xz")
387QT_BASE_TLD = $(shell tar tf $(QT_BASE_PATH) --exclude='*/*')
388
389bitcoin_qt_apk: FORCE
390	mkdir -p $(APK_LIB_DIR)
391	cp $(dir $(CC))../sysroot/usr/lib/$(host_alias)/libc++_shared.so $(APK_LIB_DIR)
392	tar xf $(QT_BASE_PATH) -C qt/android/src/ $(QT_BASE_TLD)src/android/jar/src --strip-components=5
393	tar xf $(QT_BASE_PATH) -C qt/android/src/ $(QT_BASE_TLD)src/android/java/src --strip-components=5
394	tar xf $(QT_BASE_PATH) -C qt/android/res/ $(QT_BASE_TLD)src/android/java/res --strip-components=5
395	cp qt/bitcoin-qt $(APK_LIB_DIR)/libbitcoin-qt.so
396	cd qt/android && gradle wrapper --gradle-version=6.6.1
397	cd qt/android && ./gradlew build
398
399ui_%.h: %.ui
400	@test -f $(UIC)
401	@$(MKDIR_P) $(@D)
402	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(UIC) -o $@ $< || (echo "Error creating $@"; false)
403
404%.moc: %.cpp
405	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES_UNSUPPRESSED) $(MOC_DEFS) $< > $@
406
407moc_%.cpp: %.h
408	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES_UNSUPPRESSED) $(MOC_DEFS) $< > $@
409
410%.qm: %.ts
411	@test -f $(LRELEASE)
412	@$(MKDIR_P) $(@D)
413	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@
414