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