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