Merge with Bitcoin v0.6.3
[novacoin.git] / src / makefile.mingw
1 # Copyright (c) 2009-2010 Satoshi Nakamoto
2 # Copyright (c) 2012 The PPCoin developers
3 # Distributed under the MIT/X11 software license, see the accompanying
4 # file license.txt or http://www.opensource.org/licenses/mit-license.php.
5
6 # Windows commandline build procedure:
7 # - Install MinGW following http://www.mingw.org/wiki/Getting_Started.
8 #   Install with the C++ and MSYS options checked
9 #
10 # - Add/edit 'MAKE' environment variable with value '/c/MinGW32/bin/mingw32-make.exe'
11 #
12 # - Build openssl library version: 1.0.1b
13 #   download from  http://www.openssl.org/source/
14 #   Extract to c:\openssl-1.0.1b-mgw
15 #   In MinGW MSYS:
16 #     ./config
17 #     make
18 #
19 # - Build Berkeley DB library version: 4.8.30.NC
20 #   download from  http://www.oracle.com/technology/software/products/berkeley-db/index.html
21 #   Extract to c:\db-4.8.30.NC-mgw
22 #   In MinGW MSYS:
23 #     cd build_unix
24 #     sh ../dist/configure --disable-replication --enable-mingw --enable-cxx --prefix=/usr/local
25 #   Edit db.h@113 in build_unix
26 #   from
27 #     typedef pthread_t db_threadid_t;
28 #   to 
29 #     typedef u_int32_t db_threadid_t;
30 #   Then
31 #     make
32 #
33 # - Build Boost C++ library version: 1.47.0
34 #   download from http://www.boost.org/users/download/
35 #   Extract to c:\boost-1.47.0-mgw
36 #   Install Boost.Build:
37 #     cd tools\build\v2
38 #     bootstrap.bat
39 #     b2 install --prefix=BOOST_BUILD_INSTALL_DIR
40 #   Add BOOST_BUILD_INSTALL_DIR to your PATH system environment variable
41 #   Build boost library in MSDOS:
42 #     cd c:\boost-1.47.0-mgw
43 #     bjam toolset=gcc --build-type=complete stage
44 #
45 # - Build ppcoind.exe
46 #   in MinGW MSYS
47 #     cd ppcoin/src
48 #     make ppcoind.exe -f makefile.mingw USE_UPNP=
49 #
50 #
51
52 USE_UPNP:=0
53
54 INCLUDEPATHS= \
55  -I"C:\boost-1.47.0-mgw" \
56  -I"C:\db-4.8.30.NC-mgw\build_unix" \
57  -I"C:\openssl-1.0.1b-mgw\include"
58
59 LIBPATHS= \
60  -L"C:\boost-1.47.0-mgw\stage\lib" \
61  -L"C:\db-4.8.30.NC-mgw\build_unix" \
62  -L"C:\openssl-1.0.1b-mgw"
63
64 LIBS= \
65  -l boost_system-mgw46-mt-s-1_47 \
66  -l boost_filesystem-mgw46-mt-s-1_47 \
67  -l boost_program_options-mgw46-mt-s-1_47 \
68  -l boost_thread-mgw46-mt-s-1_47 \
69  -l db_cxx \
70  -l ssl \
71  -l crypto
72
73 DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE
74 DEBUGFLAGS=-g
75 CFLAGS=-mthreads -O2 -w -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
76
77 TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
78
79 ifdef USE_UPNP
80  INCLUDEPATHS += -I"C:\miniupnpc-1.6-mgw"
81  LIBPATHS += -L"C:\miniupnpc-1.6-mgw"
82  LIBS += -l miniupnpc -l iphlpapi
83  DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP)
84 endif
85
86 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 shlwapi
87
88 # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are
89 HEADERS = $(wildcard *.h)
90
91 OBJS= \
92     obj/version.o \
93     obj/checkpoints.o \
94     obj/netbase.o \
95     obj/addrman.o \
96     obj/crypter.o \
97     obj/key.o \
98     obj/db.o \
99     obj/init.o \
100     obj/irc.o \
101     obj/keystore.o \
102     obj/main.o \
103     obj/net.o \
104     obj/protocol.o \
105     obj/bitcoinrpc.o \
106     obj/rpcdump.o \
107     obj/script.o \
108     obj/util.o \
109     obj/wallet.o \
110     obj/walletdb.o \
111     obj/noui.o
112
113
114 all: ppcoind.exe
115
116 obj/%.o: %.cpp $(HEADERS)
117         g++ -c $(CFLAGS) -o $@ $<
118
119 ppcoind.exe: $(OBJS:obj/%=obj/%)
120         g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
121
122 TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
123
124 obj-test/%.o: test/%.cpp $(HEADERS)
125         g++ -c $(TESTDEFS) $(CFLAGS) -o $@ $<
126
127 test_bitcoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
128         g++ $(CFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework $(LIBS)
129
130 clean:
131         -del /Q ppcoind test_bitcoin
132         -del /Q obj\*
133         -del /Q obj-test\*
134         -del /Q build.h