forked from meganz/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.win32
141 lines (123 loc) · 4.64 KB
/
Makefile.win32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
##
# @file Makefile.win32
# @brief compilation rules to build Mega SDK dll and apps on MinGW
#
# (c) 2013-2014 by Mega Limited, Wellsford, New Zealand
#
# This file is part of the MEGA SDK - Client Access Engine.
#
# Applications using the MEGA API must present a valid application key
# and comply with the the rules set forth in the Terms of Service.
#
# The MEGA SDK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# @copyright Simplified (2-clause) BSD License.
#
# You should have received a copy of the license along with this
# program.
##
# In order to build Mega SDK dll on MinGW environment, the following directory structure is required:
# \project_root
# \zlib compiled zlib library, http://www.zlib.net/
# \cryptopp compiled Crypto++ library, http://www.cryptopp.com/
# \sodium compiled Sodium library, http://libsodium.org/
# \sqlite3 Sqlite3 sources, http://www.sqlite.org/
# \db (Optional) Berkeley DB, http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html
# \sdk Mega SDK sources, https://github.com/meganz/sdk
# \sdk\third_party Third party libraries
# \winhttp.h WinHTTP header file
# \winhttp.lib WinHTTP lib file
# \winhttp.dll WinHTTP dll
#
# To compile Mega DLL:
# make -f Makefile.win32
#
# In order to build megacli application, additional libraries are required:
# \FreeImage compiled FreeImage library, http://freeimage.sourceforge.net/
# \readline compiled The GNU Readline Library, http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
# \termcap compiled The Termcap Library, http://ftp.gnu.org/gnu/termcap/
#
# To compile Mega DLL and all applications:
# make -f Makefile.win32 all
CXX=g++
CC=gcc
# common compilation flags for all apps
CXXFLAGS=-DUNICODE -DUSE_SQLITE -DUSE_CRYPTOPP -DUSE_FREEIMAGE -DENABLE_SYNC=1 -D_WIN32=1 -g -Wall -I. -Iinclude -Iinclude/mega -Iinclude/mega/win32 -isystem ../zlib -isystem ../cryptopp -isystem ../sodium/src/libsodium/include -isystem ../db/build_windows -Idb -isystem .. -isystem ../sqlite3 -isystem ../FreeImage/Dist
# megacli specific compilation flags
MEGACLI_CXXFLAGS=-isystem ../FreeImage/Dist
# common linked libraries for all apps
LIB=-lwinhttp -lws2_32 -lcrypt32 -lole32 -lwinmm -lshlwapi -L../zlib -lz -L../cryptopp -lcryptopp -L../sodium/src/libsodium/.libs -lsodium -L../db/build_windows -L../ -L../FreeImage/Dist -lfreeimage
# megacli specific linked libraries
MEGACLI_LIB=-L../FreeImage/Dist -lfreeimage -L../readline -lreadline -L../termcap -ltermcap
LDFLAGS=
COMMON_SRC=\
src/attrmap.cpp \
src/backofftimer.cpp \
src/base64.cpp \
src/command.cpp \
src/commands.cpp \
src/db.cpp \
src/fileattributefetch.cpp \
src/file.cpp \
src/filefingerprint.cpp \
src/filesystem.cpp \
src/http.cpp \
src/json.cpp \
src/node.cpp \
src/pubkeyaction.cpp \
src/request.cpp \
src/serialize64.cpp \
src/share.cpp \
src/sharenodekeys.cpp \
src/sync.cpp \
src/transfer.cpp \
src/transferslot.cpp \
src/treeproc.cpp \
src/user.cpp \
src/utils.cpp \
src/logging.cpp \
src/waiterbase.cpp \
src/megaclient.cpp \
src/proxy.cpp \
src/pendingcontactrequest.cpp \
src/crypto/cryptopp.cpp \
src/crypto/sodium.cpp \
src/gfx.cpp \
src/gfx/freeimage.cpp \
src/win32/fs.cpp src/win32/console.cpp src/win32/net.cpp src/win32/waiter.cpp src/win32/consolewaiter.cpp \
src/db/sqlite.cpp \
src/mega_utf8proc.cpp
MEGACLI_SRC=examples/megacli.cpp
MEGASIMPLESYNC_SRC=examples/megasimplesync.cpp
COMMON_OBJ=$(COMMON_SRC:.cpp=.o)
MEGACLI_OBJ=$(MEGACLI_SRC:.cpp=.o)
MEGASIMPLESYNC_OBJ=$(MEGASIMPLESYNC_SRC:.cpp=.o)
SQLITE_SRC=../sqlite3/sqlite3.c
SQLITE_OBJ=$(SQLITE_SRC:.c=.o)
# Targets
MEGA=mega
PROGS=megacli megasimplesync
# build rules
$(MEGA).dll: $(COMMON_OBJ) $(SQLITE_OBJ)
$(CXX) -shared $(COMMON_OBJ) $(SQLITE_OBJ) $(CXXFLAGS) $(LDFLAGS) $(LIB) -Wl,-no-undefined,--enable-runtime-pseudo-reloc,--out-implib,$(MEGA).lib -o $(MEGA).dll
all: $(MEGA).dll $(PROGS)
megacli: $(MEGACLI_OBJ)
$(CXX) $(LDFLAGS) $^ -o $@ $(MEGACLI_LIB) -L. -lmega
megasimplesync: $(MEGASIMPLESYNC_OBJ)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ $(LIB) -L. -lmega
$(SQLITE_SRC):
$(CC) -c $< -o $@
$(COMMON_SRC):
$(CXX) -c $(CXXFLAGS) $< -o $@
$(MEGACLI_OBJ):
$(CXX) $(CXXFLAGS) $(MEGACLI_CXXFLAGS) -c $(MEGACLI_SRC) -o $@
.PHONY: clean
clean:
-rm $(COMMON_OBJ)
-rm $(MEGACLI_OBJ)
-rm $(MEGASIMPLESYNC_OBJ)
-rm $(SQLITE_OBJ)
-rm $(PROGS:=.exe)
-rm $(MEGA).dll $(MEGA).lib