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/namecoin-qt
6
7if BUILD_BITCOIN_GUI
8  bin_PROGRAMS += namecoin-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_paymentserver.cpp \
65  qt/moc_psbtoperationsdialog.cpp \
66  qt/moc_qrimagewidget.cpp \
67  qt/moc_qvalidatedlineedit.cpp \
68  qt/moc_qvaluecombobox.cpp \
69  qt/moc_receivecoinsdialog.cpp \
70  qt/moc_receiverequestdialog.cpp \
71  qt/moc_recentrequeststablemodel.cpp \
72  qt/moc_rpcconsole.cpp \
73  qt/moc_sendcoinsdialog.cpp \
74  qt/moc_sendcoinsentry.cpp \
75  qt/moc_signverifymessagedialog.cpp \
76  qt/moc_splashscreen.cpp \
77  qt/moc_trafficgraphwidget.cpp \
78  qt/moc_transactiondesc.cpp \
79  qt/moc_transactiondescdialog.cpp \
80  qt/moc_transactionfilterproxy.cpp \
81  qt/moc_transactiontablemodel.cpp \
82  qt/moc_transactionview.cpp \
83  qt/moc_utilitydialog.cpp \
84  qt/moc_walletcontroller.cpp \
85  qt/moc_walletframe.cpp \
86  qt/moc_walletmodel.cpp \
87  qt/moc_walletview.cpp
88
89BITCOIN_MM = \
90  qt/macdockiconhandler.mm \
91  qt/macnotificationhandler.mm \
92  qt/macos_appnap.mm
93
94QT_MOC = \
95  qt/bitcoinamountfield.moc \
96  qt/intro.moc \
97  qt/overviewpage.moc \
98  qt/rpcconsole.moc
99
100QT_QRC_CPP = qt/qrc_bitcoin.cpp
101QT_QRC = qt/bitcoin.qrc
102QT_QRC_LOCALE_CPP = qt/qrc_bitcoin_locale.cpp
103QT_QRC_LOCALE = qt/bitcoin_locale.qrc
104
105BITCOIN_QT_H = \
106  qt/addressbookpage.h \
107  qt/addresstablemodel.h \
108  qt/askpassphrasedialog.h \
109  qt/bantablemodel.h \
110  qt/bitcoinaddressvalidator.h \
111  qt/bitcoinamountfield.h \
112  qt/bitcoin.h \
113  qt/bitcoingui.h \
114  qt/bitcoinunits.h \
115  qt/clientmodel.h \
116  qt/coincontroldialog.h \
117  qt/coincontroltreewidget.h \
118  qt/createwalletdialog.h \
119  qt/csvmodelwriter.h \
120  qt/editaddressdialog.h \
121  qt/guiconstants.h \
122  qt/guiutil.h \
123  qt/intro.h \
124  qt/macdockiconhandler.h \
125  qt/macnotificationhandler.h \
126  qt/macos_appnap.h \
127  qt/modaloverlay.h \
128  qt/networkstyle.h \
129  qt/notificator.h \
130  qt/openuridialog.h \
131  qt/optionsdialog.h \
132  qt/optionsmodel.h \
133  qt/overviewpage.h \
134  qt/paymentserver.h \
135  qt/peertablemodel.h \
136  qt/platformstyle.h \
137  qt/psbtoperationsdialog.h \
138  qt/qrimagewidget.h \
139  qt/qvalidatedlineedit.h \
140  qt/qvaluecombobox.h \
141  qt/receivecoinsdialog.h \
142  qt/receiverequestdialog.h \
143  qt/recentrequeststablemodel.h \
144  qt/rpcconsole.h \
145  qt/sendcoinsdialog.h \
146  qt/sendcoinsentry.h \
147  qt/sendcoinsrecipient.h \
148  qt/signverifymessagedialog.h \
149  qt/splashscreen.h \
150  qt/trafficgraphwidget.h \
151  qt/transactiondesc.h \
152  qt/transactiondescdialog.h \
153  qt/transactionfilterproxy.h \
154  qt/transactionrecord.h \
155  qt/transactiontablemodel.h \
156  qt/transactionview.h \
157  qt/utilitydialog.h \
158  qt/walletcontroller.h \
159  qt/walletframe.h \
160  qt/walletmodel.h \
161  qt/walletmodeltransaction.h \
162  qt/walletview.h \
163  qt/winshutdownmonitor.h
164
165RES_ICONS = \
166  qt/res/icons/add.png \
167  qt/res/icons/address-book.png \
168  qt/res/icons/bitcoin.ico \
169  qt/res/icons/bitcoin_testnet.ico \
170  qt/res/icons/bitcoin.png \
171  qt/res/icons/chevron.png \
172  qt/res/icons/clock1.png \
173  qt/res/icons/clock2.png \
174  qt/res/icons/clock3.png \
175  qt/res/icons/clock4.png \
176  qt/res/icons/clock5.png \
177  qt/res/icons/connect0.png \
178  qt/res/icons/connect1.png \
179  qt/res/icons/connect2.png \
180  qt/res/icons/connect3.png \
181  qt/res/icons/connect4.png \
182  qt/res/icons/edit.png \
183  qt/res/icons/editcopy.png \
184  qt/res/icons/editpaste.png \
185  qt/res/icons/export.png \
186  qt/res/icons/eye.png \
187  qt/res/icons/eye_minus.png \
188  qt/res/icons/eye_plus.png \
189  qt/res/icons/fontbigger.png \
190  qt/res/icons/fontsmaller.png \
191  qt/res/icons/hd_disabled.png \
192  qt/res/icons/hd_enabled.png \
193  qt/res/icons/history.png \
194  qt/res/icons/lock_closed.png \
195  qt/res/icons/lock_open.png \
196  qt/res/icons/network_disabled.png \
197  qt/res/icons/overview.png \
198  qt/res/icons/proxy.png \
199  qt/res/icons/receive.png \
200  qt/res/icons/remove.png \
201  qt/res/icons/send.png \
202  qt/res/icons/synced.png \
203  qt/res/icons/transaction0.png \
204  qt/res/icons/transaction2.png \
205  qt/res/icons/transaction_abandoned.png \
206  qt/res/icons/transaction_conflicted.png \
207  qt/res/icons/tx_inout.png \
208  qt/res/icons/tx_input.png \
209  qt/res/icons/tx_output.png \
210  qt/res/icons/tx_mined.png \
211  qt/res/icons/warning.png
212
213BITCOIN_QT_BASE_CPP = \
214  qt/bantablemodel.cpp \
215  qt/bitcoin.cpp \
216  qt/bitcoinaddressvalidator.cpp \
217  qt/bitcoinamountfield.cpp \
218  qt/bitcoingui.cpp \
219  qt/bitcoinunits.cpp \
220  qt/clientmodel.cpp \
221  qt/csvmodelwriter.cpp \
222  qt/guiutil.cpp \
223  qt/intro.cpp \
224  qt/modaloverlay.cpp \
225  qt/networkstyle.cpp \
226  qt/notificator.cpp \
227  qt/optionsdialog.cpp \
228  qt/optionsmodel.cpp \
229  qt/peertablemodel.cpp \
230  qt/platformstyle.cpp \
231  qt/qvalidatedlineedit.cpp \
232  qt/qvaluecombobox.cpp \
233  qt/rpcconsole.cpp \
234  qt/splashscreen.cpp \
235  qt/trafficgraphwidget.cpp \
236  qt/utilitydialog.cpp
237
238BITCOIN_QT_WINDOWS_CPP = qt/winshutdownmonitor.cpp
239
240BITCOIN_QT_WALLET_CPP = \
241  qt/addressbookpage.cpp \
242  qt/addresstablemodel.cpp \
243  qt/askpassphrasedialog.cpp \
244  qt/coincontroldialog.cpp \
245  qt/coincontroltreewidget.cpp \
246  qt/createwalletdialog.cpp \
247  qt/editaddressdialog.cpp \
248  qt/openuridialog.cpp \
249  qt/overviewpage.cpp \
250  qt/paymentserver.cpp \
251  qt/psbtoperationsdialog.cpp \
252  qt/qrimagewidget.cpp \
253  qt/receivecoinsdialog.cpp \
254  qt/receiverequestdialog.cpp \
255  qt/recentrequeststablemodel.cpp \
256  qt/sendcoinsdialog.cpp \
257  qt/sendcoinsentry.cpp \
258  qt/signverifymessagedialog.cpp \
259  qt/transactiondesc.cpp \
260  qt/transactiondescdialog.cpp \
261  qt/transactionfilterproxy.cpp \
262  qt/transactionrecord.cpp \
263  qt/transactiontablemodel.cpp \
264  qt/transactionview.cpp \
265  qt/walletcontroller.cpp \
266  qt/walletframe.cpp \
267  qt/walletmodel.cpp \
268  qt/walletmodeltransaction.cpp \
269  qt/walletview.cpp
270
271BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
272if TARGET_WINDOWS
273BITCOIN_QT_CPP += $(BITCOIN_QT_WINDOWS_CPP)
274endif
275if ENABLE_WALLET
276BITCOIN_QT_CPP += $(BITCOIN_QT_WALLET_CPP)
277endif # ENABLE_WALLET
278
279RES_ANIMATION = $(wildcard $(srcdir)/qt/res/animation/spinner-*.png)
280
281BITCOIN_RC = qt/res/bitcoin-qt-res.rc
282
283BITCOIN_QT_INCLUDES = -DQT_NO_KEYWORDS
284
285qt_libbitcoinqt_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
286  $(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(QR_CFLAGS)
287qt_libbitcoinqt_a_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
288qt_libbitcoinqt_a_OBJCXXFLAGS = $(AM_OBJCXXFLAGS) $(QT_PIE_FLAGS)
289
290qt_libbitcoinqt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \
291  $(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(RES_ICONS) $(RES_ANIMATION)
292if TARGET_DARWIN
293  qt_libbitcoinqt_a_SOURCES += $(BITCOIN_MM)
294endif
295
296nodist_qt_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP)
297
298# forms/foo.h -> forms/ui_foo.h
299QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:.ui=.h))))
300
301# Most files will depend on the forms and moc files as includes. Generate them
302# before anything else.
303$(QT_MOC): $(QT_FORMS_H)
304$(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) $(bitcoin_gui_OBJECTS) : | $(QT_MOC)
305
306# bitcoin-qt and bitcoin-gui binaries #
307bitcoin_qt_cppflags = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
308  $(QT_INCLUDES) $(QR_CFLAGS)
309bitcoin_qt_cxxflags = $(AM_CXXFLAGS) $(QT_PIE_FLAGS)
310
311bitcoin_qt_sources = qt/main.cpp
312if TARGET_WINDOWS
313  bitcoin_qt_sources += $(BITCOIN_RC)
314endif
315bitcoin_qt_ldadd = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER)
316if ENABLE_WALLET
317bitcoin_qt_ldadd += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET)
318endif
319if ENABLE_ZMQ
320bitcoin_qt_ldadd += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
321endif
322bitcoin_qt_ldadd += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \
323  $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(BDB_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \
324  $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) $(SQLITE_LIBS)
325bitcoin_qt_ldflags = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) $(PTHREAD_FLAGS)
326bitcoin_qt_libtoolflags = $(AM_LIBTOOLFLAGS) --tag CXX
327
328qt_namecoin_qt_CPPFLAGS = $(bitcoin_qt_cppflags)
329qt_namecoin_qt_CXXFLAGS = $(bitcoin_qt_cxxflags)
330qt_namecoin_qt_SOURCES = $(bitcoin_qt_sources)
331qt_namecoin_qt_LDADD = $(bitcoin_qt_ldadd)
332qt_namecoin_qt_LDFLAGS = $(bitcoin_qt_ldflags)
333qt_namecoin_qt_LIBTOOLFLAGS = $(bitcoin_qt_libtoolflags)
334
335namecoin_gui_CPPFLAGS = $(bitcoin_qt_cppflags)
336namecoin_gui_CXXFLAGS = $(bitcoin_qt_cxxflags)
337namecoin_gui_SOURCES = $(bitcoin_qt_sources)
338namecoin_gui_LDADD = $(bitcoin_qt_ldadd)
339namecoin_gui_LDFLAGS = $(bitcoin_qt_ldflags)
340namecoin_gui_LIBTOOLFLAGS = $(bitcoin_qt_libtoolflags)
341
342#locale/foo.ts -> locale/foo.qm
343QT_QM=$(QT_TS:.ts=.qm)
344
345SECONDARY: $(QT_QM)
346
347$(srcdir)/qt/bitcoinstrings.cpp: FORCE
348	@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
349	$(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)
350
351translate: $(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)
352	@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
353	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts $(srcdir)/qt/locale/bitcoin_en.ts
354
355$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
356	@test -f $(RCC)
357	@cp -f $< $(@D)/temp_$(<F)
358	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin_locale $(@D)/temp_$(<F) | \
359	  $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
360	@rm $(@D)/temp_$(<F)
361
362$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_ICONS) $(RES_ANIMATION)
363	@test -f $(RCC)
364	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \
365	  $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
366
367CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc
368
369CLEANFILES += $(CLEAN_QT)
370
371namecoin_qt_clean: FORCE
372	rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_namecoin_qt_OBJECTS) qt/namecoin-qt$(EXEEXT) $(LIBBITCOINQT)
373
374namecoin_qt : qt/namecoin-qt$(EXEEXT)
375
376ui_%.h: %.ui
377	@test -f $(UIC)
378	@$(MKDIR_P) $(@D)
379	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(UIC) -o $@ $< || (echo "Error creating $@"; false)
380
381%.moc: %.cpp
382	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES_UNSUPPRESSED) $(MOC_DEFS) $< | \
383	  $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
384
385moc_%.cpp: %.h
386	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(DEFAULT_INCLUDES) $(QT_INCLUDES_UNSUPPRESSED) $(MOC_DEFS) $< | \
387	  $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
388
389%.qm: %.ts
390	@test -f $(LRELEASE)
391	@$(MKDIR_P) $(@D)
392	$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@
393