Improve the code by static code analysis [2/3]: Performance
[amule.git] / src / Makefile.am
blobe955abd6e876e5ced325a09d15d0f1ba0d2fcb85
1 AM_CPPFLAGS = $(MULECPPFLAGS)
2 AM_CFLAGS = $(MULECFLAGS)
3 AM_CXXFLAGS = $(MULECXXFLAGS)
4 AM_LDFLAGS = $(MULELDFLAGS)
6 SUBDIRS = libs utils pixmaps
8 if WEB
9 # build webserver after current
10 SUBDIRS += . webserver
11 endif
13 if INSTALL_SKINS
14 SUBDIRS += skins
15 endif
17 EXTRA_DIST = \
18         aMule.xpm \
19         LibSocketAsio.cpp \
20         LibSocketWX.cpp \
21         Parser.y \
22         Scanner.h.in \
23         Scanner.l \
24         IPFilterScanner.l \
25         muuli.wdr
27 bin_PROGRAMS =
29 if MONOLITHIC
30 bin_PROGRAMS += amule
31 endif
33 if COMPILE_CMD
34 bin_PROGRAMS += amulecmd
35 endif
37 if ED2K
38 bin_PROGRAMS += ed2k
39 endif
41 if AMULE_GUI
42 bin_PROGRAMS += amulegui
43 endif
45 if AMULE_DAEMON
46 bin_PROGRAMS += amuled
47 endif
49 # Sources
50 noinst_LIBRARIES = libmulesocket.a
51 if MONOLITHIC
52 noinst_LIBRARIES += libmuleappcore.a libmuleappgui.a libmuleappcommon.a
53 else
54 if AMULE_DAEMON
55 noinst_LIBRARIES += libmuleappcore.a libmuleappcommon.a
56 else
57 if AMULE_GUI
58 noinst_LIBRARIES += libmuleappgui.a libmuleappcommon.a
59 endif
60 endif
61 endif
64 # Socket lib (WX or Asio)
66 libmulesocket_a_SOURCES = LibSocket.cpp
67 libmulesocket_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) $(BOOST_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include
70 # Common to core/gui/monolithic
72 libmuleappcommon_a_SOURCES = \
73         CFile.cpp \
74         ClientCredits.cpp \
75         ED2KLink.cpp \
76         Friend.cpp \
77         GapList.cpp \
78         MagnetURI.cpp \
79         MemFile.cpp \
80         NetworkFunctions.cpp \
81         OtherFunctions.cpp \
82         Packet.cpp \
83         RLE.cpp \
84         SafeFile.cpp \
85         SHA.cpp \
86         Tag.cpp \
87         TerminationProcess.cpp \
88         Timer.cpp
90 libmuleappcommon_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS)
93 # Common to core/monolithic
95 libmuleappcore_a_SOURCES = \
96         AsyncDNS.cpp \
97         DeadSourceList.cpp \
98         FileArea.cpp \
99         FileAutoClose.cpp \
100         IPFilterScanner.cpp \
101         Scanner.cpp \
102         Parser.cpp \
103         PlatformSpecific.cpp \
104         RandomFunctions.cpp \
105         RC4Encrypt.cpp \
106         StateMachine.cpp \
107         TerminationProcessAmuleweb.cpp \
108         ThreadScheduler.cpp \
109         UPnPBase.cpp \
110         kademlia/kademlia/Entry.cpp \
111         kademlia/kademlia/SearchManager.cpp \
112         kademlia/routing/RoutingBin.cpp \
113         kademlia/utils/UInt128.cpp
115 libmuleappcore_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS)
118 # Common to gui/monolithic
120 libmuleappgui_a_SOURCES = \
121         BarShader.cpp \
122         ColorFrameCtrl.cpp \
123         EditServerListDlg.cpp \
124         extern/wxWidgets/listctrl.cpp \
125         FileDetailListCtrl.cpp \
126         IP2Country.cpp \
127         MuleColour.cpp \
128         MuleGifCtrl.cpp \
129         MuleListCtrl.cpp \
130         MuleNotebook.cpp \
131         MuleTextCtrl.cpp \
132         MuleCollection.cpp \
133         muuli_wdr.cpp
135 libmuleappgui_a_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(LIBUPNP_CPPFLAGS) $(GEOIP_CPPFLAGS)
137 core_sources = \
138         amule.cpp \
139         BaseClient.cpp \
140         CanceledFileList.cpp \
141         ClientList.cpp \
142         ClientCreditsList.cpp \
143         ClientTCPSocket.cpp \
144         ClientUDPSocket.cpp \
145         CorruptionBlackBox.cpp \
146         DownloadClient.cpp \
147         DownloadQueue.cpp \
148         ECSpecialCoreTags.cpp \
149         EMSocket.cpp \
150         EncryptedStreamSocket.cpp \
151         EncryptedDatagramSocket.cpp \
152         ExternalConn.cpp \
153         FriendList.cpp \
154         IPFilter.cpp \
155         KnownFileList.cpp \
156         ListenSocket.cpp \
157         MuleUDPSocket.cpp \
158         SearchFile.cpp \
159         SearchList.cpp \
160         ServerConnect.cpp \
161         ServerList.cpp \
162         ServerSocket.cpp \
163         ServerUDPSocket.cpp \
164         SHAHashSet.cpp \
165         SharedFileList.cpp \
166         ThreadTasks.cpp \
167         UploadBandwidthThrottler.cpp \
168         UploadClient.cpp \
169         UploadQueue.cpp \
170         kademlia/kademlia/Indexed.cpp \
171         kademlia/kademlia/Kademlia.cpp \
172         kademlia/kademlia/Prefs.cpp \
173         kademlia/kademlia/Search.cpp \
174         kademlia/kademlia/UDPFirewallTester.cpp \
175         kademlia/net/KademliaUDPListener.cpp \
176         kademlia/net/PacketTracking.cpp \
177         kademlia/routing/Contact.cpp \
178         kademlia/routing/RoutingZone.cpp
181 gui_sources = \
182         amule-gui.cpp \
183         amuleDlg.cpp \
184         AddFriend.cpp \
185         CatDialog.cpp \
186         ChatSelector.cpp \
187         ChatWnd.cpp \
188         CommentDialog.cpp \
189         CommentDialogLst.cpp \
190         GenericClientListCtrl.cpp \
191         ClientDetailDialog.cpp \
192         DirectoryTreeCtrl.cpp \
193         FileDetailDialog.cpp \
194         KadDlg.cpp \
195         OScopeCtrl.cpp \
196         PrefsUnifiedDlg.cpp \
197         SearchDlg.cpp \
198         ServerWnd.cpp \
199         SharedFilesWnd.cpp \
200         StatisticsDlg.cpp \
201         SearchListCtrl.cpp \
202         DownloadListCtrl.cpp \
203         SourceListCtrl.cpp \
204         SharedFilePeersListCtrl.cpp \
205         FriendListCtrl.cpp \
206         ServerListCtrl.cpp \
207         SharedFilesCtrl.cpp \
208         MuleTrayIcon.cpp \
209         TransferWnd.cpp
212 common_sources = \
213         amuleAppCommon.cpp \
214         ClientRef.cpp \
215         DataToText.cpp \
216         ECSpecialMuleTags.cpp \
217         KnownFile.cpp \
218         GetTickCount.cpp \
219         GuiEvents.cpp \
220         HTTPDownload.cpp \
221         Logger.cpp \
222         PartFile.cpp \
223         Preferences.cpp \
224         Proxy.cpp \
225         Server.cpp \
226         Statistics.cpp \
227         StatTree.cpp \
228         UserEvents.cpp
230 # Libs
232 core_libs = -L. -lmuleappcore $(LIBUPNP_LDFLAGS) $(LIBUPNP_LIBS)
233 gui_libs = -L. -lmuleappgui $(WX_LIBS) $(GEOIP_LDFLAGS) $(GEOIP_LIBS)
234 remote_common_libs = -Llibs/common -Llibs/ec/cpp -lmulecommon -lec $(BFD_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(RESOLV_LIB)
235 common_libs = -L. -lmuleappcommon $(remote_common_libs) -lmulesocket $(BOOST_SYSTEM_LDFLAGS) $(BOOST_SYSTEM_LIBS) $(CRYPTOPP_LDFLAGS) $(CRYPTOPP_LIBS)
237 core_deps = libmuleappcore.a
238 gui_deps = libmuleappgui.a
239 remote_common_deps = libs/common/libmulecommon.a libs/ec/cpp/libec.a
240 common_deps = libmuleappcommon.a $(remote_common_deps) libmulesocket.a
242 if SYS_WIN32
243 core_libs += -lshlwapi
244 endif
247 # Flags
249 core_flags = $(LIBUPNP_CPPFLAGS) $(LIBUPNP_CFLAGS)
250 gui_flags = $(WX_CPPFLAGS) $(GEOIP_CPPFLAGS)
251 common_flags = -I$(srcdir)/libs -Ilibs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS)
253 # --------- Apps ---------
255 amulegui_SOURCES = \
256         amule-remote-gui.cpp \
257         $(gui_sources) \
258         $(ec_sources) \
259         $(common_sources)
261 amule_SOURCES = \
262         CaptchaDialog.cpp \
263         CaptchaGenerator.cpp \
264         PartFileConvert.cpp \
265         PartFileConvertDlg.cpp \
266         $(core_sources) \
267         $(gui_sources) \
268         $(ec_sources) \
269         $(common_sources)
271 amuled_SOURCES = \
272         amuled.cpp \
273         $(core_sources) \
274         $(ec_sources) \
275         $(common_sources)
277 amule_DEPENDENCIES = $(common_deps) $(core_deps) $(gui_deps)
278 amule_CPPFLAGS = $(AM_CPPFLAGS) $(core_flags) $(gui_flags) $(common_flags)
279 amule_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CPPFLAGS_ONLY)
280 amule_LDADD = $(common_libs) $(core_libs) $(gui_libs)
282 amulegui_DEPENDENCIES = $(common_deps) $(gui_deps)
283 amulegui_CPPFLAGS = $(AM_CPPFLAGS) $(gui_flags) $(common_flags) -DCLIENT_GUI
284 amulegui_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY)
285 amulegui_LDADD = $(common_libs) $(gui_libs)
287 amuled_DEPENDENCIES = $(core_deps) $(common_deps)
288 amuled_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) $(core_flags) $(common_flags) -DAMULE_DAEMON
289 amuled_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY)
290 amuled_LDADD = $(common_libs) $(core_libs) $(WXBASE_LIBS)
292 ed2k_SOURCES = \
293         ED2KLinkParser.cpp \
294         MagnetURI.cpp \
295         MuleCollection.cpp
297 ed2k_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_STD_STRING
299 # on Win32
300 if SYS_WIN32
301 ed2k_LDADD = -lshlwapi
302 endif
303 # on Mac
304 if NEED_CORESERVICES
305 ed2k_LDFLAGS = $(AM_LDFLAGS) -framework CoreServices
306 endif
308 amulecmd_SOURCES = \
309         TextClient.cpp \
310         ExternalConnector.cpp \
311         LoggerConsole.cpp \
312         OtherFunctions.cpp \
313         NetworkFunctions.cpp
315 amulecmd_DEPENDENCIES = $(remote_common_deps) libmulesocket.a
316 amulecmd_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) $(common_flags)
317 amulecmd_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY)
318 #amulecmd_LDADD = $(WXBASE_LIBS) $(READLINE_LIBS) $(remote_common_libs)
319 amulecmd_LDADD = -Llibs/common -Llibs/ec/cpp -L. -lmulecommon -lec -lmulesocket \
320         $(WXBASE_LIBS) $(READLINE_LIBS) $(BFD_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(RESOLV_LIB) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_SYSTEM_LIBS)
322 noinst_HEADERS = \
323                 AddFriend.h \
324                 AsyncDNS.h \
325                 amule-remote-gui.h \
326                 amuleDlg.h \
327                 amule.h \
328                 amuleIPV4Address.h \
329                 ArchSpecific.h \
330                 BarShader.h \
331                 BitVector.h \
332                 CanceledFileList.h \
333                 CaptchaDialog.h \
334                 CaptchaGenerator.h \
335                 CatDialog.h \
336                 CFile.h \
337                 ChatSelector.h \
338                 ChatWnd.h \
339                 ClientCredits.h \
340                 ClientCreditsList.h \
341                 ClientDetailDialog.h \
342                 SharedFilePeersListCtrl.h \
343                 ClientList.h \
344                 ClientRef.h \
345                 ClientTCPSocket.h \
346                 ClientUDPSocket.h \
347                 ColorFrameCtrl.h \
348                 CommentDialog.h \
349                 CommentDialogLst.h \
350                 Constants.h \
351                 CorruptionBlackBox.h \
352                 CryptoPP_Inc.h \
353                 DataToText.h \
354                 DeadSourceList.h \
355                 DirectoryTreeCtrl.h \
356                 DownloadListCtrl.h \
357                 DownloadQueue.h \
358                 ED2KLink.h \
359                 EditServerListDlg.h \
360                 EMSocket.h \
361                 EncryptedDatagramSocket.h \
362                 EncryptedStreamSocket.h \
363                 ExternalConnector.h \
364                 ExternalConn.h \
365                 FileArea.h \
366                 FileAutoClose.h \
367                 FileDetailDialog.h \
368                 FileDetailListCtrl.h \
369                 FileLock.h \
370                 Friend.h \
371                 FriendListCtrl.h \
372                 FriendList.h \
373                 GapList.h \
374                 GetTickCount.h \
375                 GenericClientListCtrl.h \
376                 GuiEvents.h \
377                 HTTPDownload.h \
378                 inetdownload.h \
379                 InternalEvents.h \
380                 IP2Country.h \
381                 IPFilter.h \
382                 IPFilterScanner.h \
383                 KadDlg.h \
384                 KnownFile.h \
385                 KnownFileList.h \
386                 LibSocket.h \
387                 ListenSocket.h \
388                 Logger.h \
389                 MagnetURI.h \
390                 MD4Hash.h \
391                 MemFile.h \
392                 MuleCollection.h \
393                 MuleColour.h \
394                 MuleGifCtrl.h \
395                 MuleListCtrl.h \
396                 MuleNotebook.h \
397                 MuleTextCtrl.h \
398                 MuleThread.h \
399                 MuleTrayIcon.h \
400                 MuleUDPSocket.h \
401                 muuli_wdr.h \
402                 NetworkFunctions.h \
403                 OScopeCtrl.h \
404                 Observable.h \
405                 ObservableQueue.h \
406                 OtherFunctions.h \
407                 OtherStructs.h \
408                 Packet.h \
409                 Parser.hpp \
410                 PartFileConvert.h \
411                 PartFileConvertDlg.h \
412                 PartFile.h \
413                 PlatformSpecific.h \
414                 Preferences.h \
415                 PrefsUnifiedDlg.h \
416                 Proxy.h \
417                 RangeMap.h \
418                 RC4Encrypt.h \
419                 RLE.h \
420                 RandomFunctions.h \
421                 SafeFile.h \
422                 Scanner.h \
423                 ScopedPtr.h \
424                 SearchDlg.h \
425                 SearchExpr.h \
426                 SearchFile.h \
427                 SearchListCtrl.h \
428                 SearchList.h \
429                 ServerConnect.h \
430                 Server.h \
431                 ServerListCtrl.h \
432                 ServerList.h \
433                 ServerSocket.h \
434                 ServerUDPSocket.h \
435                 ServerWnd.h \
436                 SHA.h \
437                 SHAHashSet.h \
438                 SharedFileList.h \
439                 SharedFilesCtrl.h \
440                 SharedFilesWnd.h \
441                 SourceListCtrl.h \
442                 StateMachine.h \
443                 StatisticsDlg.h \
444                 Statistics.h \
445                 StatTree.h \
446                 Tag.h \
447                 TerminationProcess.h \
448                 TerminationProcessAmuleweb.h \
449                 TextClient.h \
450                 ThreadScheduler.h \
451                 ThreadTasks.h \
452                 ThrottledSocket.h \
453                 Timer.h \
454                 TransferWnd.h \
455                 Types.h \
456                 updownclient.h \
457                 UpDownClientEC.h \
458                 UploadBandwidthThrottler.h \
459                 UploadQueue.h \
460                 UPnPBase.h \
461                 UPnPCompatibility.h \
462                 UserEvents.h \
463                 extern/wxWidgets/listctrl.h
465 MAINTAINERCLEANFILES = Makefile.in
467 $(srcdir)/Parser.cpp: Parser.y
468         bison --debug -t -d -v -o $@ $(srcdir)/Parser.y
470 if GENERATE_FLEX_HEADER
471 $(srcdir)/Scanner.cpp: Scanner.l Parser.cpp
472                 $(LEX) --header-file=$(srcdir)/Scanner.h -o $@ $(srcdir)/Scanner.l
473 else
474 $(srcdir)/Scanner.cpp: Scanner.l Parser.cpp
475                 $(LEX) -o $@ $(srcdir)/Scanner.l; \
476                 echo "// Empty file generated by a flex version unable to create headers" > $(srcdir)/Scanner.h
477 endif
479 $(srcdir)/IPFilterScanner.cpp: IPFilterScanner.l
480                 $(LEX) -Pyyip -o $@ $(srcdir)/IPFilterScanner.l;
482 # Resources
484 if NEED_RC
486 SUFFIXES = .rc
488 .rc.$(OBJEXT):
489         $(RC) $(MULERCFLAGS) -I$(top_srcdir) $(RCFLAGS) -O COFF -i "$<" -o "$@"
491 nodist_amuled_SOURCES = amuled-version.rc
492 nodist_amulecmd_SOURCES = amulecmd-version.rc
493 nodist_ed2k_SOURCES = ed2k-version.rc
494 amule_LDADD += amulerc.$(OBJEXT)
495 amule_DEPENDENCIES += amulerc.$(OBJEXT)
496 amulegui_LDADD += amuleguirc.$(OBJEXT)
497 amulegui_DEPENDENCIES += amuleguirc.$(OBJEXT)
499 amulerc.$(OBJEXT): $(srcdir)/../amule.rc amule-version.rc
500         cat $^ | \
501         ( \
502                 abs_builddir=`pwd` ; \
503                 abs_top_srcdir=`cd $(top_srcdir) ; pwd` ; \
504                 cd $(<D) ; \
505                 $(RC) $(MULERCFLAGS) -I$${abs_top_srcdir} $(RCFLAGS) -O COFF -o "$${abs_builddir}/$@" ; \
506         )
508 amuleguirc.$(OBJEXT): $(srcdir)/../amule.rc amulegui-version.rc
509         cat $^ | \
510         ( \
511                 abs_builddir=`pwd` ; \
512                 abs_top_srcdir=`cd $(top_srcdir) ; pwd` ; \
513                 cd $(<D) ; \
514                 $(RC) $(MULERCFLAGS) -I$${abs_top_srcdir} $(RCFLAGS) -O COFF -o "$${abs_builddir}/$@" ; \
515         )
517 amule-version.rc: $(top_builddir)/version.rc
518         @sed -e 's/VER_FILEDESCRIPTION_STR/"All-Platform P2P Client Based on eMule"/' \
519              -e 's/VER_INTERNALNAME_STR/"amule"/' \
520              -e 's/VER_ORIGINALFILENAME_STR/"amule$(EXEEXT)"/' "$<" > "$@"
522 amuled-version.rc: $(top_builddir)/version.rc
523         @sed -e 's/VER_FILEDESCRIPTION_STR/"aMule Daemon"/' \
524              -e 's/VER_INTERNALNAME_STR/"amuled"/' \
525              -e 's/VER_ORIGINALFILENAME_STR/"amuled$(EXEEXT)"/' "$<" > "$@"
527 amulecmd-version.rc: $(top_builddir)/version.rc
528         @sed -e 's/VER_FILEDESCRIPTION_STR/"aMule Text Client"/' \
529              -e 's/VER_INTERNALNAME_STR/"amulecmd"/' \
530              -e 's/VER_ORIGINALFILENAME_STR/"amulecmd$(EXEEXT)"/' "$<" > "$@"
532 amulegui-version.rc: $(top_builddir)/version.rc
533         @sed -e 's/VER_FILEDESCRIPTION_STR/"aMule Remote GUI (Experimental)"/' \
534              -e 's/VER_INTERNALNAME_STR/"amulegui"/' \
535              -e 's/VER_ORIGINALFILENAME_STR/"amulegui$(EXEEXT)"/' "$<" > "$@"
537 ed2k-version.rc: $(top_builddir)/version.rc
538         @sed -e 's/VER_FILEDESCRIPTION_STR/"ED2K Links Handler"/' \
539              -e 's/VER_INTERNALNAME_STR/"ed2k"/' \
540              -e 's/VER_ORIGINALFILENAME_STR/"ed2k$(EXEEXT)"/' "$<" > "$@"
542 CLEANFILES = *-version.rc
544 endif
547 EXTRA__DIST__SUBDIRS = include kademlia
548 include $(top_srcdir)/automake/dist-hook.am