Transaction View: LastMonth calculation fixed
[novacoin.git] / src / makefile.linux-mingw
1 # Copyright (c) 2009-2010 Satoshi Nakamoto
2 # Distributed under the MIT/X11 software license, see the accompanying
3 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5 TARGET_PLATFORM:=i686
6 #TARGET_PLATFORM:=x86_64
7 CC:=$(TARGET_PLATFORM)-w64-mingw32-gcc
8 CXX:=$(TARGET_PLATFORM)-w64-mingw32-g++
9 RANLIB:=$(TARGET_PLATFORM)-w64-mingw32-ranlib
10 STRIP:=$(TARGET_PLATFORM)-w64-mingw32-strip
11
12 DEPSDIR:=/usr/$(TARGET_PLATFORM)-w64-mingw32
13
14 BOOST_LIB_PATH:=$(DEPSDIR)/boost_1_57_0/stage/lib
15 BDB_LIB_PATH:=$(DEPSDIR)/db-6.0.20.NC/build_unix
16 OPENSSL_LIB_PATH:=$(DEPSDIR)/openssl-1.0.2g
17
18 BOOST_INCLUDE_PATH:=$(DEPSDIR)/boost_1_57_0
19 BDB_INCLUDE_PATH:=$(DEPSDIR)/db-6.0.20.NC/build_unix
20 OPENSSL_INCLUDE_PATH:=$(DEPSDIR)/openssl-1.0.2g/include
21
22 USE_LEVELDB:=0
23 USE_IPV6:=1
24
25 INCLUDEPATHS= \
26  -I"$(CURDIR)" \
27  -I"$(CURDIR)"/obj \
28  -I"$(BOOST_INCLUDE_PATH)" \
29  -I"$(BDB_INCLUDE_PATH)" \
30  -I"$(OPENSSL_INCLUDE_PATH)"
31
32 LIBPATHS= \
33  -L"$(BOOST_LIB_PATH)" \
34  -L"$(BDB_LIB_PATH)" \
35  -L"$(OPENSSL_LIB_PATH)"
36
37 LIBS= \
38  -l boost_system-mt \
39  -l boost_filesystem-mt \
40  -l boost_program_options-mt \
41  -l boost_thread_win32-mt \
42  -l boost_chrono-mt \
43  -l db_cxx \
44  -l ssl \
45  -l crypto \
46  -Wl,-Bstatic -lpthread -Wl,-Bdynamic
47
48 xOPT_LEVEL=-O2
49 ifeq (${USE_O3}, 1)
50     xOPT_LEVEL=-O3
51 endif
52
53 DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
54
55 DEBUGFLAGS=-g
56 CFLAGS=$(xOPT_LEVEL) -msse2 -w -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
57 LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -static-libgcc -static-libstdc++
58
59 ifneq (${USE_IPV6}, -)
60         DEFS += -DUSE_IPV6=$(USE_IPV6)
61 endif
62
63 LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi
64
65 # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are
66 HEADERS = $(wildcard *.h)
67
68 OBJS= \
69     obj/alert.o \
70     obj/version.o \
71     obj/checkpoints.o \
72     obj/netbase.o \
73     obj/addrman.o \
74     obj/crypter.o \
75     obj/base58.o \
76     obj/key.o \
77     obj/db.o \
78     obj/init.o \
79     obj/irc.o \
80     obj/keystore.o \
81     obj/main.o \
82     obj/miner.o \
83     obj/net.o \
84     obj/ntp.o \
85     obj/stun.o \
86     obj/protocol.o \
87     obj/bitcoinrpc.o \
88     obj/rpccrypt.o \
89     obj/rpcdump.o \
90     obj/rpcnet.o \
91     obj/rpcmining.o \
92     obj/rpcwallet.o \
93     obj/rpcblockchain.o \
94     obj/rpcrawtransaction.o \
95     obj/script.o \
96     obj/sync.o \
97     obj/util.o \
98     obj/wallet.o \
99     obj/walletdb.o \
100     obj/noui.o \
101     obj/kernel.o \
102     obj/kernel_worker.o \
103     obj/ecies.o \
104     obj/cryptogram.o \
105     obj/ipcollector.o
106
107 all: novacoind.exe
108
109 #
110 # LevelDB support
111 #
112 ifeq (${USE_LEVELDB}, 1)
113 LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
114 DEFS += -I"$(CURDIR)/leveldb/include" -DUSE_LEVELDB
115 DEFS += -I"$(CURDIR)/leveldb/helpers"
116 OBJS += obj/txdb-leveldb.o
117 leveldb/libleveldb.a:
118         @echo "Building LevelDB ..." && cd leveldb && CC=$(CC) CXX=$(CXX) TARGET_OS=OS_WINDOWS_CROSSCOMPILE CXXFLAGS="-I$(INCLUDEPATHS)" LDFLAGS="-L$(LIBPATHS)" $(MAKE) libleveldb.a libmemenv.a && $(RANLIB) libleveldb.a && $(RANLIB) libmemenv.a && cd ..
119 obj/txdb-leveldb.o: leveldb/libleveldb.a
120 else
121 OBJS += obj/txdb-bdb.o
122 endif
123
124 ifeq (${USE_ASM}, 1)
125 # Assembler implementation
126 OBJS += crypto/scrypt/asm/obj/scrypt-arm.o crypto/scrypt/asm/obj/scrypt-x86.o crypto/scrypt/asm/obj/scrypt-x86_64.o crypto/scrypt/asm/obj/asm-wrapper.o
127
128 crypto/scrypt/asm/obj/scrypt-x86.o: crypto/scrypt/asm/scrypt-x86.S
129         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
130
131 crypto/scrypt/asm/obj/scrypt-x86_64.o: crypto/scrypt/asm/scrypt-x86_64.S
132         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
133
134 crypto/scrypt/asm/obj/scrypt-arm.o: crypto/scrypt/asm/scrypt-arm.S
135         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
136
137 crypto/scrypt/asm/obj/asm-wrapper.o: crypto/scrypt/asm/asm-wrapper.cpp
138         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
139
140 DEFS += -DUSE_ASM
141 else
142 ifeq  (${USE_SSE2}, 1)
143 # Intrinsic implementation
144 DEFS += -DUSE_SSE2
145 OBJS += crypto/scrypt/intrin/obj/scrypt-sse2.o
146
147 crypto/scrypt/intrin/obj/scrypt-sse2.o: crypto/scrypt/intrin/scrypt-sse2.cpp $(HEADERS)
148         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
149 else
150 ifneq (${USE_ASM}, 1)
151 # Generic implementation
152 OBJS += crypto/scrypt/generic/obj/scrypt-generic.o
153
154 crypto/scrypt/generic/obj/scrypt-generic.o: crypto/scrypt/generic/scrypt-generic.cpp
155         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
156 endif
157 endif
158 endif
159
160
161
162 obj/build.h: FORCE
163         /bin/sh ../share/genbuild.sh obj/build.h
164 version.cpp: obj/build.h
165 DEFS += -DHAVE_BUILD_INFO
166
167 obj/%.o: %.cpp $(HEADERS)
168         $(CXX) -c $(CFLAGS) -o $@ $<
169
170 novacoind.exe: $(OBJS:obj/%=obj/%)
171         $(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) -lshlwapi
172         $(STRIP) novacoind.exe
173
174 clean:
175         -rm -f novacoind.exe
176         -rm -f obj/*.o
177         -rm -f obj/*.P
178         -rm -f obj/*.d
179         -rm -f crypto/scrypt/asm/obj/*.o
180         -rm -f crypto/scrypt/asm/obj/*.P
181         -rm -f crypto/scrypt/asm/obj/*.d
182         -rm -f crypto/scrypt/intrin/obj/*.o
183         -rm -f crypto/scrypt/intrin/obj/*.P
184         -rm -f crypto/scrypt/intrin/obj/*.d
185         -rm -f crypto/scrypt/generic/obj/*.o
186         -rm -f crypto/scrypt/generic/obj/*.P
187         -rm -f crypto/scrypt/generic/obj/*.d
188         -rm -f obj/build.h
189         cd leveldb && TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) clean && cd ..
190
191 FORCE: