1AM_CPPFLAGS = $(MULECPPFLAGS)
2AM_CFLAGS = $(MULECFLAGS)
3AM_CXXFLAGS = $(MULECXXFLAGS)
4AM_LDFLAGS = $(MULELDFLAGS)
5
6SUBDIRS = libs utils pixmaps
7
8if WEB
9SUBDIRS += webserver
10endif
11
12if INSTALL_SKINS
13SUBDIRS += skins
14endif
15
16EXTRA_DIST = \
17	aMule.xpm \
18	Parser.y \
19	Scanner.h.in \
20	Scanner.l \
21	IPFilterScanner.l \
22	muuli.wdr 
23
24bin_PROGRAMS = 
25
26if MONOLITHIC
27bin_PROGRAMS += amule
28endif
29
30if COMPILE_CMD
31bin_PROGRAMS += amulecmd   
32endif
33
34if ED2K
35bin_PROGRAMS += ed2k
36endif
37
38if AMULE_GUI
39bin_PROGRAMS += amulegui
40endif
41
42if AMULE_DAEMON
43bin_PROGRAMS += amuled
44endif
45
46# Sources
47noinst_LIBRARIES =
48if MONOLITHIC
49noinst_LIBRARIES += libmuleappcore.a libmuleappgui.a libmuleappcommon.a
50else
51if AMULE_DAEMON
52noinst_LIBRARIES += libmuleappcore.a libmuleappcommon.a
53else
54if AMULE_GUI
55noinst_LIBRARIES += libmuleappgui.a libmuleappcommon.a
56endif
57endif
58endif
59
60
61# Common to core/gui/monolithic
62
63libmuleappcommon_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
80
81libmuleappcommon_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS)
82
83
84# Common to core/monolithic
85
86libmuleappcore_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
105
106libmuleappcore_a_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS) $(LIBUPNP_CPPFLAGS)
107
108
109# Common to gui/monolithic
110
111libmuleappgui_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 
125
126libmuleappgui_a_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CPPFLAGS) -I$(srcdir)/libs -I$(srcdir)/include $(LIBUPNP_CPPFLAGS) $(GEOIP_CPPFLAGS)
127
128core_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
170
171
172gui_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 
201
202
203common_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
220
221# Libs
222
223core_libs = -L. -lmuleappcore $(LIBUPNP_LDFLAGS) $(LIBUPNP_LIBS)
224gui_libs = -L. -lmuleappgui $(WX_LIBS) $(GEOIP_LDFLAGS) $(GEOIP_LIBS)
225remote_common_libs = -Llibs/common -Llibs/ec/cpp -lmulecommon -lec $(BFD_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(RESOLV_LIB)
226common_libs = -L. -lmuleappcommon $(remote_common_libs) $(CRYPTOPP_LDFLAGS) $(CRYPTOPP_LIBS)
227
228core_deps = libmuleappcore.a
229gui_deps = libmuleappgui.a
230remote_common_deps = libs/common/libmulecommon.a libs/ec/cpp/libec.a
231common_deps = libmuleappcommon.a $(remote_common_deps)
232
233if SYS_WIN32
234core_libs += -lshlwapi
235endif
236
237#
238# Flags
239#
240core_flags = $(LIBUPNP_CPPFLAGS) $(LIBUPNP_CFLAGS)
241gui_flags = $(WX_CPPFLAGS) $(GEOIP_CPPFLAGS)
242common_flags = -I$(srcdir)/libs -Ilibs -I$(srcdir)/include $(CRYPTOPP_CPPFLAGS)
243
244# --------- Apps ---------
245
246amulegui_SOURCES = \
247	amule-remote-gui.cpp \
248	$(gui_sources) \
249	$(ec_sources) \
250	$(common_sources)
251
252amule_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)
261
262amuled_SOURCES = \
263	amuled.cpp \
264	$(core_sources) \
265	$(ec_sources) \
266	$(common_sources)
267
268amule_DEPENDENCIES = $(common_deps) $(core_deps) $(gui_deps)
269amule_CPPFLAGS = $(AM_CPPFLAGS) $(core_flags) $(gui_flags) $(common_flags)
270amule_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CPPFLAGS_ONLY)
271amule_LDADD = $(common_libs) $(core_libs) $(gui_libs)
272
273amulegui_DEPENDENCIES = $(common_deps) $(gui_deps)
274amulegui_CPPFLAGS = $(AM_CPPFLAGS) $(gui_flags) $(common_flags) -DCLIENT_GUI
275amulegui_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY)
276amulegui_LDADD = $(gui_libs) $(common_libs) $(WXBASE_LIBS)
277
278amuled_DEPENDENCIES = $(core_deps) $(common_deps)
279amuled_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) $(core_flags) $(common_flags) -DAMULE_DAEMON 
280amuled_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY)
281amuled_LDADD = $(common_libs) $(core_libs) $(WXBASE_LIBS)
282
283ed2k_SOURCES = \
284	ED2KLinkParser.cpp \
285	MagnetURI.cpp \
286	MuleCollection.cpp	
287
288ed2k_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_STD_STRING
289
290# on Win32
291if SYS_WIN32
292ed2k_LDADD = -lshlwapi
293endif
294# on Mac
295if NEED_CORESERVICES
296ed2k_LDFLAGS = $(AM_LDFLAGS) -framework CoreServices
297endif
298
299amulecmd_SOURCES = \
300	TextClient.cpp \
301	ExternalConnector.cpp \
302	LoggerConsole.cpp \
303	OtherFunctions.cpp \
304	NetworkFunctions.cpp 
305
306amulecmd_DEPENDENCIES = $(remote_common_deps)
307amulecmd_CPPFLAGS = $(AM_CPPFLAGS) $(WXBASE_CPPFLAGS) $(common_flags)
308amulecmd_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CFLAGS_ONLY) $(WX_CXXFLAGS_ONLY)
309#amulecmd_LDADD = $(WXBASE_LIBS) $(READLINE_LIBS) $(remote_common_libs)
310amulecmd_LDADD = -Llibs/common -Llibs/ec/cpp -lmulecommon -lec \
311	$(WXBASE_LIBS) $(READLINE_LIBS) $(BFD_LIBS) $(ZLIB_LDFLAGS) $(ZLIB_LIBS) $(RESOLV_LIB)
312
313noinst_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
454
455MAINTAINERCLEANFILES = Makefile.in
456
457$(srcdir)/Parser.cpp: Parser.y
458	bison --debug -t -d -v -o $@ $(srcdir)/Parser.y
459
460if GENERATE_FLEX_HEADER
461$(srcdir)/Scanner.cpp: Scanner.l Parser.cpp
462		$(LEX) --header-file=$(srcdir)/Scanner.h -o $@ $(srcdir)/Scanner.l
463else
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
467endif
468
469$(srcdir)/IPFilterScanner.cpp: IPFilterScanner.l
470		$(LEX) -Pyyip -o $@ $(srcdir)/IPFilterScanner.l;
471
472# Resources
473
474if NEED_RC
475
476SUFFIXES = .rc
477
478.rc.$(OBJEXT):
479	$(RC) $(MULERCFLAGS) -I$(top_srcdir) $(RCFLAGS) -O COFF -i "$<" -o "$@"
480
481nodist_amuled_SOURCES = amuled-version.rc
482nodist_amulecmd_SOURCES = amulecmd-version.rc
483nodist_ed2k_SOURCES = ed2k-version.rc
484amule_LDADD += amulerc.$(OBJEXT)
485amule_DEPENDENCIES += amulerc.$(OBJEXT)
486amulegui_LDADD += amuleguirc.$(OBJEXT)
487amulegui_DEPENDENCIES += amuleguirc.$(OBJEXT)
488
489amulerc.$(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	)
497
498amuleguirc.$(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	)
506
507amule-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)"/' "$<" > "$@"
511
512amuled-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)"/' "$<" > "$@"
516
517amulecmd-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)"/' "$<" > "$@"
521
522amulegui-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)"/' "$<" > "$@"
526
527ed2k-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)"/' "$<" > "$@"
531
532CLEANFILES = *-version.rc
533
534endif
535
536
537EXTRA__DIST__SUBDIRS = include kademlia
538include $(top_srcdir)/automake/dist-hook.am
539
540