Remove netbase.h from util header: create timedata files.
[novacoin.git] / src / makefile.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 USE_LEVELDB:=0
6 CC=gcc
7
8 USE_SSE2:=1
9
10 BOOST_SUFFIX?=-mgw49-mt-s-1_57
11
12 INCLUDEPATHS= \
13  -I"$(CURDIR)" \
14  -I"/c/deps/boost_1_57_0" \
15  -I"/c/deps" \
16  -I"/c/deps/db-6.0.20/build_unix" \
17  -I"/c/deps/openssl-1.0.2/include"
18  
19 LIBPATHS= \
20  -L"$(CURDIR)/leveldb" \
21  -L"/c/deps/boost_1_57_0/stage/lib" \
22  -L"/c/deps/db-6.0.20/build_unix" \
23  -L"/c/deps/openssl-1.0.2"
24
25 LIBS= \
26   -l leveldb \
27   -l memenv \
28   -l boost_system$(BOOST_SUFFIX) \
29   -l boost_filesystem$(BOOST_SUFFIX) \
30   -l boost_program_options$(BOOST_SUFFIX) \
31   -l boost_thread$(BOOST_SUFFIX) \
32   -l boost_chrono$(BOOST_SUFFIX) \
33   -l db_cxx \
34   -l ssl \
35   -l crypto
36
37 xOPT_LEVEL=-O2
38 ifeq (${USE_O3}, 1)
39     xOPT_LEVEL=-O3
40 endif
41
42 DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -D__STDC_FORMAT_MACROS
43 DEBUGFLAGS=-g
44 CFLAGS=-mthreads $(xOPT_LEVEL) -msse2 -w -Wall -Wextra -Wno-ignored-qualifiers -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
45 LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static
46
47 LIBS += -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
48
49 # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are
50 HEADERS = $(wildcard *.h)
51
52 OBJS= \
53     obj/alert.o \
54     obj/version.o \
55     obj/checkpoints.o \
56     obj/netbase.o \
57     obj/addrman.o \
58     obj/crypter.o \
59     obj/base58.o \
60     obj/key.o \
61     obj/db.o \
62     obj/init.o \
63     obj/irc.o \
64     obj/keystore.o \
65     obj/main.o \
66     obj/miner.o \
67     obj/net.o \
68     obj/ntp.o \
69     obj/stun.o \
70     obj/protocol.o \
71     obj/bitcoinrpc.o \
72     obj/rpccrypt.o \
73     obj/rpcdump.o \
74     obj/rpcnet.o \
75     obj/rpcmining.o \
76     obj/rpcwallet.o \
77     obj/rpcblockchain.o \
78     obj/rpcrawtransaction.o \
79     obj/script.o \
80     obj/sync.o \
81     obj/timedata.o \
82     obj/util.o \
83     obj/wallet.o \
84     obj/walletdb.o \
85     obj/noui.o \
86     obj/kernel.o \
87     obj/uint256.o \
88     obj/kernel_worker.o \
89     obj/ecies.o \
90     obj/cryptogram.o \
91     obj/ipcollector.o \
92     obj/serialize.o
93
94 all: novacoind.exe
95
96 #
97 # LevelDB support
98 #
99 ifdef USE_LEVELDB
100 LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a
101 DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) -DUSE_LEVELDB
102 DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
103 OBJS += obj/txdb-leveldb.o
104 leveldb/libleveldb.a:
105         cd leveldb;TARGET_OS=NATIVE_WINDOWS make libleveldb.a libmemenv.a;; cd ..
106 obj/txdb-leveldb.o: leveldb/libleveldb.a
107 else
108 OBJS += obj/txdb-bdb.o
109 endif
110
111 ifdef USE_ASM
112 # Assembler implementation
113 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
114
115 crypto/scrypt/asm/obj/scrypt-x86.o: crypto/scrypt/asm/scrypt-x86.S
116         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
117
118 crypto/scrypt/asm/obj/scrypt-x86_64.o: crypto/scrypt/asm/scrypt-x86_64.S
119         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
120
121 crypto/scrypt/asm/obj/scrypt-arm.o: crypto/scrypt/asm/scrypt-arm.S
122         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
123
124 crypto/scrypt/asm/obj/asm-wrapper.o: crypto/scrypt/asm/asm-wrapper.cpp
125         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
126
127 DEFS += -DUSE_ASM
128
129 else
130 ifdef USE_SSE2
131 # Intrinsic implementation
132 DEFS += -DUSE_SSE2
133 OBJS += scrypt-intrin/obj/scrypt-sse2.o
134
135 crypto/scrypt/intrin/obj/scrypt-sse2.o: crypto/scrypt/intrin/scrypt-sse2.cpp
136         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
137 else
138 # Generic implementation
139 OBJS += obj/scrypt-generic.o
140
141 crypto/scrypt/obj/scrypt-generic.o: crypto/scrypt/generic/scrypt-generic.cpp
142         $(CXX) -c $(CFLAGS) -MMD -o $@ $<
143 endif
144 endif
145
146
147 obj/%.o: %.cpp $(HEADERS)
148         g++ -c $(CFLAGS) -std=c++11 -o $@ $<
149
150 novacoind.exe: $(OBJS:obj/%=obj/%)
151         g++ $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
152
153 clean:
154         -del /Q novacoind.exe
155         -del /Q obj\*
156         -del /Q crypto\scrypt\asm\obj\*
157
158 FORCE: