Index: build-msw.txt
===================================================================
--- build-msw.txt	(revision 43)
+++ build-msw.txt	(revision 44)
@@ -9,8 +9,8 @@
 
 
 WINDOWS BUILD NOTES
+===================
 
-
 Compilers Supported
 -------------------
 MinGW GCC
@@ -19,7 +19,7 @@
 
 Dependencies
 ------------
-Libraries you need to obtain separately to build:
+Libraries you need to download separately and build:
 
               default path   download
 wxWidgets      \wxwidgets     http://www.wxwidgets.org/downloads/
@@ -44,7 +44,7 @@
 
 Notes
 -----
-The UI layout is edited with wxFormBuilder.  Open the project file
+The UI layout is edited with wxFormBuilder.  The project file is
 uiproject.fbp.  It generates uibase.cpp and uibase.h, which define base
 classes that do the rote work of constructing all the UI elements.
 
Index: util.h
===================================================================
--- util.h	(revision 43)
+++ util.h	(revision 44)
@@ -111,6 +111,7 @@
 extern bool fPrintToDebugger;
 extern bool fPrintToConsole;
 extern char pszSetDataDir[MAX_PATH];
+extern bool fShutdown;
 
 void RandAddSeed();
 void RandAddSeedPerfmon();
@@ -128,6 +129,7 @@
 int GetFilesize(FILE* file);
 void GetDataDir(char* pszDirRet);
 string GetDataDir();
+void ShrinkDebugFile();
 uint64 GetRand(uint64 nMax);
 int64 GetTime();
 int64 GetAdjustedTime();
Index: main.cpp
===================================================================
--- main.cpp	(revision 43)
+++ main.cpp	(revision 44)
@@ -2530,7 +2530,7 @@
         //
         // Search
         //
-        unsigned int nStart = GetTime();
+        int64 nStart = GetTime();
         uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
         uint256 hash;
         loop
@@ -2582,14 +2582,27 @@
                     return;
                 if (fLimitProcessors && vnThreadsRunning[3] > nLimitProcessors)
                     return;
+                if (vNodes.empty())
+                    break;
                 if (tmp.block.nNonce == 0)
                     break;
-                if (pindexPrev != pindexBest)
-                    break;
                 if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)
                     break;
-                if (vNodes.empty())
+                if (pindexPrev != pindexBest)
+                {
+                    // Pause generating during initial download
+                    if (GetTime() - nStart < 20)
+                    {
+                        CBlockIndex* pindexTmp;
+                        do
+                        {
+                            pindexTmp = pindexBest;
+                            Sleep(10000);
+                        }
+                        while (pindexTmp != pindexBest);
+                    }
                     break;
+                }
                 tmp.block.nTime = pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
             }
         }
Index: net.cpp
===================================================================
--- net.cpp	(revision 43)
+++ net.cpp	(revision 44)
@@ -21,7 +21,6 @@
 CAddress addrLocalHost(0, DEFAULT_PORT, nLocalServices);
 CNode* pnodeLocalHost = NULL;
 uint64 nLocalHostNonce = 0;
-bool fShutdown = false;
 array<int, 10> vnThreadsRunning;
 SOCKET hListenSocket = INVALID_SOCKET;
 int64 nThreadSocketHandlerHeartbeat = INT64_MAX;
@@ -1324,3 +1323,27 @@
 
     return true;
 }
+
+class CNetCleanup
+{
+public:
+    CNetCleanup()
+    {
+    }
+    ~CNetCleanup()
+    {
+        // Close sockets
+        foreach(CNode* pnode, vNodes)
+            if (pnode->hSocket != INVALID_SOCKET)
+                closesocket(pnode->hSocket);
+        if (hListenSocket != INVALID_SOCKET)
+            if (closesocket(hListenSocket) == SOCKET_ERROR)
+                printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
+
+#ifdef __WXMSW__
+        // Shutdown Windows Sockets
+        WSACleanup();
+#endif
+    }
+}
+instance_of_cnetcleanup;
Index: serialize.h
===================================================================
--- serialize.h	(revision 43)
+++ serialize.h	(revision 44)
@@ -20,7 +20,7 @@
 class CAutoFile;
 
 static const int VERSION = 106;
-static const char* pszSubVer = " test10";
+static const char* pszSubVer = " test11";
 
 
 
Index: util.cpp
===================================================================
--- util.cpp	(revision 43)
+++ util.cpp	(revision 44)
@@ -11,6 +11,7 @@
 bool fPrintToDebugger = false;
 bool fPrintToConsole = false;
 char pszSetDataDir[MAX_PATH] = "";
+bool fShutdown = false;
 
 
 
@@ -53,19 +54,6 @@
         for (int i = 0; i < CRYPTO_num_locks(); i++)
             delete ppmutexOpenSSL[i];
         OPENSSL_free(ppmutexOpenSSL);
-
-        // Close sockets
-        foreach(CNode* pnode, vNodes)
-            if (pnode->hSocket != INVALID_SOCKET)
-                closesocket(pnode->hSocket);
-        if (hListenSocket != INVALID_SOCKET)
-            if (closesocket(hListenSocket) == SOCKET_ERROR)
-                printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
-
-#ifdef __WXMSW__
-        // Shutdown Windows Sockets
-        WSACleanup();
-#endif
     }
 }
 instance_of_cinit;
@@ -416,16 +404,6 @@
 
 
 
-int GetFilesize(FILE* file)
-{
-    int nSavePos = ftell(file);
-    int nFilesize = -1;
-    if (fseek(file, 0, SEEK_END) == 0)
-        nFilesize = ftell(file);
-    fseek(file, nSavePos, SEEK_SET);
-    return nFilesize;
-}
-
 void GetDataDir(char* pszDir)
 {
     // pszDir must be at least MAX_PATH length.
@@ -465,7 +443,35 @@
     return pszDir;
 }
 
+int GetFilesize(FILE* file)
+{
+    int nSavePos = ftell(file);
+    int nFilesize = -1;
+    if (fseek(file, 0, SEEK_END) == 0)
+        nFilesize = ftell(file);
+    fseek(file, nSavePos, SEEK_SET);
+    return nFilesize;
+}
 
+void ShrinkDebugFile()
+{
+    // Scroll debug.log if it's getting too big
+    string strFile = GetDataDir() + "/debug.log";
+    FILE* file = fopen(strFile.c_str(), "r");
+    if (file && GetFilesize(file) > 10 * 1000000)
+    {
+        // Restart the file with some of the end
+        char pch[200000];
+        fseek(file, -sizeof(pch), SEEK_END);
+        int nBytes = fread(pch, 1, sizeof(pch), file);
+        fclose(file);
+        if (file = fopen(strFile.c_str(), "w"))
+        {
+            fwrite(pch, 1, nBytes, file);
+            fclose(file);
+        }
+    }
+}
 
 
 
@@ -474,6 +480,9 @@
 
 
 
+
+
+
 //
 // "Never go to sea with two chronometers; take one or three."
 // Our three chronometers are:
Index: irc.cpp
===================================================================
--- irc.cpp	(revision 43)
+++ irc.cpp	(revision 44)
@@ -121,20 +121,20 @@
     }
 }
 
-bool RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL)
+int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL)
 {
     loop
     {
         string strLine;
         if (!RecvLineIRC(hSocket, strLine))
-            return false;
+            return 0;
         printf("IRC %s\n", strLine.c_str());
         if (psz1 && strLine.find(psz1) != -1)
-            return true;
+            return 1;
         if (psz2 && strLine.find(psz2) != -1)
-            return true;
+            return 2;
         if (psz3 && strLine.find(psz3) != -1)
-            return true;
+            return 3;
     }
 }
 
@@ -159,6 +159,7 @@
     SetThreadPriority(THREAD_PRIORITY_NORMAL);
     int nErrorWait = 10;
     int nRetryWait = 10;
+    bool fNameInUse = false;
     bool fTOR = (fUseProxy && addrProxy.port == htons(9050));
 
     while (!fShutdown)
@@ -194,7 +195,7 @@
         }
 
         string strMyName;
-        if (addrLocalHost.IsRoutable() && !fUseProxy)
+        if (addrLocalHost.IsRoutable() && !fUseProxy && !fNameInUse)
             strMyName = EncodeAddress(addrLocalHost);
         else
             strMyName = strprintf("x%u", GetRand(1000000000));
@@ -203,10 +204,18 @@
         Send(hSocket, strprintf("NICK %s\r", strMyName.c_str()).c_str());
         Send(hSocket, strprintf("USER %s 8 * : %s\r", strMyName.c_str(), strMyName.c_str()).c_str());
 
-        if (!RecvUntil(hSocket, " 004 "))
+        int nRet = RecvUntil(hSocket, " 004 ", " 433 ");
+        if (nRet != 1)
         {
             closesocket(hSocket);
             hSocket = INVALID_SOCKET;
+            if (nRet == 2)
+            {
+                printf("IRC name already in use\n");
+                fNameInUse = true;
+                Wait(10);
+                continue;
+            }
             nErrorWait = nErrorWait * 11 / 10;
             if (Wait(nErrorWait += 60))
                 continue;
Index: build-unix.txt
===================================================================
--- build-unix.txt	(revision 43)
+++ build-unix.txt	(revision 44)
@@ -9,8 +9,8 @@
 
 
 UNIX BUILD NOTES
+================
 
-
 Dependencies
 ------------
 apt-get install build-essential
@@ -20,11 +20,10 @@
 apt-get install libdb4.7++-dev
 apt-get install libboost-dev
 
-Libraries you need to obtain separately and build:
-              default path   download
-wxWidgets      \wxwidgets     http://www.wxwidgets.org/downloads/
+You need to download wxWidgets from http://www.wxwidgets.org/downloads/
+and build it yourself.
 
-Licenses:
+Licenses of statically linked libraries:
 wxWidgets      LGPL 2.1 with very liberal exceptions
 Berkeley DB    New BSD license with additional requirement that linked software must be free open source
 Boost          MIT-like license
@@ -39,7 +38,7 @@
 
 Notes
 -----
-The UI layout is edited with wxFormBuilder.  Open the project file
+The UI layout is edited with wxFormBuilder.  The project file is
 uiproject.fbp.  It generates uibase.cpp and uibase.h, which define base
 classes that do the rote work of constructing all the UI elements.
 
@@ -61,7 +60,7 @@
 
 Boost
 -----
-If you download and build Boost yourself
+If you want to build Boost yourself,
 cd /usr/local/boost_1_40_0
 su
 ./bootstrap.sh
Index: ui.cpp
===================================================================
--- ui.cpp	(revision 43)
+++ ui.cpp	(revision 44)
@@ -317,6 +317,7 @@
     fOnSetFocusAddress = false;
     fRefresh = false;
     m_choiceFilter->SetSelection(0);
+    double dResize = 1.0;
 #ifdef __WXMSW__
     SetIcon(wxICON(bitcoin));
 #else
@@ -330,6 +331,10 @@
     m_toolBar->AddTool(wxID_BUTTONSEND, "Send Coins", wxBitmap(send20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
     m_toolBar->AddTool(wxID_BUTTONRECEIVE, "Address Book", wxBitmap(addressbook20_xpm), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString);
     m_toolBar->Realize();
+    // resize to fit ubuntu's huge default font
+    dResize = 1.19;
+    SetSize(dResize * GetSize().GetWidth(), 1.1 * GetSize().GetHeight());
+    dResize = 1.20;
 #endif
     m_staticTextBalance->SetLabel(FormatMoney(GetBalance()) + "  ");
     m_listCtrl->SetFocus();
@@ -339,13 +344,13 @@
     int nDateWidth = DateTimeStr(1229413914).size() * 6 + 8;
     if (!strstr(DateTimeStr(1229413914).c_str(), "2008"))
         nDateWidth += 12;
-    m_listCtrl->InsertColumn(0, "",             wxLIST_FORMAT_LEFT,     0);
-    m_listCtrl->InsertColumn(1, "",             wxLIST_FORMAT_LEFT,     0);
-    m_listCtrl->InsertColumn(2, "Status",       wxLIST_FORMAT_LEFT,    90);
-    m_listCtrl->InsertColumn(3, "Date",         wxLIST_FORMAT_LEFT,   nDateWidth);
-    m_listCtrl->InsertColumn(4, "Description",  wxLIST_FORMAT_LEFT,   409 - nDateWidth);
-    m_listCtrl->InsertColumn(5, "Debit",        wxLIST_FORMAT_RIGHT,   79);
-    m_listCtrl->InsertColumn(6, "Credit",       wxLIST_FORMAT_RIGHT,   79);
+    m_listCtrl->InsertColumn(0, "",             wxLIST_FORMAT_LEFT,  dResize * 0);
+    m_listCtrl->InsertColumn(1, "",             wxLIST_FORMAT_LEFT,  dResize * 0);
+    m_listCtrl->InsertColumn(2, "Status",       wxLIST_FORMAT_LEFT,  dResize * 90);
+    m_listCtrl->InsertColumn(3, "Date",         wxLIST_FORMAT_LEFT,  dResize * nDateWidth);
+    m_listCtrl->InsertColumn(4, "Description",  wxLIST_FORMAT_LEFT,  dResize * 409 - nDateWidth);
+    m_listCtrl->InsertColumn(5, "Debit",        wxLIST_FORMAT_RIGHT, dResize * 79);
+    m_listCtrl->InsertColumn(6, "Credit",       wxLIST_FORMAT_RIGHT, dResize * 79);
 
     //m_listCtrlProductsSent->InsertColumn(0, "Category",      wxLIST_FORMAT_LEFT,  100);
     //m_listCtrlProductsSent->InsertColumn(1, "Title",         wxLIST_FORMAT_LEFT,  100);
@@ -367,6 +372,10 @@
 
     // Init status bar
     int pnWidths[3] = { -100, 88, 290 };
+#ifndef __WXMSW__
+    pnWidths[1] = pnWidths[1] * 1.1 * dResize;
+    pnWidths[2] = pnWidths[2] * 1.1 * dResize;
+#endif
     m_statusBar->SetFieldsCount(3, pnWidths);
 
     // Fill your address text box
@@ -1514,6 +1523,7 @@
     SelectPage(0);
 #ifndef __WXMSW__
     m_checkBoxMinimizeOnClose->SetLabel("&Minimize on close");
+    m_checkBoxStartOnSystemStartup->Enable(false); // not implemented yet
 #endif
 
     // Init values
@@ -1876,6 +1886,9 @@
     fSuccess = false;
     fUIDone = false;
     fWorkDone = false;
+#ifndef __WXMSW__
+    SetSize(1.2 * GetSize().GetWidth(), 1.05 * GetSize().GetHeight());
+#endif
 
     SetTitle(strprintf("Sending %s to %s", FormatMoney(nPrice).c_str(), wtx.mapValue["to"].c_str()));
     m_textCtrlStatus->SetValue("");
@@ -3475,6 +3488,7 @@
     ParseParameters(argc, argv);
     if (mapArgs.count("-?") || mapArgs.count("--help"))
     {
+#ifdef __WXMSW__
         string strUsage =
             "Usage: bitcoin [options]\t\t\t\t\t\t\n"
             "Options:\n"
@@ -3487,6 +3501,20 @@
             "  -connect=<ip>\t  Connect only to the specified node\n"
             "  -?\t\t  This help message\n";
         wxMessageBox(strUsage, "Bitcoin", wxOK);
+#else
+        string strUsage =
+            "Usage: bitcoin [options]\n"
+            "Options:\n"
+            "  -gen              Generate coins\n"
+            "  -gen=0            Don't generate coins\n"
+            "  -min              Start minimized\n"
+            "  -datadir=<dir>    Specify data directory\n"
+            "  -proxy=<ip:port>  Connect through socks4 proxy\n"
+            "  -addnode=<ip>     Add a node to connect to\n"
+            "  -connect=<ip>     Connect only to the specified node\n"
+            "  -?                This help message\n";
+        fprintf(stderr, "%s", strUsage.c_str());
+#endif
         return false;
     }
 
@@ -3495,12 +3523,12 @@
 
     if (mapArgs.count("-debug"))
         fDebug = true;
-    if (strstr(pszSubVer, "test"))
-        fDebug = true;
 
     if (mapArgs.count("-printtodebugger"))
         fPrintToDebugger = true;
 
+    if (!fDebug && !pszSetDataDir[0])
+        ShrinkDebugFile();
     printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
     printf("Bitcoin version %d%s, OS version %s\n", VERSION, pszSubVer, wxGetOsDescription().mb_str());
 
Index: makefile.unix
===================================================================
--- makefile.unix	(revision 43)
+++ makefile.unix	(revision 44)
@@ -22,13 +22,16 @@
 
 LIBPATHS= \
  -L"/usr/lib" \
- -L"/usr/local/lib" \
+ -L"/usr/local/lib"
 
 LIBS= \
- -Wl,-Bstatic -l boost_system -l boost_filesystem -Wl,-Bdynamic \
- -Wl,-Bstatic -l db_cxx -l wx_gtk2$(D)-2.8 -Wl,-Bdynamic \
- -l crypto \
- -l gtk-x11-2.0 -l gthread-2.0 -l SM
+ -Wl,-Bstatic \
+   -l boost_system -l boost_filesystem \
+   -l db_cxx \
+   -l wx_gtk2$(D)-2.8 \
+ -Wl,-Bdynamic \
+   -l crypto \
+   -l gtk-x11-2.0 -l gthread-2.0 -l SM
 
 WXDEFS=-D__WXGTK__ -DNOPCH
 CFLAGS=-O0 -Wno-invalid-offsetof -Wformat $(DEBUGFLAGS) $(WXDEFS) $(INCLUDEPATHS)
@@ -42,34 +45,34 @@
 headers.h.gch: headers.h $(HEADERS) net.h irc.h market.h uibase.h ui.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/util.o: util.cpp		    $(HEADERS)
+obj/util.o: util.cpp                $(HEADERS)
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/script.o: script.cpp	    $(HEADERS)
+obj/script.o: script.cpp            $(HEADERS)
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/db.o: db.cpp		    $(HEADERS) market.h
+obj/db.o: db.cpp                    $(HEADERS) market.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/net.o: net.cpp		    $(HEADERS) net.h
+obj/net.o: net.cpp                  $(HEADERS) net.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/main.o: main.cpp		    $(HEADERS) net.h market.h sha.h
+obj/main.o: main.cpp                $(HEADERS) net.h market.h sha.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/market.o: market.cpp	    $(HEADERS) market.h
+obj/market.o: market.cpp            $(HEADERS) market.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/ui.o: ui.cpp		    $(HEADERS) net.h uibase.h ui.h market.h
+obj/ui.o: ui.cpp                    $(HEADERS) net.h uibase.h ui.h market.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/uibase.o: uibase.cpp	    uibase.h
+obj/uibase.o: uibase.cpp            uibase.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/sha.o: sha.cpp		    sha.h
+obj/sha.o: sha.cpp                  sha.h
 	g++ -c $(CFLAGS) -O3 -o $@ $<
 
-obj/irc.o:  irc.cpp		    $(HEADERS)
+obj/irc.o: irc.cpp                  $(HEADERS)
 	g++ -c $(CFLAGS) -o $@ $<
 
 
@@ -76,7 +79,7 @@
 
 
 OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \
-	obj/ui.o obj/uibase.o obj/sha.o obj/irc.o
+        obj/ui.o obj/uibase.o obj/sha.o obj/irc.o
 
 bitcoin: headers.h.gch $(OBJS)
 	g++ $(CFLAGS) -o $@ $(LIBPATHS) $(OBJS) $(LIBS)
Index: db.cpp
===================================================================
--- db.cpp	(revision 43)
+++ db.cpp	(revision 44)
@@ -445,7 +445,7 @@
     CRITICAL_BLOCK(cs_mapAddresses)
     {
         // Load user provided addresses
-        CAutoFile filein = fopen("addr.txt", "rt");
+        CAutoFile filein = fopen((GetDataDir() + "/addr.txt").c_str(), "rt");
         if (filein)
         {
             try
@@ -536,10 +536,11 @@
 bool CWalletDB::LoadWallet(vector<unsigned char>& vchDefaultKeyRet)
 {
     vchDefaultKeyRet.clear();
+    int nFileVersion = 0;
 
     // Modify defaults
 #ifndef __WXMSW__
-    // Reports that tray icon can disappear on gnome, leaving no way to access the program
+    // Tray icon sometimes disappears on 9.10 karmic koala 64-bit, leaving no way to access the program
     fMinimizeToTray = false;
     fMinimizeOnClose = false;
 #endif
@@ -607,6 +608,10 @@
             {
                 ssValue >> vchDefaultKeyRet;
             }
+            else if (strType == "version")
+            {
+                ssValue >> nFileVersion;
+            }
             else if (strType == "setting")
             {
                 string strKey;
@@ -649,6 +654,16 @@
         WriteSetting("nTransactionFee", nTransactionFee);
     }
 
+    // Upgrade
+    if (nFileVersion < VERSION)
+    {
+        // Get rid of old debug.log file in current directory
+        if (nFileVersion <= 105 && !pszSetDataDir[0])
+            unlink("debug.log");
+
+        WriteVersion(VERSION);
+    }
+
     return true;
 }
 
@@ -656,7 +671,7 @@
 {
     fFirstRunRet = false;
     vector<unsigned char> vchDefaultKey;
-    if (!CWalletDB("cr").LoadWallet(vchDefaultKey))
+    if (!CWalletDB("cr+").LoadWallet(vchDefaultKey))
         return false;
     fFirstRunRet = vchDefaultKey.empty();
 
Index: net.h
===================================================================
--- net.h	(revision 43)
+++ net.h	(revision 44)
@@ -454,7 +454,6 @@
 extern CAddress addrLocalHost;
 extern CNode* pnodeLocalHost;
 extern uint64 nLocalHostNonce;
-extern bool fShutdown;
 extern array<int, 10> vnThreadsRunning;
 extern SOCKET hListenSocket;
 extern int64 nThreadSocketHandlerHeartbeat;
Index: makefile
===================================================================
--- makefile	(revision 43)
+++ makefile	(revision 44)
@@ -10,8 +10,6 @@
 endif
 ifeq "$(BUILD)" "debug"
 D=d
-# note: gcc 3.x profile doesn't work
-#DEBUGFLAGS=-O0 -g -pg -D__WXDEBUG__
 DEBUGFLAGS=-g -D__WXDEBUG__
 endif
 
@@ -36,34 +34,34 @@
 headers.h.gch: headers.h $(HEADERS) net.h irc.h market.h uibase.h ui.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/util.o: util.cpp		    $(HEADERS)
+obj/util.o: util.cpp                $(HEADERS)
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/script.o: script.cpp	    $(HEADERS)
+obj/script.o: script.cpp            $(HEADERS)
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/db.o: db.cpp		    $(HEADERS) market.h
+obj/db.o: db.cpp                    $(HEADERS) market.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/net.o: net.cpp		    $(HEADERS) net.h
+obj/net.o: net.cpp                  $(HEADERS) net.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/main.o: main.cpp		    $(HEADERS) net.h market.h sha.h
+obj/main.o: main.cpp                $(HEADERS) net.h market.h sha.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/market.o: market.cpp	    $(HEADERS) market.h
+obj/market.o: market.cpp            $(HEADERS) market.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/ui.o: ui.cpp		    $(HEADERS) net.h uibase.h ui.h market.h
+obj/ui.o: ui.cpp                    $(HEADERS) net.h uibase.h ui.h market.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/uibase.o: uibase.cpp	    uibase.h
+obj/uibase.o: uibase.cpp            uibase.h
 	g++ -c $(CFLAGS) -o $@ $<
 
-obj/sha.o: sha.cpp		    sha.h
+obj/sha.o: sha.cpp                  sha.h
 	g++ -c $(CFLAGS) -O3 -o $@ $<
 
-obj/irc.o:  irc.cpp		    $(HEADERS)
+obj/irc.o: irc.cpp                  $(HEADERS)
 	g++ -c $(CFLAGS) -o $@ $<
 
 obj/ui_res.o: ui.rc  rc/bitcoin.ico rc/check.ico rc/send16.bmp rc/send16mask.bmp rc/send16masknoshadow.bmp rc/send20.bmp rc/send20mask.bmp rc/addressbook16.bmp rc/addressbook16mask.bmp rc/addressbook20.bmp rc/addressbook20mask.bmp
@@ -71,8 +69,8 @@
 
 
 
-OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o	 \
-	obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/ui_res.o
+OBJS=obj/util.o obj/script.o obj/db.o obj/net.o obj/main.o obj/market.o \
+        obj/ui.o obj/uibase.o obj/sha.o obj/irc.o obj/ui_res.o
 
 bitcoin.exe: headers.h.gch $(OBJS)
 	-kill /f bitcoin.exe
